|
1 | 1 | = Telemetry signals in operators |
2 | 2 | :page-aliases: ../telemetry.adoc |
3 | 3 | :env-filter-syntax: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax |
| 4 | +:vector-helm-chart: https://github.com/vectordotdev/helm-charts/tree/develop/charts/vector |
4 | 5 |
|
5 | 6 | [NOTE] |
6 | 7 | ==== |
@@ -93,3 +94,97 @@ telemetry: |
93 | 94 | <1> Boolean: `true`, `false` |
94 | 95 | <2> String: `error`, `warn`, `info`, `debug`, `trace`, `off` (or {env-filter-syntax}[more complex filters,window=_blank]) |
95 | 96 | <3> String: E.g. `https://my-collector:4317` (Note: it must contain the scheme) |
| 97 | + |
| 98 | +== OpenTelemetry with Vector |
| 99 | + |
| 100 | +OpenTelemetry signals can be configured to behave like xref:logging.adoc[product logging]. Using the {vector-helm-chart}[vector helmChart] requires to configure `containerPorts` and `service.ports` as well as `customConfig.sources.otel`: |
| 101 | + |
| 102 | +[source,yaml] |
| 103 | +---- |
| 104 | +containerPorts: |
| 105 | + - {name: vector, containerPort: 6000, protocol: TCP} |
| 106 | + - {name: otel-grpc, containerPort: 4317, protocol: TCP} |
| 107 | + - {name: otel-http, containerPort: 4318, protocol: TCP} |
| 108 | +service: |
| 109 | + ports: |
| 110 | + - {name: vector, port: 6000, targetPort: 6000, protocol: TCP} |
| 111 | + - {name: otel-grpc, port: 4317, targetPort: 4317, protocol: TCP} |
| 112 | + - {name: otel-http, port: 4318, targetPort: 4318, protocol: TCP} |
| 113 | +customConfig: |
| 114 | + sources: |
| 115 | + otel: |
| 116 | + type: opentelemetry |
| 117 | + grpc: |
| 118 | + address: 0.0.0.0:4317 |
| 119 | + http: |
| 120 | + address: 0.0.0.0:4318 |
| 121 | +---- |
| 122 | + |
| 123 | +The `endpoint` in the operator's Helm values must point to the ports defined above. |
| 124 | + |
| 125 | +[source,yaml] |
| 126 | +---- |
| 127 | +telemetry: |
| 128 | + otelLogExporter: |
| 129 | + enabled: true |
| 130 | + endpoint: http://vector-aggregator.<namespace>.svc.cluster.local:4317 |
| 131 | + otelTraceExporter: |
| 132 | + enabled: true |
| 133 | + endpoint: http://vector-aggregator.<namespace>.svc.cluster.local:4317 |
| 134 | +---- |
| 135 | + |
| 136 | +=== Normalizing operator logs to the Stackable log schema |
| 137 | + |
| 138 | +Operators do not run vector sidecars. Using OpenSearch, a VRL transform that maps the OTLP fields onto the |
| 139 | +xref:tutorials:logging-vector-aggregator.adoc#_watch_the_logs[Stackable log schema] is needed to avoid re-indexing: |
| 140 | + |
| 141 | +[source,yaml] |
| 142 | +---- |
| 143 | +customConfig: |
| 144 | + transforms: |
| 145 | + normalize_otel_logs: |
| 146 | + type: remap |
| 147 | + inputs: |
| 148 | + - otel.logs # <1> |
| 149 | + source: | |
| 150 | + service_name = get(.resources, ["service.name"]) ?? null |
| 151 | + .pod = service_name # <2> |
| 152 | + .container = service_name # <2> |
| 153 | + .namespace = get(.resources, ["k8s.namespace.name"]) ?? null |
| 154 | + .logger = string(.scope.name) ?? null # <3> |
| 155 | + .level = string(.severity_text) ?? null |
| 156 | + .built_info = object(.attributes) ?? {} # <4> |
| 157 | + .cluster = null |
| 158 | + .role = null |
| 159 | + .roleGroup = null |
| 160 | + .file = null |
| 161 | + .source_type = "opentelemetry" |
| 162 | + del(.severity_text) |
| 163 | + del(.severity_number) |
| 164 | + del(.resources) |
| 165 | + del(.attributes) |
| 166 | + del(.scope) |
| 167 | + del(.trace_id) |
| 168 | + del(.span_id) |
| 169 | + del(.flags) |
| 170 | + del(.observed_timestamp) |
| 171 | + del(.dropped_attributes_count) |
| 172 | + sinks: |
| 173 | + opensearch: |
| 174 | + inputs: |
| 175 | + - vector |
| 176 | + - normalize_otel_logs # <5> |
| 177 | +---- |
| 178 | + |
| 179 | +<1> The `opentelemetry` source fans out into `otel.logs`, `otel.metrics`, and |
| 180 | + `otel.traces`. Unconsumed sub-streams produce a startup warning. |
| 181 | +<2> Operators emit `service.name` (e.g. `stackable-airflow-operator`) as their |
| 182 | + primary identity. It is mapped to both `.pod` and `.container` but can be |
| 183 | + adapted to individual needs. |
| 184 | +<3> The OTLP `scope.name` contains the Rust module path (e.g. |
| 185 | + `kube_runtime::controller`) and maps to the `.logger` field. |
| 186 | +<4> Log-record attributes (e.g. `built_info.*`) are collected into a single object |
| 187 | + to keep the top-level schema flat. |
| 188 | +<5> Reference transformer output as sinks input. |
| 189 | + |
| 190 | +[NOTE] Namespace information is currently not emitted by the operator |
0 commit comments