Skip to content

Commit 4821958

Browse files
committed
first routing
1 parent 89d83eb commit 4821958

File tree

8 files changed

+250
-9
lines changed

8 files changed

+250
-9
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
{
3+
"resourceSpans": [
4+
{
5+
"resource": {
6+
"attributes": [
7+
{
8+
"key": "service.name",
9+
"value": {
10+
"stringValue": "not my service"
11+
}
12+
}
13+
]
14+
},
15+
"scopeSpans": [
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+
},
29+
"spans": [
30+
{
31+
"traceId": "5B8EFFF798038103D269B633813FC60C",
32+
"spanId": "EEE19B7EC3C1B174",
33+
"parentSpanId": "EEE19B7EC3C1B173",
34+
"name": "I'm a server span",
35+
"startTimeUnixNano": "1544712660000000000",
36+
"endTimeUnixNano": "1544712661000000000",
37+
"kind": 2,
38+
"attributes": [
39+
{
40+
"keytest": "my.span.attr",
41+
"value": {
42+
"stringValue": "ph was not here"
43+
}
44+
}
45+
]
46+
}
47+
]
48+
}
49+
]
50+
}
51+
]
52+
}
Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,101 @@
1+
extensions:
2+
file_storage/checkpoint:
3+
directory: ./checkpoint-folder
4+
create_directory: true
5+
timeout: 1s
6+
compaction:
7+
on_start: true
8+
directory: ./checkpoint-folder
9+
max_transaction_size: 65_536
10+
111
receivers:
2-
collectd:
3-
endpoint: "0.0.0.0:8081"
12+
otlp:
13+
protocols:
14+
http:
15+
endpoint: "0.0.0.0:4318"
16+
#filelog:
17+
# include: [ /output/file.log ]
18+
# storage: file_storage/checkpoint
419

520
exporters:
621
debug:
7-
verbosity: detailed
8-
file:
9-
path: ./agent.out
22+
verbosity: detailed
23+
file:
24+
path: ./agent.out
25+
rotation:
26+
max_megabytes: 2
27+
max_backups: 2
28+
29+
otlp/gateway:
30+
endpoint: "localhost:5317"
31+
tls:
32+
insecure: true
33+
retry_on_failure:
34+
enabled: true
35+
# initial_interval: 1s
36+
# max_interval: 5s
37+
# max_elapsed_time: 20s
38+
sending_queue:
39+
enabled: true
40+
num_consumers: 10
41+
queue_size: 10000
42+
storage: file_storage/checkpoint
43+
44+
timeout: 5s
45+
headers:
46+
X-SF-Token: "123456"
47+
48+
connectors:
49+
routing:
50+
default_pipelines: [traces/jaeger]
51+
error_mode: ignore
52+
match_once: false
53+
table:
54+
- statement: route() where attributes["X-Tenant"] == "acme"
55+
pipelines: [traces/jaeger-acme]
56+
- statement: delete_key(attributes, "X-Tenant") where IsMatch(attributes["X-Tenant"], ".*corp")
57+
pipelines: [traces/jaeger-ecorp]
1058

59+
processors:
60+
batch:
61+
metadata_keys:
62+
- X-SF-Token
63+
memory_limiter:
64+
check_interval: 2s
65+
limit_mib: 512
66+
67+
resourcedetection:
68+
detectors: [system]
69+
override: true
70+
71+
resource/add_mode:
72+
attributes:
73+
- action: insert
74+
value: "agent"
75+
key: otelcol.service.mode
1176

1277
service:
78+
extensions: [file_storage/checkpoint]
1379
pipelines:
14-
metrics:
15-
receivers: [collectd]
16-
exporters: [debug]
80+
traces:
81+
receivers: [otlp]
82+
processors:
83+
- memory_limiter
84+
- batch
85+
- resourcedetection
86+
- resource/add_mode
87+
exporters: [otlp/gateway, debug]
88+
metrics:
89+
receivers: [otlp]
90+
processors:
91+
- memory_limiter
92+
- batch
93+
- resourcedetection
94+
exporters: [ otlp/gateway, debug]
95+
logs:
96+
receivers: [otlp]
97+
processors:
98+
- memory_limiter
99+
- batch
100+
- resourcedetection
101+
exporters: [ otlp/gateway, debug]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"resourceSpans": [
3+
{
4+
"resource": {
5+
"attributes": [
6+
{
7+
"key": "service.name",
8+
"value": {
9+
"stringValue": "frontend"
10+
}
11+
}
12+
]
13+
},
14+
"scopeSpans": [
15+
{
16+
"scope": {
17+
"name": "healthz",
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+
"spans": [
29+
{
30+
"traceId": "5B8EFFF798038103D269B633813FC60C",
31+
"spanId": "EEE19B7EC3C1B174",
32+
"parentSpanId": "EEE19B7EC3C1B173",
33+
"name": "/_healthz",
34+
"startTimeUnixNano": "1544712660000000000",
35+
"endTimeUnixNano": "1544712661000000000",
36+
"kind": 2,
37+
"attributes": []
38+
}
39+
]
40+
}
41+
]
42+
}
43+
]
44+
}

workshop/ninja/advanced-otel/7-routing/run-collectd.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
curl -X POST -i http://localhost:4318/v1/traces \
2+
-H "Content-Type: application/json" \
3+
-d @oltp-health.json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
curl -X POST -i http://localhost:4318/v1/traces \
2+
-H "Content-Type: application/json" \
3+
-d @trace.json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
$HOME/collectors/otelcol_darwin_arm64 --config=agent-routing.yaml
3+
#$HOME/collectors/otelcol-contrib --config=agent-routing.yaml
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
{
3+
"resourceSpans": [
4+
{
5+
"resource": {
6+
"attributes": [
7+
{
8+
"key": "service.name",
9+
"value": {
10+
"stringValue": "not my service"
11+
}
12+
}
13+
]
14+
},
15+
"scopeSpans": [
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+
},
29+
"spans": [
30+
{
31+
"traceId": "5B8EFFF798038103D269B633813FC60C",
32+
"spanId": "EEE19B7EC3C1B174",
33+
"parentSpanId": "EEE19B7EC3C1B173",
34+
"name": "I'm a server span",
35+
"startTimeUnixNano": "1544712660000000000",
36+
"endTimeUnixNano": "1544712661000000000",
37+
"kind": 2,
38+
"attributes": [
39+
{
40+
"keytest": "my.span.attr",
41+
"value": {
42+
"stringValue": "ph was not here"
43+
}
44+
}
45+
]
46+
}
47+
]
48+
}
49+
]
50+
}
51+
]
52+
}

0 commit comments

Comments
 (0)