Skip to content

Commit 5119d68

Browse files
committed
end of day push
1 parent 549fc7f commit 5119d68

File tree

7 files changed

+56
-104
lines changed

7 files changed

+56
-104
lines changed

content/en/ninja-workshops/10-advanced-otel/10-agent-setup/_index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ Let's start with our first exercise:
3030

3131
{{% notice title="Exercise" style="green" icon="running" %}}
3232

33-
* Add an **otlp** receiver, under the *protocols* section, add a *HTTP* entry, with an endpoint of *"0.0.0.0:4318"* and add it to all the pipelines
34-
* Add a **debug** exporter with *verbosity* entry set to *detailed* and also add it to all the pipelines
33+
* Add an **otlp:** receiver, under the *protocols:* section, add a *HTTP:* entry, with an endpoint of *"0.0.0.0:4318"* and add it as a receiver to all the 8*receiver:* sections of the pipelines
34+
* Enable the **memory_limiter:** processor by adding it in the *processor:* section of all the pipelines
35+
* Add a **debug:* exporter with *verbosity:* entry set to *detailed* and also add it as an exporter in all *exporter:* sections of the pipelines
3536

3637
{{% /notice %}}
3738

@@ -52,7 +53,7 @@ Run the following command to test your config (make sure you use the right otel
5253
[LOCATION_OF_OTELCOLLECTOR]/otelcol_darwin_arm64 --config=agent.yaml
5354
```
5455

55-
If you have done everything correctly the last line of the out put should be :
56+
If you have done everything correctly, the last line of the output should be :
5657

5758
```text
5859
2025-01-13T12:43:51.747+0100 info [email protected]/service.go:261 Everything is ready. Begin running and processing data.

content/en/ninja-workshops/10-advanced-otel/10-agent-setup/fileexporter.md

Lines changed: 13 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -9,122 +9,37 @@ Let's run our second exercise:
99

1010
{{% notice title="Exercise" style="green" icon="running" %}}
1111

12-
* Add an **file** exporter, add a *path* entry, with a value of *"agent.out"* and add the exporter as the first exporter entry to all the pipelines (leaving debug in place)
12+
* Add an **file:** exporter, add a *path:* entry, with a value of *"./agent.out"*
13+
* Configure file size constrains by adding a *rotation:* section, add a *max_megabytes:* entry with a value of *"2"* as well as and *max_backups:* also with a value of 2
14+
* Add the exporter as the first exporter entry to all the pipelines (leaving debug as the second one )
1315

1416
{{% /notice %}}
1517

1618
Validate your new `agent.yaml` with [https://otelbin.io](https://otelbin.io), your pipelines should look like this:
1719

18-
![otelbin1](../images/agent-1-1.png)
20+
![otelbin2](../../images/agent-1-2.png)
1921

20-
---
21-
Run the following command to test your config (make sure you use the right otel collector you downloaded):
22+
start your collector again with your new config to test it:
2223

2324
```text
2425
otelcol_darwin_arm64 --config=agent.yaml
2526
```
2627

27-
If you have done everything correctly the last line of the out put should be:
28+
Again, if you have done everything correctly, the last line of the output should be:
2829

2930
```text
30-
2025-01-13T12:43:51.747+0100 info service@v0.115.0/service.go:261 Everything is ready. Begin running and processing data.
31+
2025-01-13T12:43:51.747+0100 info service@v0.116.0/service.go:261 Everything is ready. Begin running and processing data.
3132
```
3233

33-
Now start a new shell and create a file called **trace.json* and copy the following content:
34-
35-
```json
36-
{
37-
"resourceSpans": [
38-
{
39-
"resource": {
40-
"attributes": [
41-
{
42-
"key": "service.name",
43-
"value": {
44-
"stringValue": "my.service"
45-
}
46-
},
47-
{
48-
"key": "deployment.environment",
49-
"value": {
50-
"stringValue": "my.environment"
51-
}
52-
}
53-
]
54-
},
55-
"scopeSpans": [
56-
{
57-
"scope": {
58-
"name": "my.library",
59-
"version": "1.0.0",
60-
"attributes": [
61-
{
62-
"key": "my.scope.attribute",
63-
"value": {
64-
"stringValue": "some scope attribute"
65-
}
66-
}
67-
]
68-
},
69-
"spans": [
70-
{
71-
"traceId": "5B8EFFF798038103D269B633813FC60C",
72-
"spanId": "EEE19B7EC3C1B174",
73-
"parentSpanId": "EEE19B7EC3C1B173",
74-
"name": "I'm a server span",
75-
"startTimeUnixNano": "1544712660000000000",
76-
"endTimeUnixNano": "1544712661000000000",
77-
"kind": 2,
78-
"attributes": [
79-
{
80-
"keytest": "my.span.attr",
81-
"value": {
82-
"stringValue": "some value"
83-
}
84-
}
85-
]
86-
}
87-
]
88-
}
89-
]
90-
}
91-
]
92-
}
93-
```
34+
If you send a trace again, you should get the same output as we saw previously, but you also should have a file in the same directory called **agent.out**
35+
In the file the trace is written as a single line in oltp.json format, when you look at the file it looks like this:
9436

95-
In the second Shell, run the following command to test your setup:
37+
```text
9638
97-
```shell
98-
curl -X POST -i http://localhost:4318/v1/traces \
99-
-H "Content-Type: application/json" \
100-
-d @trace.json
10139
```
10240

103-
Your collector should show the following output:
41+
If you want it json expanded, you can cat the file and pipe it though jq ( if you have it installed)
10442

105-
```text
106-
2025-01-13T13:26:13.502+0100 info Traces {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
107-
2025-01-13T13:26:13.502+0100 info ResourceSpans #0
108-
Resource SchemaURL:
109-
Resource attributes:
110-
-> service.name: Str(my.service)
111-
-> deployment.environment: Str(my.environment)
112-
ScopeSpans #0
113-
ScopeSpans SchemaURL:
114-
InstrumentationScope my.library 1.0.0
115-
InstrumentationScope attributes:
116-
-> my.scope.attribute: Str(some scope attribute)
117-
Span #0
118-
Trace ID : 5b8efff798038103d269b633813fc60c
119-
Parent ID : eee19b7ec3c1b173
120-
ID : eee19b7ec3c1b174
121-
Name : I'm a server span
122-
Kind : Server
123-
Start time : 2018-12-13 14:51:00 +0000 UTC
124-
End time : 2018-12-13 14:51:01 +0000 UTC
125-
Status code : Unset
126-
Status message :
127-
Attributes:
128-
-> : Str(some value)
129-
{"kind": "exporter", "data_type": "traces", "name": "debug"}
43+
```bash
44+
cat ./agent.json | jq
13045
```
-7.96 KB
Loading
139 KB
Loading

workshop/ninja/advanced-otel/1-agent/agent-file.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ receivers:
33
collection_interval: 10s
44
scrapers:
55
cpu:
6+
67
otlp:
78
protocols:
89
http:

workshop/ninja/advanced-otel/1-agent/agent.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ receivers:
77
exporters:
88
debug:
99
verbosity: detailed
10+
file:
11+
path: "./agent.out"
12+
rotation:
13+
max_megabytes: 2
14+
max_backups: 2
1015

1116
processors:
1217
memory_limiter:
@@ -17,10 +22,10 @@ service:
1722
pipelines:
1823
traces:
1924
receivers: [otlp]
20-
exporters: [debug]
25+
exporters: [file, debug]
2126
metrics:
2227
receivers: [otlp]
23-
exporters: [debug]
28+
exporters: [file, debug]
2429
logs:
2530
receivers: [otlp]
26-
exporters: [debug]
31+
exporters: [file, debug]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
http:
5+
endpoint: "0.0.0.0:4318"
6+
7+
exporters:
8+
debug:
9+
verbosity: detailed
10+
11+
12+
processors:
13+
memory_limiter:
14+
check_interval: 2s
15+
limit_mib: 512
16+
17+
service:
18+
pipelines:
19+
traces:
20+
receivers: [otlp]
21+
processors: [memory_limiter]
22+
exporters: [ file, debug]
23+
metrics:
24+
receivers: [otlp]
25+
processors: [memory_limiter]
26+
exporters: [file, debug]
27+
logs:
28+
receivers: [otlp]
29+
processors: [memory_limiter]
30+
exporters: [ file, debug]

0 commit comments

Comments
 (0)