Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Stats: flush data to exporters #152

Open
knyar opened this issue Jul 26, 2018 · 2 comments
Open

Stats: flush data to exporters #152

knyar opened this issue Jul 26, 2018 · 2 comments
Labels

Comments

@knyar
Copy link

knyar commented Jul 26, 2018

The spec does not describe whether the stats library maintains an internal buffer before passing stats to exporters, but in practice Go and C++ libraries seem to do that (and other languages like Python, Ruby, PHP and Node don't have stats implemented yet at all).

As the result, for push-based exporters (like Stackdriver) there might be two layers of buffering: one in the stats library, the other in the exporter. Such exporters should probably allow explicit flushing of their buffers, but it will be valuable to provide users a way to flush the buffer of the stats library as well.

This can be done to avoid data loss when a given view is unregistered or the process shuts down. It will also probably make testing easier; currently tests need to sleep (1, 2).

Go users seem to work around this by decreasing reporting period (census-instrumentation/opencensus-go#773). C++ library does not allow changing the reporting period, which is hard-coded to be 10.

In census-instrumentation/opencensus-go#846 (where this discussion started) I initially proposed an explicit ReportUsage() function. An alternative (that is probably more user-friendly and does not expose as much implementation) is to require the stats libraries to provide functions to unregister/remove views and flush pending data to exporters when that happens.

@bogdandrutu
Copy link
Contributor

I think this is related to the discussion about record semantics #159. Also I asked for a flush/shutdown function.

@semistrict
Copy link
Contributor

Updated that PR with a description of Flush.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants