You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the first part of
open-telemetry#37114
- the ability to use an annotation prefix to define a resource attribute
---------
Co-authored-by: Christos Markou <[email protected]>
note: Add option to configure automatic resource attributes - with annotation prefix
6
+
7
+
issues: [37114]
8
+
9
+
subtext: |
10
+
Implements [Specify resource attributes using Kubernetes annotations](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/non-normative/k8s-attributes.md#specify-resource-attributes-using-kubernetes-annotations).
11
+
12
+
If you are using the file log receiver, you can now create the same resource attributes as traces (via OTLP) received
13
+
from an application instrumented with the OpenTelemetry Operator -
14
+
simply by adding the `extract: { otel_annotations: true }` configuration to the `k8sattributesprocessor` processor.
15
+
See the [documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/k8sattributesprocessor/README.md#config-example) for more details.
- `otel_annotations` will translate `resource.opentelemetry.io/foo` to the `foo` resource attribute, etc.
260
+
261
+
```yaml
262
+
extract:
263
+
otel_annotations: true
264
+
```
265
+
254
266
### Config example
255
267
256
268
```yaml
@@ -271,10 +283,11 @@ k8sattributes/2:
271
283
- k8s.node.name
272
284
- k8s.pod.start_time
273
285
labels:
274
-
# This label extraction rule takes the value 'app.kubernetes.io/component' label and maps it to the 'app.label.component' attribute which will be added to the associated resources
275
-
- tag_name: app.label.component
276
-
key: app.kubernetes.io/component
277
-
from: pod
286
+
# This label extraction rule takes the value 'app.kubernetes.io/component' label and maps it to the 'app.label.component' attribute which will be added to the associated resources
287
+
- tag_name: app.label.component
288
+
key: app.kubernetes.io/component
289
+
from: pod
290
+
otel_annotations: true
278
291
pod_association:
279
292
- sources:
280
293
# This rule associates all resources containing the 'k8s.pod.ip' attribute with the matching pods. If this attribute is not present in the resource, this rule will not be able to find the matching pod.
0 commit comments