-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add ability to flush metrics on demand from push controller #1349
Comments
Seems reasonable to me. @jmacd thoughts? |
I can make a PR if you give me a green light |
Sounds good. |
@jmacd for monitoring of serverless functions do you think it's a good pattern to start and stop controller on every function invocation? |
That's probably not a good pattern. My understanding is that the ideal for serverless is to use an agent that can flush in the background. If you don't have an agent though, Start() and Stop() are correct. I'm probably not the best person to ask serverless questions. :-) |
I have instrumented lambdas with otlp exporter using delta aggregations. It works decently, metrics are flushed in the background while functions are running. There are two caveats though: if lambdas are not called often enough aggregated measurements that were not exported before function is suspended are not exported till next invocation and obviously when lambda instance terminates measurements done before termination are lost. Being able to force export at the end on function invocations would resolve both. I don't see how adding lambda extension similar to that one will help, function will still need to export measurements during invocation. Start-Stop on every invocation doesn't looks like a good pattern to me even though it should work. |
Calling We could add an explicit flush method, but I still think open-telemetry/opentelemetry-specification#1297 talks about the algorithm a collector will use to correctly combine metric streams in an agent. I'd like to get this implemented in the collector, I think it'll be a win for use from the lambda extension. |
I don't have strong opinions here, stop-start to flush metrics should work. Would be great to hear from someone who has a similar use-case. |
I am running in to this issue. @nabam What is the proposed solution exactly? After reading over the ADOT docs and implementing the lambda layer any metrics collected and not flushed before the lambda terminates are lost. I've had to set the interval really low to make sure metrics are flushed to the collector before the lambda stops executing.
|
Right now push controller is only able to flush metrics on timer. It would be useful to have a handle to force flush metrics. Such handle could be invoked before application termination to not lose measurements.
opentelemetry-go/sdk/metric/controller/push/push.go
Line 136 in 2c2f985
The text was updated successfully, but these errors were encountered: