You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/ninja-workshops/10-advanced-otel/8-routing/_index.md
+8-16Lines changed: 8 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ time: 10 minutes
5
5
weight: 8
6
6
---
7
7
8
-
The routing connector in OpenTelemetry is a powerful feature that allows you to direct data (`traces`, `metrics`, or l`ogs`) to different pipelines based on specific criteria. This is especially useful in scenarios where you want to apply different processing or exporting logic to subsets of your telemetry data.
8
+
The routing connector in OpenTelemetry is a powerful feature that allows you to direct data (`traces`, `metrics`, or `logs`) to different pipelines based on specific criteria. This is especially useful in scenarios where you want to apply different processing or exporting logic to subsets of your telemetry data.
9
9
10
10
For example, you might want to send *production* data to one exporter while directing *test* or *development* data to another. Similarly, you could route certain spans based on their attributes, such as service name, environment, or span name, to apply custom processing or storage logic.
11
11
@@ -26,9 +26,9 @@ WORKSHOP
26
26
├── 7-transform-data
27
27
├── 8-routing
28
28
│ ├── agent.yaml
29
+
│ ├── health.json
29
30
│ ├── gateway.yaml
30
31
│ ├── log-gen.sh (or .ps1)
31
-
│ ├── health.json
32
32
│ └── trace.json
33
33
└── otelcol
34
34
```
@@ -41,13 +41,12 @@ In the following exercise, you will configure the `routing connector` in the `ga
41
41
Open the `gateway.yaml` and add the following configuration:
42
42
43
43
-**Add the `connectors:` section**:
44
-
In OpenTelemetry configuration files, `connectors` have their own dedicated section, similar to receivers and processors. In the `gateway.yaml`file, insert the `connectors:` section below the receivers section and above the processors section.
44
+
In OpenTelemetry configuration files, `connectors` have their own dedicated section, similar to receivers and processors. In the `gateway.yaml`file, insert the `connectors:` section below the `receivers` section and above the `processors` section.
45
45
46
46
```yaml
47
47
connectors: # Section to configure connectors
48
48
49
49
processors:
50
-
#memory_limiter:
51
50
52
51
```
53
52
@@ -67,7 +66,7 @@ In OpenTelemetry configuration files, `connectors` have their own dedicated sect
67
66
```
68
67
69
68
- **Configure two `file:` Exporters**:
70
-
The `routing connector` requires different targets for routing. To achieve this, update the default `file/traces:` exporter and name it `file/traces/default` and add a second file exporter called `file/traces/security:`. This will allow the routing connector to direct data to the appropriate target based on the rules you define.
69
+
The `routing connector` requires different targets for routing. To achieve this, update the default `file/traces:` exporter and name it `file/traces/default:` and add a second file exporter called `file/traces/security:`. This will allow the routing connector to direct data to the appropriate target based on the rules you define.
@@ -80,15 +79,12 @@ The `routing connector` requires different targets for routing. To achieve this,
80
79
append: false # Overwrite the file each time
81
80
```
82
81
83
-
- **Add both the `standard` and `security traces` pipelines**:
84
-
To enable routing we need to define two pipelines for traces:
82
+
- **Add both the `standard` and `security` traces pipelines**:
85
83
86
-
1. **Standard** pipeline.
87
-
This pipeline will handle all spans that do not match the routing rule. Add it below the regular `traces:` pipeline, and leave the configuration unchanged for now.
84
+
1. **Standard** pipeline: This pipeline will handle all spans that do not match the routing rule. Add it below the regular `traces:` pipeline, and leave the configuration unchanged for now.
88
85
89
86
```yaml
90
87
pipelines:
91
-
#traces:
92
88
traces/standard: # New Default Traces/Spans Pipeline
93
89
receivers:
94
90
- routing # Routing Connector, Only receives data from Connector
@@ -100,12 +96,10 @@ To enable routing we need to define two pipelines for traces:
100
96
- file/traces/standard # File Exporter for spans NOT matching rule
101
97
```
102
98
103
-
- The Target pipeline, that will handle all spans that match the routing rule.
99
+
- **Target pipeline**: This pipepline will handle all spans that match the routing rule.
104
100
105
101
```yaml
106
102
pipelines:
107
-
#traces:
108
-
#traces/standard:
109
103
traces/security: # New Security Traces/Spans Pipeline
110
104
receivers:
111
105
- routing # Routing Connector, Only receives data from Connector
@@ -115,11 +109,9 @@ To enable routing we need to define two pipelines for traces:
115
109
exporters:
116
110
- debug # Debug Exporter
117
111
- file/traces/security # File Exporter for spans matching rule
118
-
#metrics:
119
112
```
120
113
121
-
- **Update the `traces` pipeline to handle routing**:
122
-
To enable `routing`, update the original `traces:` pipeline by adding `routing` as an exporter. This ensures that all span data is sent through the routing connector for evaluation.
114
+
- **Update the `traces` pipeline to handle routing**: To enable `routing`, update the original `traces:` pipeline by adding `routing` as an exporter. This ensures that all span data is sent through the routing connector for evaluation.
123
115
124
116
For clarity, we are removing the `debug` exporter from this pipeline, so that debug output is only shown from the new exporters behind the routing connector.
0 commit comments