|
1 | 1 | `gnmic` supports exporting subscription updates as [OpenTelemetry](https://opentelemetry.io/) metrics using the [OTLP](https://opentelemetry.io/docs/specs/otlp/) protocol. |
2 | 2 |
|
3 | | -This output can be used to push metrics to any OTLP-compatible backend such as [Grafana Alloy](https://grafana.com/docs/alloy/latest/), [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/), [Datadog](https://www.datadoghq.com/), [Dynatrace](https://www.dynatrace.com/), or any system that accepts OTLP metrics over gRPC. |
| 3 | +This output can be used to push metrics to any OTLP-compatible backend such as [Grafana Alloy](https://grafana.com/docs/alloy/latest/), [Grafana Mimir](https://grafana.com/docs/mimir/latest/), [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/), [Datadog](https://www.datadoghq.com/), [Dynatrace](https://www.dynatrace.com/), or any system that accepts OTLP metrics over gRPC. |
4 | 4 |
|
5 | 5 | ## Configuration |
6 | 6 |
|
@@ -72,6 +72,11 @@ outputs: |
72 | 72 | # map of string:string, additional static attributes to add to the OTLP Resource. |
73 | 73 | resource-attributes: |
74 | 74 | # key: value |
| 75 | + # map of string:string, HTTP headers (or gRPC metadata) to include with every export request. |
| 76 | + # Use this to set tenant/org identifiers required by multi-tenant backends such as |
| 77 | + # Grafana Mimir, Loki, or Tempo. |
| 78 | + headers: |
| 79 | + # X-Scope-OrgID: my-tenant |
75 | 80 | # integer, defaults to 1. |
76 | 81 | # number of workers processing events. |
77 | 82 | num-workers: 1 |
@@ -152,6 +157,29 @@ resource-attributes: |
152 | 157 |
|
153 | 158 | Events are grouped by their `source` tag (the target device address). Each unique source becomes a separate OTLP `ResourceMetrics` entry with its own set of resource attributes. |
154 | 159 |
|
| 160 | +## Custom Headers |
| 161 | + |
| 162 | +The `headers` field attaches key/value pairs to every export request — as gRPC metadata when using the `grpc` protocol, or as HTTP headers when using `http`. |
| 163 | + |
| 164 | +This is required by multi-tenant Grafana backends (Mimir, Loki, Tempo) which use the `X-Scope-OrgID` header to route data to the correct tenant: |
| 165 | + |
| 166 | +```yaml |
| 167 | +outputs: |
| 168 | + mimir-output: |
| 169 | + type: otlp |
| 170 | + endpoint: mimir.example.com:4317 |
| 171 | + headers: |
| 172 | + X-Scope-OrgID: my-tenant-id |
| 173 | +``` |
| 174 | + |
| 175 | +Multiple headers can be set simultaneously: |
| 176 | + |
| 177 | +```yaml |
| 178 | +headers: |
| 179 | + X-Scope-OrgID: my-tenant-id |
| 180 | + X-Custom-Header: some-value |
| 181 | +``` |
| 182 | + |
155 | 183 | ## OTLP Output Metrics |
156 | 184 |
|
157 | 185 | When `enable-metrics` is set to `true`, the OTLP output exposes the following Prometheus metrics: |
|
0 commit comments