A custom OpenTelemetry Collector processor that injects additional metadata into trace spans as they flow through the pipeline.
This processor is built to demonstrate custom trace manipulation within the OpenTelemetry Collector framework.
Use the OpenTelemetry Collector Builder to generate a custom binary with this processor included:
builder --config=otelcol-builder.yaml
This will generate the custom collector binary at: ./otelcol-dist/otelcol-custom
Start the collector using your built binary and a config.yaml
that wires up the custom processor:
./otelcol-dist/otelcol-custom --config=config.yaml
Send test traces to the collector using telemetrygen
:
telemetrygen traces --otlp-insecure --traces 1
This will emit a single trace to the collector via OTLP gRPC on localhost:4317
.
If wired correctly, the custom processor will enrich each span with a static attribute (e.g., hello=world
).
You can verify this by observing logs in the console or from the configured exporter.