Skip to content

Commit

Permalink
Add protobuf text and binary formatted samples for metrics and trace …
Browse files Browse the repository at this point in the history
…services
  • Loading branch information
nuclearpidgeon committed Jul 3, 2024
1 parent ff457ce commit f6bb641
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 0 deletions.
Binary file added examples/metrics.protobuf-bin
Binary file not shown.
112 changes: 112 additions & 0 deletions examples/metrics.protobuf-text
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# proto-file: opentelemetry/proto/collector/metrics/v1/trace_service.proto
# proto-message: ExportMetricsServiceRequest
# this message can be compiled to a binary message file with:
# cat examples/metrics.protobuf-text | protoc --encode=opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest opentelemetry/proto/collector/metrics/v1/metrics_service.proto > 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"
}
}
]
}
]
}
}
]
}
]
}
]
Binary file added examples/trace.protobuf-bin
Binary file not shown.
56 changes: 56 additions & 0 deletions examples/trace.protobuf-text
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# proto-file: opentelemetry/proto/collector/trace/v1/trace_service.proto
# proto-message: ExportTraceServiceRequest
# this message can be compiled to a binary message file with:
# cat examples/trace.protobuf-text | protoc --encode=opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest opentelemetry/proto/collector/trace/v1/trace_service.proto > 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"
}
}
]
}
]
}
]
}
]

0 comments on commit f6bb641

Please sign in to comment.