Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][headerssetter] Update docs to clarify how to use "from_context" #31283

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions extension/headerssetterextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ The following settings are required:

The `value` and `from_context` properties are mutually exclusive.

In order for `from_context` to work, other components in the pipeline also need to be configured appropriately:
* If a [batch processor][batch-processor] is present in the pipeline, it must be configured to [preserve client metadata][batch-processor-preserve-metadata].
Add the value which `from_context` needs to the `metadata_keys` of the batch processor.
* Receivers must be configured with `include_metadata: true` so that metadata keys are available to the pipeline.

#### Configuration Example

```yaml
Expand All @@ -67,7 +72,10 @@ receivers:
include_metadata: true

processors:
nop:
batch:
# Preserve the tenant-id metadata.
metadata_keys:
- tenant_id

exporters:
loki:
Expand All @@ -84,10 +92,13 @@ service:
pipelines:
traces:
receivers: [ otlp ]
processors: [ nop ]
processors: [ batch ]
exporters: [ loki ]
```

[batch-processor]: https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor/README.md
[batch-processor-preserve-metadata]: https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor/README.md#batching-and-client-metadata

[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
[Mimir]: https://grafana.com/oss/mimir/
Expand Down
Loading