8. Routing Data
10 minutesThe 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.
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.
Exercise
- Inside the
[WORKSHOP]
directory, create a new subdirectory named8-routing
. - Next, copy all contents from the
7-transform-data
directory into8-routing
. - After copying, remove any
*.out
and*.log
files. - Change all terminal windows to the
[WORKSHOP]/8-routing
directory.
Your updated directory structure will now look like this:
WORKSHOP
βββ 1-agent
βββ 2-gateway
βββ 3-filelog
βββ 4-resilience
βββ 5-dropping-spans
βββ 6-sensitive-data
βββ 7-transform-data
βββ 8-routing
β ββββcheckpoint-dir
β βββ agent.yaml
β βββ health.json
β βββ gateway.yaml
β βββ log-gen.sh (or .ps1)
βΒ Β βββ trace.json
βββ otelcol
Next, we will configure the routing connector and the respective pipelines.