-
Notifications
You must be signed in to change notification settings - Fork 911
Stabilize the MetricProducer
#3599
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
Comments
+1. I think we can move it to feature-freeze now at minimum, but I would like to see it moved to stable soon as well. |
x-ref #3601 as a subtask |
The MetricProducer interface came up recently when we were discussing the logs bridge API. They're conceptually similar in that both provide an API to bridge telemetry from other frameworks into OpenTelemetry. Yet the logs bridge is an API, while the metric producer is part of the SDK. Originally, there was no log API and the current API components were in a log SDK. This would have been consistent with the current state of MetricProducer, but was rejected in part to avoid the bridge code which is a form of instrumentation itself, from having to take a dependency on SDK components. Having instrumentation depend on the SDK breaks the paradigm of using the API to write instrumentation and using the SDK to configure what happens with the telemetry produced. So I have a couple lingering doubts about MetricProducer before we bump it up the maturity ladder:
|
That is the only use i'm aware of. I've considered writing a bridge from a Prometheus collector to OTel for Go, but haven't gotten around to it yet. When invoked via Produce(), it would collect metrics from existing Prometheus instrumentation, and convert metric data from the Prometheus datamodel to the OTel datamodel. That is essentially what the OpenCensus bridge does in Go as well. I'm ok with that bridge depending on the SDK.
I'm not sure that would actually work, at least for OpenCensus. We don't necessarily have upfront knowledge of what instruments exist. We just have access to all of the aggregated metric data at once. Either way, I think we would end up with a single If the goal of having an API is to allow a No-Op implementation by default, that doesn't make much sense to me to have an API for aggregated data. You lose the benefits of a No-Op if your instrumentation still has to do the work of aggregating metric data to supply to the OTel Bridge API.
I'm happy with the producer name. At the time it was decided, it was the most popular. We can reconsider it if others feel strongly. |
I've prototyped a prometheus bridge in Go, which is implemented using the MetricProducer interface: open-telemetry/opentelemetry-go#4351. It worked quite nicely, since the Produce function basically acts like an incoming prometheus scrape http call. It gathers metrics from Prometheus' internal state, converts them to a batch of OTel metric points, and returns them. |
One of the main points of the API comes from the overview section. The API is for instrumentation, and "Any portion of an OpenTelemetry client which is imported into third-party libraries and application code is considered part of the API". In contrast, the SDK is meant for configuration by application owners. If we expect third-party libraries to be MetricProducers, it should be part of the API package. Its important to be consistent so that we don't establish blurry precedents for future features. However, there have only been a few use cases for MetricProducer: opencensus shim and we also identified a prometheus client bridge in the 7/25 spec call. What we adjust our thinking and restrict third-party library MetricProducers? We could keep MetricProducer as an SDK only component, and say that there are a limited number of built-in MetricProducers for well known use cases like Prometheus and OpenCensus shim. This would allow us to remain consistent with only API components being used in third-party libraries, but would limit MetricProducers to be written by opentelemetry sdk authors. I would personally be fine with limiting MetricProducers to be built-in to the SDK because the java metrics API has been published for some time and we've only encountered just two use cases. Most of the time, the API suffices for bridging other metric systems. |
This is something that would be configured by application owners though–it's not an API bridge but a data/SDK bridge. It's also an "escape hatch" if the OpenTelemetry API/SDK does not support your use case.
I think I'm missing something here, could you not make the same argument for an exporter, metric reader, sampler, span processor, etc.? |
Alternate approach to a produce: #3625 |
@open-telemetry/technical-committee : The OpenCensus project is archiving their libraries in 4 days. Without having a stable way to handle bridging OpenCensus metric we are going to put people into a tough situation. Can we prioritize getting this resolved? cc @tedsuo |
I see what you're saying.. we allow and recommend third party implementations of extension components like exporters, samplers, processors.. Is a metric producer any different? It's really a question of the distinction between the API and SDK. I mentioned before that the overview page says the following about the API:
And it says the following about the SDK:
So the question is essentially: is a metric producer instrumentation, and thus should depend only on the API? Or is it a plugin, and thus it should implement an SDK plugin interface? Arguments in favor of metric producer being instrumentation:
Arguments in favor of metric producer being a SDK plugin interface:
There are probably other arguments I'm not considering. I currently don't see an obvious conclusion. I would appreciate if others could chime in with their perspectives to maximize the chance of getting this right. |
Notes from the Spec SIG:
|
From SIG meeting:
|
Resolve open-telemetry#3599 Add a comment on when the SDK needs to be prioritized over the MetricProducer.
The opentelemetry-go project is looking to stabilize their SDK implementation. The SDK currently includes an implementation of the
MetricProducer
. This part of the specification, however, is itself not stable. It is marked as experimental.Given this section of the specification has working implementation in multiple languages (Go, Java, JS, C++, Rust) and has existed for 8 months, can we start the stabilization process?
cc @dashpole
The text was updated successfully, but these errors were encountered: