[Do Not Merge] Metrics Async Pull API #2517
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #2511
This PR is a demo implementation of two theories people may or may not agree with in order to gather feedback.
Pull API should be asynchronous
For push export, on some timer, with a dedicated thread, synchronous export is desired. But for externally initiated pull, writing to some output stream, I think we should have an asynchronous API. In the case of Prometheus middleware, running in ASP.NET Core, this allows for nice thread sharing when that output stream is waiting on some network IO.
We should differentiate between Push & Pull in exporters.
With a single Export entry point in PrometheusExporter I don't know how we could decide if we need to push or pull, assuming we will eventually also support push. We would have to take a dependency on the
PullMetricScope
which is internal to SDK, or perhaps ask users to register multiple exporters with different configurations. Since we haveIPullMetricExporter
, which exporters use to opt-into pull, it seemed simple enough to define a dedicated entry point.