Skip to content

Commit a9b8621

Browse files
hwrdtmlalitbTommyCpp
authored
Flatten field + fix u64 to string serde (#1911)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com> Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
1 parent 47e52f1 commit a9b8621

File tree

9 files changed

+485
-0
lines changed

9 files changed

+485
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"resourceMetrics": [
3+
{
4+
"resource": {
5+
"attributes": [
6+
{
7+
"key": "service.name",
8+
"value": {
9+
"stringValue": "my.service"
10+
}
11+
}
12+
]
13+
},
14+
"scopeMetrics": [
15+
{
16+
"scope": {
17+
"name": "my.library",
18+
"version": "1.0.0",
19+
"attributes": [
20+
{
21+
"key": "my.scope.attribute",
22+
"value": {
23+
"stringValue": "some scope attribute"
24+
}
25+
}
26+
]
27+
},
28+
"metrics": [
29+
{
30+
"name": "my.counter",
31+
"unit": "1",
32+
"description": "I am a Counter",
33+
"metadata": [],
34+
"sum": {
35+
"aggregationTemporality": 1,
36+
"isMonotonic": true,
37+
"dataPoints": [
38+
{
39+
"asDouble": 5,
40+
"startTimeUnixNano": "1544712660300000000",
41+
"timeUnixNano": "1544712660300000000",
42+
"attributes": [
43+
{
44+
"key": "my.counter.attr",
45+
"value": {
46+
"stringValue": "some value"
47+
}
48+
}
49+
],
50+
"exemplars": [],
51+
"flags": 0
52+
}
53+
]
54+
}
55+
},
56+
{
57+
"name": "my.gauge",
58+
"unit": "1",
59+
"description": "I am a Gauge",
60+
"metadata": [],
61+
"gauge": {
62+
"dataPoints": [
63+
{
64+
"asDouble": 10,
65+
"startTimeUnixNano": "1544712660300000000",
66+
"timeUnixNano": "1544712660300000000",
67+
"attributes": [
68+
{
69+
"key": "my.gauge.attr",
70+
"value": {
71+
"stringValue": "some value"
72+
}
73+
}
74+
],
75+
"exemplars": [],
76+
"flags": 0
77+
}
78+
]
79+
}
80+
},
81+
{
82+
"name": "my.histogram",
83+
"unit": "1",
84+
"description": "I am a Histogram",
85+
"metadata": [],
86+
"histogram": {
87+
"aggregationTemporality": 1,
88+
"dataPoints": [
89+
{
90+
"startTimeUnixNano": "1544712660300000000",
91+
"timeUnixNano": "1544712660300000000",
92+
"count": 2,
93+
"sum": 2,
94+
"bucketCounts": [1,1],
95+
"explicitBounds": [1],
96+
"min": 0,
97+
"max": 2,
98+
"attributes": [
99+
{
100+
"key": "my.histogram.attr",
101+
"value": {
102+
"stringValue": "some value"
103+
}
104+
}
105+
],
106+
"exemplars": [],
107+
"flags": 0
108+
}
109+
]
110+
}
111+
}
112+
],
113+
"schemaUrl": "whatever"
114+
}
115+
],
116+
"schemaUrl": "whatever"
117+
}
118+
]
119+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{
2+
"resourceMetrics": [
3+
{
4+
"resource": {
5+
"attributes": [
6+
{
7+
"key": "service.name",
8+
"value": {
9+
"stringValue": "my.service"
10+
}
11+
}
12+
],
13+
"droppedAttributesCount": 0
14+
},
15+
"scopeMetrics": [
16+
{
17+
"scope": {
18+
"name": "my.library",
19+
"version": "1.0.0",
20+
"attributes": [
21+
{
22+
"key": "my.scope.attribute",
23+
"value": {
24+
"stringValue": "some scope attribute"
25+
}
26+
}
27+
],
28+
"droppedAttributesCount": 0
29+
},
30+
"metrics": [
31+
{
32+
"name": "my.counter",
33+
"description": "I am a Counter",
34+
"unit": "1",
35+
"metadata": [],
36+
"sum": {
37+
"dataPoints": [
38+
{
39+
"attributes": [
40+
{
41+
"key": "my.counter.attr",
42+
"value": {
43+
"stringValue": "some value"
44+
}
45+
}
46+
],
47+
"startTimeUnixNano": "1544712660300000000",
48+
"timeUnixNano": "1544712660300000000",
49+
"exemplars": [],
50+
"flags": 0,
51+
"asDouble": 5.0
52+
}
53+
],
54+
"aggregationTemporality": 1,
55+
"isMonotonic": true
56+
}
57+
},
58+
{
59+
"name": "my.gauge",
60+
"description": "I am a Gauge",
61+
"unit": "1",
62+
"metadata": [],
63+
"gauge": {
64+
"dataPoints": [
65+
{
66+
"attributes": [
67+
{
68+
"key": "my.gauge.attr",
69+
"value": {
70+
"stringValue": "some value"
71+
}
72+
}
73+
],
74+
"startTimeUnixNano": "1544712660300000000",
75+
"timeUnixNano": "1544712660300000000",
76+
"exemplars": [],
77+
"flags": 0,
78+
"asDouble": 10.0
79+
}
80+
]
81+
}
82+
},
83+
{
84+
"name": "my.histogram",
85+
"description": "I am a Histogram",
86+
"unit": "1",
87+
"metadata": [],
88+
"histogram": {
89+
"dataPoints": [
90+
{
91+
"attributes": [
92+
{
93+
"key": "my.histogram.attr",
94+
"value": {
95+
"stringValue": "some value"
96+
}
97+
}
98+
],
99+
"startTimeUnixNano": "1544712660300000000",
100+
"timeUnixNano": "1544712660300000000",
101+
"count": 2,
102+
"sum": 2.0,
103+
"bucketCounts": [
104+
1,
105+
1
106+
],
107+
"explicitBounds": [
108+
1.0
109+
],
110+
"exemplars": [],
111+
"flags": 0,
112+
"min": 0.0,
113+
"max": 2.0
114+
}
115+
],
116+
"aggregationTemporality": 1
117+
}
118+
}
119+
],
120+
"schemaUrl": "whatever"
121+
}
122+
],
123+
"schemaUrl": "whatever"
124+
}
125+
]
126+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"resourceSpans": [
3+
{
4+
"resource": {
5+
"attributes": [
6+
{
7+
"key": "service.name",
8+
"value": {
9+
"stringValue": "basic-otlp-tracing-example"
10+
}
11+
}
12+
],
13+
"droppedAttributesCount": 0
14+
},
15+
"scopeSpans": [
16+
{
17+
"scope": {
18+
"name": "ex.com/basic",
19+
"version": "",
20+
"attributes": [],
21+
"droppedAttributesCount": 0
22+
},
23+
"spans": [
24+
{
25+
"traceId": "9b458af7378cba65253d7042d34fc72e",
26+
"spanId": "cd7cf7bf939930b7",
27+
"traceState": "",
28+
"parentSpanId": "d58cf2d702a061e0",
29+
"flags": 0,
30+
"name": "Sub operation...",
31+
"kind": 1,
32+
"startTimeUnixNano": "1703985537070566698",
33+
"endTimeUnixNano": "1703985537070572718",
34+
"attributes": [
35+
{
36+
"key": "lemons",
37+
"value": {
38+
"stringValue": "five"
39+
}
40+
}
41+
],
42+
"droppedAttributesCount": 0,
43+
"events": [
44+
{
45+
"timeUnixNano": "1703985537070567697",
46+
"name": "Sub span event",
47+
"attributes": [],
48+
"droppedAttributesCount": 0
49+
}
50+
],
51+
"droppedEventsCount": 0,
52+
"links": [],
53+
"droppedLinksCount": 0,
54+
"status": {
55+
"message": "",
56+
"code": 0
57+
}
58+
}
59+
],
60+
"schemaUrl": ""
61+
}
62+
],
63+
"schemaUrl": ""
64+
},
65+
{
66+
"resource": {
67+
"attributes": [
68+
{
69+
"key": "service.name",
70+
"value": {
71+
"stringValue": "basic-otlp-tracing-example"
72+
}
73+
}
74+
],
75+
"droppedAttributesCount": 0
76+
},
77+
"scopeSpans": [
78+
{
79+
"scope": {
80+
"name": "ex.com/basic",
81+
"version": "",
82+
"attributes": [],
83+
"droppedAttributesCount": 0
84+
},
85+
"spans": [
86+
{
87+
"traceId": "9b458af7378cba65253d7042d34fc72e",
88+
"spanId": "d58cf2d702a061e0",
89+
"traceState": "",
90+
"parentSpanId": "",
91+
"flags": 0,
92+
"name": "operation",
93+
"kind": 1,
94+
"startTimeUnixNano": "1703985537070558635",
95+
"endTimeUnixNano": "1703985537070580454",
96+
"attributes": [
97+
{
98+
"key": "ex.com/another",
99+
"value": {
100+
"stringValue": "yes"
101+
}
102+
}
103+
],
104+
"droppedAttributesCount": 0,
105+
"events": [
106+
{
107+
"timeUnixNano": "1703985537070563326",
108+
"name": "Nice operation!",
109+
"attributes": [
110+
{
111+
"key": "bogons",
112+
"value": {
113+
"intValue": "100"
114+
}
115+
}
116+
],
117+
"droppedAttributesCount": 0
118+
}
119+
],
120+
"droppedEventsCount": 0,
121+
"links": [],
122+
"droppedLinksCount": 0,
123+
"status": {
124+
"message": "",
125+
"code": 0
126+
}
127+
}
128+
],
129+
"schemaUrl": ""
130+
}
131+
],
132+
"schemaUrl": ""
133+
}
134+
]
135+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub mod images;
22
pub mod logs_asserter;
3+
pub mod metrics_asserter;
34
pub mod trace_asserter;

0 commit comments

Comments
 (0)