-
Notifications
You must be signed in to change notification settings - Fork 600
chore: making forceflush_timeout configurable #3087
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
Conversation
Signed-off-by: Nicolas Takashi <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3087 +/- ##
=====================================
Coverage 80.1% 80.2%
=====================================
Files 126 126
Lines 21957 21985 +28
=====================================
+ Hits 17603 17632 +29
+ Misses 4354 4353 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /// Maximum force flush timeout. | ||
| pub(crate) const OTEL_BLRP_FORCEFLUSH_TIMEOUT: &str = "OTEL_BLRP_FORCEFLUSH_TIMEOUT"; | ||
| /// Default maximum force flush timeout. | ||
| pub(crate) const OTEL_BLRP_FORCEFLUSH_TIMEOUT_DEFAULT: Duration = Duration::from_millis(5_000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not use 5s here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @TommyCpp I'm just keeping consistency with other configs like OTEL_BLRP_EXPORT_TIMEOUT_DEFAULT for example: https://github.com/nicolastakashi/opentelemetry-rust/blob/ad86b169accce3b02ea7ea956a79837294ce09ae/opentelemetry-sdk/src/logs/batch_log_processor.rs#L48
cijothomas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTEL_BLRP_FORCEFLUSH_TIMEOUT is not part of the OTel specification. We generally don't want to add env variables not covered by a spec already.
Additional, I don't think this is the right way to support timeout for flush - the flush API itself can take a timeout
flush(); //existing one, uses default 5 sec
flush_with_timeout(timeout);/ new one, uses the passed in timeout.
Thanks for your review. |
yes. Shutdown already has that pattern. (I haven't seen much demand for force_flush with timeout - any particular scenario that you are facing that requires this?) |
I'm facing flush timeout when pushing to certain remote endpoints. |
@nicolastakashi Thanks for clarifying. However, my question was more about "why do you need to call flush at all?..SDK automatically flushes telemetry periodically (configurable)... and if you are about to shutdown the app, then there is shutdown too to manually perform a flush effect.. force_flush() was introduced to spec for some very specific scenarios and I have seen a lot of people mis-using it (eg: calling flush() after every log emission or metric update etc!).. (No objections to adding flush_with_timeout, just want to make sure it's being added for a good reason. It was only recently that we add shutdown_with_timeout...) |
I'm using it for synthetic telemetry testing and I tried to call provider shutdown as well, but it also timeouts since behind the scnes it calls flush |
That is not true. If shutdown is not working as designed, then we can investigate and fix that. Could you open a separate issue with minimal repro steps? |
Sorry, you are right, after review I noticed that and I found the issue why I'm facing timeouts. |
Thanks for your offer to contribute. However, for reasons I mentioned earlier, we don't want to continue this PR as-is. if we want to offer timeout to flush, then it should be done by accepting timeout in the flush() call itself, just like shutdown(). We can accept a PR adding that capability. Would love it if you can help with any other open issues or other fixes/improvements. |
Changes
Making forceflush_timeout configurable through BatchExporterConfigBuilder
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes