Skip to content

Commit

Permalink
Flatten field + fix u64 to string serde (#1911)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
  • Loading branch information
3 people authored Jul 16, 2024
1 parent 47e52f1 commit a9b8621
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 0 deletions.
119 changes: 119 additions & 0 deletions opentelemetry-otlp/tests/integration_test/expected/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"resourceMetrics": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "my.service"
}
}
]
},
"scopeMetrics": [
{
"scope": {
"name": "my.library",
"version": "1.0.0",
"attributes": [
{
"key": "my.scope.attribute",
"value": {
"stringValue": "some scope attribute"
}
}
]
},
"metrics": [
{
"name": "my.counter",
"unit": "1",
"description": "I am a Counter",
"metadata": [],
"sum": {
"aggregationTemporality": 1,
"isMonotonic": true,
"dataPoints": [
{
"asDouble": 5,
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"attributes": [
{
"key": "my.counter.attr",
"value": {
"stringValue": "some value"
}
}
],
"exemplars": [],
"flags": 0
}
]
}
},
{
"name": "my.gauge",
"unit": "1",
"description": "I am a Gauge",
"metadata": [],
"gauge": {
"dataPoints": [
{
"asDouble": 10,
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"attributes": [
{
"key": "my.gauge.attr",
"value": {
"stringValue": "some value"
}
}
],
"exemplars": [],
"flags": 0
}
]
}
},
{
"name": "my.histogram",
"unit": "1",
"description": "I am a Histogram",
"metadata": [],
"histogram": {
"aggregationTemporality": 1,
"dataPoints": [
{
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"count": 2,
"sum": 2,
"bucketCounts": [1,1],
"explicitBounds": [1],
"min": 0,
"max": 2,
"attributes": [
{
"key": "my.histogram.attr",
"value": {
"stringValue": "some value"
}
}
],
"exemplars": [],
"flags": 0
}
]
}
}
],
"schemaUrl": "whatever"
}
],
"schemaUrl": "whatever"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"resourceMetrics": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "my.service"
}
}
],
"droppedAttributesCount": 0
},
"scopeMetrics": [
{
"scope": {
"name": "my.library",
"version": "1.0.0",
"attributes": [
{
"key": "my.scope.attribute",
"value": {
"stringValue": "some scope attribute"
}
}
],
"droppedAttributesCount": 0
},
"metrics": [
{
"name": "my.counter",
"description": "I am a Counter",
"unit": "1",
"metadata": [],
"sum": {
"dataPoints": [
{
"attributes": [
{
"key": "my.counter.attr",
"value": {
"stringValue": "some value"
}
}
],
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"exemplars": [],
"flags": 0,
"asDouble": 5.0
}
],
"aggregationTemporality": 1,
"isMonotonic": true
}
},
{
"name": "my.gauge",
"description": "I am a Gauge",
"unit": "1",
"metadata": [],
"gauge": {
"dataPoints": [
{
"attributes": [
{
"key": "my.gauge.attr",
"value": {
"stringValue": "some value"
}
}
],
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"exemplars": [],
"flags": 0,
"asDouble": 10.0
}
]
}
},
{
"name": "my.histogram",
"description": "I am a Histogram",
"unit": "1",
"metadata": [],
"histogram": {
"dataPoints": [
{
"attributes": [
{
"key": "my.histogram.attr",
"value": {
"stringValue": "some value"
}
}
],
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"count": 2,
"sum": 2.0,
"bucketCounts": [
1,
1
],
"explicitBounds": [
1.0
],
"exemplars": [],
"flags": 0,
"min": 0.0,
"max": 2.0
}
],
"aggregationTemporality": 1
}
}
],
"schemaUrl": "whatever"
}
],
"schemaUrl": "whatever"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"resourceSpans": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-tracing-example"
}
}
],
"droppedAttributesCount": 0
},
"scopeSpans": [
{
"scope": {
"name": "ex.com/basic",
"version": "",
"attributes": [],
"droppedAttributesCount": 0
},
"spans": [
{
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "cd7cf7bf939930b7",
"traceState": "",
"parentSpanId": "d58cf2d702a061e0",
"flags": 0,
"name": "Sub operation...",
"kind": 1,
"startTimeUnixNano": "1703985537070566698",
"endTimeUnixNano": "1703985537070572718",
"attributes": [
{
"key": "lemons",
"value": {
"stringValue": "five"
}
}
],
"droppedAttributesCount": 0,
"events": [
{
"timeUnixNano": "1703985537070567697",
"name": "Sub span event",
"attributes": [],
"droppedAttributesCount": 0
}
],
"droppedEventsCount": 0,
"links": [],
"droppedLinksCount": 0,
"status": {
"message": "",
"code": 0
}
}
],
"schemaUrl": ""
}
],
"schemaUrl": ""
},
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-tracing-example"
}
}
],
"droppedAttributesCount": 0
},
"scopeSpans": [
{
"scope": {
"name": "ex.com/basic",
"version": "",
"attributes": [],
"droppedAttributesCount": 0
},
"spans": [
{
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "d58cf2d702a061e0",
"traceState": "",
"parentSpanId": "",
"flags": 0,
"name": "operation",
"kind": 1,
"startTimeUnixNano": "1703985537070558635",
"endTimeUnixNano": "1703985537070580454",
"attributes": [
{
"key": "ex.com/another",
"value": {
"stringValue": "yes"
}
}
],
"droppedAttributesCount": 0,
"events": [
{
"timeUnixNano": "1703985537070563326",
"name": "Nice operation!",
"attributes": [
{
"key": "bogons",
"value": {
"intValue": "100"
}
}
],
"droppedAttributesCount": 0
}
],
"droppedEventsCount": 0,
"links": [],
"droppedLinksCount": 0,
"status": {
"message": "",
"code": 0
}
}
],
"schemaUrl": ""
}
],
"schemaUrl": ""
}
]
}
1 change: 1 addition & 0 deletions opentelemetry-otlp/tests/integration_test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod images;
pub mod logs_asserter;
pub mod metrics_asserter;
pub mod trace_asserter;
Loading

0 comments on commit a9b8621

Please sign in to comment.