How to add arbitrary attributes to the exported metrics #11220
-
Currently, after collecting the otlp data, I have They seem to come with the with I want to add the I can see the attribute in the traces. But more generally, how do we export arbitrary attributes with the metrics?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
you don't
So you wish to add |
Beta Was this translation helpful? Give feedback.
-
Attributes like these are divergent and not recommended to be added to metrics. Moreover, I recall there's a limitation in the SDK that caps the dimensionality combination for a single metric at 3,000. Exceeding this will result in data being discarded, leading to inaccurate metrics. |
Beta Was this translation helpful? Give feedback.
you don't
So you wish to add
url.path
tohttp.client.request.duration
metric. This can be achieved configuring a metric view https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/incubator either programmatically in an agent extension or using a configuration file. Agent limits the set of attributes added to metrics using advice inopentelemetry-java-instrumentation/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpMetricsAdvice.java
Line 26 in 4dae82c