Skip to content

Commit 9242897

Browse files
committed
Minor edits
1 parent 1ece95c commit 9242897

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

content/en/conf/1-advanced-collector/6-routing-data/6-1-connector.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,36 @@ linkTitle: 6.1 Routing Configuration
44
weight: 1
55
---
66

7-
In this exercise, you will configure the **Routing Connector** in the `gateway.yaml` file. This setup enables the **Gateway** to route traces based on the `deployment.environment` attribute in the spans you send. By implementing this, you can process and handle traces differently depending on their attributes.
7+
In this exercise, you will configure the **Routing Connector** in the `gateway.yaml`. While the Routing Connector can route metrics, traces, and logs based on any attributes, we will focus exclusively on trace routing.
8+
9+
This setup enables the Gateway to route traces based on the `deployment.environment` attribute (though any span attribute can be used).
810

911
{{% notice title="Exercise" style="green" icon="running" %}}
1012

13+
**Configure `file` exporters**: The `routing` connector requires separate targets for routing. Create two new file exporters, `file/traces/route1` and `file/traces/route2`, to ensure data is directed correctly in the `exporters` section of the `gateway.yaml`:
14+
15+
```yaml
16+
file/traces/route1: # Exporter for regular traces
17+
path: "./gateway-traces-route1.out" # Path for saving trace data
18+
append: false # Overwrite the file each time
19+
file/traces/route2: # Exporter for security traces
20+
path: "./gateway-traces-route2.out" # Path for saving trace data
21+
append: false # Overwrite the file each time
22+
```
23+
1124
In OpenTelemetry configuration files, `connectors` have their own dedicated section, similar to receivers and processors.
1225

1326
**Add the `routing` connector**:
1427
In the **Gateway terminal** window, edit `gateway.yaml` and uncomment the `#connectors:` section. Then, add the following below the `connectors:` section:
1528

1629
```yaml
17-
connectors:
1830
routing:
19-
default_pipelines: [traces/standard] # Default pipeline if no rule matches
31+
default_pipelines: [traces/route1] # Default pipeline if no rule matches
2032
error_mode: ignore # Ignore errors in routing
2133
table: # Define routing rules
2234
# Routes spans to a target pipeline if the resourceSpan attribute matches the rule
2335
- statement: route() where attributes["deployment.environment"] == "security-applications"
24-
pipelines: [traces/security] # Target pipeline
25-
```
26-
27-
The rules above apply to traces, but this approach also applies to `metrics` and `logs`, allowing them to be routed based on attributes in `resourceMetrics` or `resourceLogs`.
28-
29-
**Configure `file:` exporters**: The `routing` connector requires separate targets for routing. In the `exporters:` section, add two file exporters, `file/traces/security` and `file/traces/standard`, to ensure data is directed correctly.
30-
31-
```yaml
32-
file/traces/standard: # Exporter for regular traces
33-
path: "./gateway-traces-standard.out" # Path for saving trace data
34-
append: false # Overwrite the file each time
35-
file/traces/security: # Exporter for security traces
36-
path: "./gateway-traces-security.out" # Path for saving trace data
37-
append: false # Overwrite the file each time
36+
pipelines: [traces/route2] # Target pipeline
3837
```
3938

4039
{{% /notice %}}

content/en/conf/1-advanced-collector/6-routing-data/6-2-pipelines.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,24 @@ weight: 2
88

99
**Update the `traces` pipeline to use routing**:
1010

11-
1. To enable `routing`, update the original `traces:` pipeline by using `routing` as the only exporter. This ensures all span data is sent through the routing connector for evaluation.
12-
2. Remove all processors and replace it with an empty array (`[]`). These are now defined in the `traces/standard` and `traces/security` pipelines.
11+
1. To enable `routing`, update the original `traces:` pipeline by using `routing` as the only exporter. This ensures all span data is sent through the **Routing Connector** for evaluation. Also, remove **all** processors and replace it with an empty array (`[]`) as these are now defined in the `traces/route1` and `traces/route2` pipelines.
1312

1413
```yaml
15-
pipelines:
16-
traces: # Original traces pipeline
17-
receivers:
18-
- otlp # OTLP Receiver
19-
processors: []
20-
exporters:
21-
- routing # Routing Connector
14+
traces: # Traces pipeline
15+
receivers:
16+
- otlp # OTLP receiver
17+
processors: [] # Processors for traces
18+
exporters:
19+
- routing
2220
```
2321
24-
**Add both the `standard` and `security` traces pipelines**:
22+
**Add both the `route1` and `route2` traces pipelines**:
2523

26-
1. **Configure the Security pipeline**: This pipeline will handle all spans that match the routing rule for `security`.
24+
1. **Configure Route1 pipeline**: This pipeline will handle all spans that match the routing rule for `route1`.
2725
This uses `routing` as its receiver. Place it below the existing `traces:` pipeline:
2826

2927
```yaml
30-
traces/security: # New Security Traces/Spans Pipeline
28+
traces/route1: # Default pipeline for unmatched spans
3129
receivers:
3230
- routing # Receive data from the routing connector
3331
processors:
@@ -36,7 +34,7 @@ This uses `routing` as its receiver. Place it below the existing `traces:` pipel
3634
- batch
3735
exporters:
3836
- debug # Debug Exporter
39-
- file/traces/security # File Exporter for spans matching rule
37+
- file/traces/route1 # File Exporter for unmatched spans
4038
```
4139

4240
2. **Add the Standard pipeline**: This pipeline processes all spans that do not match the routing rule.
@@ -57,6 +55,7 @@ This pipeline is also using `routing` as its receiver. Add this below the `trace
5755

5856
{{% /notice %}}
5957

58+
<!--
6059
Validate the agent configuration using **[otelbin.io](https://www.otelbin.io/)**. For reference, the `traces:` section of your pipelines will look similar to this:
6160

6261
```mermaid
@@ -84,27 +83,28 @@ graph LR
8483
subgraph " "
8584
direction LR
8685
subgraph subID1[**Traces**]
87-
REC1 --> ROUTE1
86+
REC1 -- > ROUTE1
8887
end
8988
subgraph subID2[**Traces/standard**]
90-
ROUTE1 --> ROUTE2
91-
ROUTE2 --> PRO1
92-
PRO1 --> PRO3
93-
PRO3 --> PRO5
94-
PRO5 --> EXP1
95-
PRO5 --> EXP2
89+
ROUTE1 -- > ROUTE2
90+
ROUTE2 -- > PRO1
91+
PRO1 -- > PRO3
92+
PRO3 -- > PRO5
93+
PRO5 -- > EXP1
94+
PRO5 -- > EXP2
9695
end
9796
subgraph subID3[**Traces/security**]
98-
ROUTE1 --> ROUTE3
99-
ROUTE3 --> PRO2
100-
PRO2 --> PRO4
101-
PRO4 --> PRO6
102-
PRO6 --> EXP3
103-
PRO6 --> EXP4
97+
ROUTE1 -- > ROUTE3
98+
ROUTE3 -- > PRO2
99+
PRO2 -- > PRO4
100+
PRO4 -- > PRO6
101+
PRO6 -- > EXP3
102+
PRO6 -- > EXP4
104103
end
105104
end
106105
classDef receiver,exporter fill:#8b5cf6,stroke:#333,stroke-width:1px,color:#fff;
107106
classDef processor fill:#6366f1,stroke:#333,stroke-width:1px,color:#fff;
108107
classDef con-receive,con-export fill:#45c175,stroke:#333,stroke-width:1px,color:#fff;
109108
classDef sub-traces stroke:#fbbf24,stroke-width:1px, color:#fbbf24,stroke-dasharray: 3 3;
110109
```
110+
-->

content/en/conf/1-advanced-collector/6-routing-data/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For example, you might want to send *production* data to one exporter while dire
1212
{{% notice title="Exercise" style="green" icon="running" %}}
1313

1414
> [!IMPORTANT]
15-
> **Change _ALL_ terminal windows to the `[WORKSHOP]/6-routing-data` directory and run the `clear` command.**
15+
> **Change _ALL_ terminal windows to the `6-routing-data` directory and run the `clear` command.**
1616
1717
Copy `*.yaml` from the `5-transform-data` directory into `6-routing-data`. Your updated directory structure will now look like this:
1818

0 commit comments

Comments
 (0)