-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[processor/transform] unable to parse OTTL statement #27012
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
The metric context does have have attributes because metrics don't have attributes. Try the datapoint context. |
@TylerHelmuth thanks for that tip. I've got it working for several attributes that are now showing up with proper labels in Prometheus/Grafana. Here's an excerpt of my working config (for other's potential ref): processors:
transform:
trace_statements:
- context: span
statements:
- set(resource.attributes["cluster"], "dev")
metric_statements:
- context: datapoint
statements:
- set(attributes["k8s_namespace"], resource.attributes["k8s.namespace.name"])
- set(attributes["k8s_container"], resource.attributes["k8s.container.name"])
- set(attributes["k8s_deployment"], resource.attributes["k8s.deployment.name"])
- set(attributes["k8s_pod"], resource.attributes["k8s.pod.name"])
- set(attributes["telemetry_sdk_language"], resource.attributes["telemetry.sdk.language"])
- set(attributes["cluster"], "dev") Seems like the documentation should be updated here and here I will see if I can make a quick PR for that. |
**Description:** - Fixing documentation for incorrect transform context. - Correcting `resource.attributes["k8s_namespace_name"` to be correct `.` separated name. - Removing `resource.attributes["k8s.cluster.name"]` as it's not an available attribute. **Link to tracking Issue:** #27012 (comment) **Testing:** Works in my own otel-collector. **Documentation:** All documentation updates here.
) **Description:** - Fixing documentation for incorrect transform context. - Correcting `resource.attributes["k8s_namespace_name"` to be correct `.` separated name. - Removing `resource.attributes["k8s.cluster.name"]` as it's not an available attribute. **Link to tracking Issue:** open-telemetry#27012 (comment) **Testing:** Works in my own otel-collector. **Documentation:** All documentation updates here.
Component(s)
processor/transform
Description
I'm trying to follow the example from here to add metric labels for Prometheus. It suggests using the transform processor like so in order to copy the most common resource attributes into metric labels:
Given that example I've simplified my collector config down to this simplified version:.
Unfortunately, with this configuration, the collector fails to start and complains with the following message:
Collector version
0.85.0
Environment
docker image: otel/opentelemetry-collector-contrib:0.85.0
The text was updated successfully, but these errors were encountered: