-
Notifications
You must be signed in to change notification settings - Fork 888
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
Metrics SDK: allow metric readers to filter Meters during Collect() #3617
Comments
PS: I am aware of this related issue: which is not a duplicate. #3617 is about adding predicates to filter out I see the two as complementary. The rationale for filtering a For example, an instrumented library could:
A reader may want to export all operating system metrics to one endpoint, Filtering on a meter by meter basis is more efficient in terms of overhead, Expressing the predicate (either by allowing only some meters by name, or by looking at meters metadata) |
So you basically want to add an operation to |
hey @marcalff, do you still want to pursue this issue? |
Yes, this is still relevant, and is still blocking in my application. |
Blocks implementation of: |
Discussed in 7/31/24 TC meeting. We think its a useful thing to pursue and adjusted the status to |
What are you trying to achieve?
For my application, I need to export metrics to an endpoint at different frequencies.
To do so, several
PeriodicMetricReaders
are defined, for example:The meters to export should be different, as the main motivation to have different export frequencies is that:
When each reader collects data, every Meter associated with the global MeterProvider is considered.
This is an issue, because the desired behavior is to:
What did you expect to see?
When a reader invokes
Collect()
on a MeterProvider, I would like to be able to filter out which Meter is considered, instead of exporting every meter defined in the MeterProvider.The filter should be evaluated as a MeterPredicate(), so the SDK can provide its own logic to select (or not) a Meter.
At the very minimum, the predicate should take the meter name as input, so that selecting meters based on a naming convention is possible.
A very desirable feature is to allow the instrumentation interface to add key/value pairs when creating a Meter, so that metadata associated with a meter is available to the filter predicate.
Work around.
Because this is currently not possible based on the existing spec, and the implementation used (opentelemetry-cpp), the work around currently used in the application is to:
so that each reader only sees a subset of meters.
This is highly undesirable, because:
MeterProvider
singletonThis work around is the only solution I could come up with given the current behavior.
Additional context.
Add any other context about the problem here. If you followed an existing documentation, please share the link to it.
The text was updated successfully, but these errors were encountered: