Skip to content

Commit 2d07323

Browse files
committed
tests: runtime: in_opentelemetry_routing: add context tests
This patch adds runtime tests for OpenTelemetry input with context-based conditional routing. Signed-off-by: Eduardo Silva <[email protected]>
1 parent 6b8fbdd commit 2d07323

File tree

3 files changed

+613
-0
lines changed

3 files changed

+613
-0
lines changed

tests/runtime/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ if(FLB_OUT_LIB)
6161
FLB_RT_TEST(FLB_IN_FLUENTBIT_METRICS "in_fluentbit_metrics.c")
6262
FLB_RT_TEST(FLB_IN_PROMETHEUS_TEXTFILE "in_prometheus_textfile.c")
6363
FLB_RT_TEST(FLB_IN_KUBERNETES_EVENTS "in_kubernetes_events.c")
64+
FLB_RT_TEST(FLB_IN_OPENTELEMETRY "in_opentelemetry_routing.c")
6465
if (FLB_IN_SYSTEMD)
6566
FLB_RT_TEST(FLB_IN_SYSTEMD "in_systemd.c")
6667
endif ()
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{
2+
"resourceLogs": [
3+
{
4+
"resource": {
5+
"attributes": [
6+
{
7+
"key": "service_name",
8+
"value": {
9+
"stringValue": "service-a"
10+
}
11+
},
12+
{
13+
"key": "service_version",
14+
"value": {
15+
"stringValue": "1.0.0"
16+
}
17+
},
18+
{
19+
"key": "environment",
20+
"value": {
21+
"stringValue": "production"
22+
}
23+
}
24+
],
25+
"droppedAttributesCount": 0
26+
},
27+
"scopeLogs": [
28+
{
29+
"scope": {
30+
"name": "scope-a",
31+
"version": "v1.0",
32+
"attributes": [
33+
{
34+
"key": "component",
35+
"value": {
36+
"stringValue": "backend"
37+
}
38+
}
39+
],
40+
"droppedAttributesCount": 0
41+
},
42+
"logRecords": [
43+
{
44+
"timeUnixNano": "1640995200000000000",
45+
"body": {
46+
"stringValue": "record from service-a scope-a"
47+
},
48+
"attributes": [
49+
{
50+
"key": "level",
51+
"value": {
52+
"stringValue": "info"
53+
}
54+
}
55+
]
56+
},
57+
{
58+
"timeUnixNano": "1640995201000000000",
59+
"body": {
60+
"stringValue": "error record from service-a"
61+
},
62+
"attributes": [
63+
{
64+
"key": "level",
65+
"value": {
66+
"stringValue": "error"
67+
}
68+
}
69+
]
70+
}
71+
]
72+
}
73+
]
74+
},
75+
{
76+
"resource": {
77+
"attributes": [
78+
{
79+
"key": "service_name",
80+
"value": {
81+
"stringValue": "service-b"
82+
}
83+
},
84+
{
85+
"key": "service_version",
86+
"value": {
87+
"stringValue": "2.0.0"
88+
}
89+
},
90+
{
91+
"key": "environment",
92+
"value": {
93+
"stringValue": "staging"
94+
}
95+
}
96+
],
97+
"droppedAttributesCount": 0
98+
},
99+
"scopeLogs": [
100+
{
101+
"scope": {
102+
"name": "scope-b",
103+
"version": "v2.0",
104+
"attributes": [
105+
{
106+
"key": "component",
107+
"value": {
108+
"stringValue": "frontend"
109+
}
110+
}
111+
],
112+
"droppedAttributesCount": 0
113+
},
114+
"logRecords": [
115+
{
116+
"timeUnixNano": "1640995202000000000",
117+
"body": {
118+
"stringValue": "record from service-b scope-b"
119+
},
120+
"attributes": [
121+
{
122+
"key": "level",
123+
"value": {
124+
"stringValue": "debug"
125+
}
126+
}
127+
]
128+
}
129+
]
130+
},
131+
{
132+
"scope": {
133+
"name": "scope-c",
134+
"version": "v1.5",
135+
"attributes": [
136+
{
137+
"key": "component",
138+
"value": {
139+
"stringValue": "database"
140+
}
141+
}
142+
],
143+
"droppedAttributesCount": 0
144+
},
145+
"logRecords": [
146+
{
147+
"timeUnixNano": "1640995203000000000",
148+
"body": {
149+
"stringValue": "query log from service-b"
150+
},
151+
"attributes": [
152+
{
153+
"key": "operation",
154+
"value": {
155+
"stringValue": "SELECT"
156+
}
157+
}
158+
]
159+
}
160+
]
161+
}
162+
]
163+
},
164+
{
165+
"resource": {
166+
"attributes": [
167+
{
168+
"key": "service_name",
169+
"value": {
170+
"stringValue": "service-c"
171+
}
172+
},
173+
{
174+
"key": "service_version",
175+
"value": {
176+
"stringValue": "3.0.0"
177+
}
178+
}
179+
],
180+
"droppedAttributesCount": 0
181+
},
182+
"scopeLogs": [
183+
{
184+
"scope": {
185+
"name": "scope-d",
186+
"version": "v3.0",
187+
"attributes": [],
188+
"droppedAttributesCount": 0
189+
},
190+
"logRecords": [
191+
{
192+
"timeUnixNano": "1640995204000000000",
193+
"body": {
194+
"stringValue": "unmatched record should go to default"
195+
}
196+
}
197+
]
198+
}
199+
]
200+
}
201+
]
202+
}
203+

0 commit comments

Comments
 (0)