-
Notifications
You must be signed in to change notification settings - Fork 628
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
Allow providing a "MetricProcessor", similar to a SpanProcessor #4230
Comments
Yes there doesn't seem a very powerful way to configure metrics in the sdk as of today (except for [views](https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/metrics/views but the configuration options are limited). A couple of questions:
|
@lzchen thanks!
|
I'm wondering if you can achieve this desired behavior by using a custom exporter and enrich the metrics data with the attributes you want prior to export. |
@lzchen the problem is that I need the context which contains the attributes to enrich - and in the exporter I no longer have the context of the specific execution where the metric was recorded. |
Is your feature request related to a problem?
I'm maintaining OpenLLMetry and we have an SDK that wraps the instrumentations and enriches them with different properties. For traces, we use the
SpanProcessor
to tap intoon_start
and add attributes to relevant spans. We want to do something similar for metrics (add some attributes), so ideally, we'd love to have a way to do that before a metric is added / aggregated on the OpenTelemetry SDK level.Describe the solution you'd like
I'd imagine something on the level of the
consume_measurement
- potentially allowing to specify a callback / attribute enrichments, or overriding the consumer.Describe alternatives you've considered
I couldn't find any other way to add attributes to a metric after it's recorded.
Additional Context
No response
Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: