From f6bb64114ae482bf52712683d740bc70baadb6e3 Mon Sep 17 00:00:00 2001 From: Stewart Webb Date: Wed, 3 Jul 2024 18:03:19 +1000 Subject: [PATCH] Add protobuf text and binary formatted samples for metrics and trace services --- examples/metrics.protobuf-bin | Bin 0 -> 449 bytes examples/metrics.protobuf-text | 112 +++++++++++++++++++++++++++++++++ examples/trace.protobuf-bin | Bin 0 -> 214 bytes examples/trace.protobuf-text | 56 +++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 examples/metrics.protobuf-bin create mode 100644 examples/metrics.protobuf-text create mode 100644 examples/trace.protobuf-bin create mode 100644 examples/trace.protobuf-text diff --git a/examples/metrics.protobuf-bin b/examples/metrics.protobuf-bin new file mode 100644 index 0000000000000000000000000000000000000000..c821ceb76bdef1882e9145d18ef0734c77b2ffd6 GIT binary patch literal 449 zcmd#KXmvTd4;X5}M7-

tY$xJFrEUFY@HPkcE zGmz5Z5(248&M!#SODriV%1kOPNfi>~5-HBlO;rGkD examples/metrics.protobuf-bin +# and then delivered via cURL with: +# curl -X POST --data-binary @metrics.protobuf-bin -H "Content-Type: application/x-protobuf" localhost:4318/opentelemetry.proto.collector.metrics.v1.MetricsService/Export + +resource_metrics: [ + { + resource: { + attributes: [ + { + key: "service.name", + value: { + string_value: "my.service" + } + } + ] + }, + scope_metrics: [ + { + scope: { + name: "my.library", + version: "1.0.0", + attributes: [ + { + key: "my.scope.attribute", + value: { + string_value: "some scope attribute" + } + } + ] + }, + metrics: [ + { + name: "my.counter", + unit: "1", + description: "I am a Counter", + sum: { + aggregation_temporality: 1, + is_monotonic: true, + data_points: [ + { + as_double: 5, + start_time_unix_nano: 1544712660300000000, + time_unix_nano: 1544712660300000000, + attributes: [ + { + key: "my.counter.attr", + value: { + string_value: "some value" + } + } + ] + } + ] + } + }, + { + name: "my.gauge", + unit: "1", + description: "I am a Gauge", + gauge: { + data_points: [ + { + as_double: 10, + time_unix_nano: 1544712660300000000, + attributes: [ + { + key: "my.gauge.attr", + value: { + string_value: "some value" + } + } + ] + } + ] + } + }, + { + name: "my.histogram", + unit: "1", + description: "I am a Histogram", + histogram: { + aggregation_temporality: 1, + data_points: [ + { + start_time_unix_nano: 1544712660300000000, + time_unix_nano: 1544712660300000000, + count: 2, + sum: 2, + bucket_counts: [1,1], + explicit_bounds: [1], + min: 0, + max: 2, + attributes: [ + { + key: "my.histogram.attr", + value: { + string_value: "some value" + } + } + ] + } + ] + } + } + ] + } + ] + } +] diff --git a/examples/trace.protobuf-bin b/examples/trace.protobuf-bin new file mode 100644 index 0000000000000000000000000000000000000000..c646a99d66910a842427976bba0a768e09e809bb GIT binary patch literal 214 zcmd#KXmvTd4;X657DX

tY$xJFrEUFY@HPkcE zGmz5Z5(248&M!#SODriV%1kOPNfi>~5-HBlO;rGkDbDMFa z{V^UPj&~1d*Bw5%u|x^RD%KM8RL@mNQ~+6?TBJ~1keFw{WXa$W`S{oCd{IXRp)Yd3 ZfebI8lR=gPrNMTCoD8 examples/trace.protobuf-bin +# and then delivered via cURL with: +# curl -X POST --data-binary @trace.protobuf-bin -H "Content-Type: application/x-protobuf" localhost:4318/opentelemetry.proto.collector.trace.v1.TraceService/Export + +resource_spans: [ + { + resource: { + attributes: [ + { + key: "service.name", + value: { + string_value: "my.service" + } + } + ] + }, + scope_spans: [ + { + scope: { + name: "my.library", + version: "1.0.0", + attributes: [ + { + key: "my.scope.attribute", + value: { + string_value: "some scope attribute" + } + } + ] + }, + spans: [ + { + trace_id: "\x5B\x8E\xFF\xF7\x98\x03\x81\x03\xD2\x69\xB6\x33\x81\x3F\xC6\x0C", + span_id: "\xEE\xE1\x9B\x7E\xC3\xC1\xB1\x74", + parent_span_id: "\xEE\xE1\x9B\x7E\xC3\xC1\xB1\x73", + name: "I'm a server span", + start_time_unix_nano: 1544712660000000000, + end_time_unix_nano: 1544712661000000000, + kind: 2, + attributes: [ + { + key: "my.span.attr", + value: { + string_value: "some value" + } + } + ] + } + ] + } + ] + } +] \ No newline at end of file