-
Notifications
You must be signed in to change notification settings - Fork 327
Mechanism to explicitly flush stats to exporters #773
Comments
Prometheus natively doesn't really support this using the pull model. What seems like it would work would be to provide OpenCensus support for the Prometheus Push Gateway: https://github.com/prometheus/pushgateway. Mind if we repurpose this as a feature request on the Prometheus exporter? |
You can currently push using the prometheus api (combined with opencensus). But if we get "native" push support in opencensus even better. What I am doing currently:
|
Curious how you are pushing using the prometheus API. As I understand it, you register the exporter as an http.Handler and Prometheus scrapes it periodically. There isn't really a way to "force" Prometheus to scrape your app in a timely fashion. Sure, you can use SetReportingPeriod but all this does is change how often the page that Prometheus scrapes is updated. It doesn't guarantee that Prometheus will actually get the updated data. |
No, I do not register the endpoint, opencensus Prometheus exporter is just an interface between opencensus views and native prometheus registry. I am using the So I pass in explicit registry in And then use the |
Ah I see. I didn't realize that was possible. I will keep this open to add an example and document that usage. I will also retitle to be closer to your original issue, namely that we need a way to flush exporters at process termination. |
- Report data for a given view when that view is unregistered; - Add an explicit command to report all accumulated data. This probably fixes census-instrumentation#773.
This might help with census-instrumentation#773.
Duplicated of #862. |
Currently I see no way to push collected metrics to prometheus before program exit (especially in short batch programs), since views are reported periodically based on a timer.
What I have currently done is set
view.SetReportingPeriod
to something low and wait some duration and then perform the push.The text was updated successfully, but these errors were encountered: