-
Notifications
You must be signed in to change notification settings - Fork 751
Description
Is your feature request related to a problem?
Yes. The problem that I wish to address is to have Metric Reader that does not rely on intervals
like PeriodicExportingMetricReader, but the reader that can export the collected metric controlled by triggering it explicitly, via outside timer or scheduler. Another problem with the PeriodicExportingMetricReader is that we cannot start or stop its execution once the thread starts, and therefore one must either shut the current one down and re-start it.
Describe the solution you'd like
I would like to introduce a new MetricReader called ExportingMetricReader
. Basically, it will have all the identical functionality as the PeriodicExportingMetricReader
, except for the intervals that will periodically export the metric data automatically. Instead, it will have a method called 'export' which when invoked, will trigger the same behavior that the periodic exporter do: collect and export the metric. It is expected that this export function will be invoked by an external entity.
Describe alternatives you've considered
I have considered using the PeriodicExportingMetricReader with the time interval of a very large period (e.g. 100 years), and call force_flush() to collect and export at will. This method may work with existing PeriodicExportingMetricReader. However, it will have an unnecessary thread waiting inside it, and calling force_flush() does feel like a hack.
Additional context
The existing PeriodicExportingMetricReader can inherit this class and add additional logic to trigger the collection and export in tervals.