-
Notifications
You must be signed in to change notification settings - Fork 933
Changes of disabled config MUST be eventually visible #4645
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
|
The |
|
cc @jackshirazi of the two most common logging frameworks in Java (log4j and logback), I believe one of them ensures immediate visibility and one of them doesn't:
|
I checked the history and this was indeed introduced here by @jack-berg: Then I removed some part here: In the meantime PRs like these have been merged: Therefore, I think that the non-normative remarks are no longer valid. |
|
We write the spec for two types of readers: end users of the API and language maintainers. I don't understand why we want to remove non-normative but useful bits of implementation advice for language maintainers. A language maintainer shouldn't need to go through issue / PR history (or open a new issue requesting clarification) to get practical advice for implementation. |
I question it is an useful, practical, and even good advise. I do not think we should have advices that are very subjective.
I had to do it because the advice does not seem reasonable. |
|
Then add a clarification that the purpose of this is to ensure that the implementation of enabled doesnt get in the way of performance 🤷 |
@jack-berg, PTAL 96bc8e2 |
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.
Pull Request Overview
This PR removes a non-normative remark about immediate visibility of disabled changes and replaces it with guidance on efficient implementation. The change addresses implementation-detail ambiguity that conflicts with the normative MUST semantics of the Enabled API.
- Removes statement that SDKs don't need to make
disabledchanges immediately visible - Adds guidance for efficient access and synchronization of the
disabledflag - Applies consistent changes across trace, metrics, and logs SDK specifications
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| specification/trace/sdk.md | Updates disabled flag documentation with efficient implementation guidance |
| specification/metrics/sdk.md | Replaces visibility statement with performance-focused synchronization guidance |
| specification/logs/sdk.md | Aligns disabled flag documentation with other SDK specifications |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
3e7bdd3 to
1e04e1b
Compare
Co-authored-by: Liudmila Molkova <[email protected]>
|
We are waiting on a Java (or any other) language that has the actual eventual behavior described here (golang implements an always-visible behavior already, etc) |
|
@open-telemetry/java-maintainers , PTAL |
|
Has any language SDK implemented any bits of dynamic configuration besides Java? I see a lot of approvals on this but as @trask's benchmarks show checking a volatile variable (i.e. the fastest way to ensure eventual consistency in java) on every log creation / span creation / metric measurement recording is noteworthy from a perf standpoint. The perf impact is especially noteworthy for metric recording, which is expected to be allocation free and extremely fast. I would be surprised if other languages implemented this particular bit of dynamic config and didn't end up with similar perf questions. One option I suggested was to provide some sort of SDK initialization time config option where a user can indicate that they may be updating the config dynamically. If they don't indicate updates may occur, then we adjust the implementation to avoid the perf hit and prevent updates. If they do indicate updates may occur, then the implementation adjusts to guarantee changes are seen. |
Is 80ns and allocation free slow? What part is it in an end to end to scenario are we talking about? You can have 12,500,000 80ns-long operations during a second. If this is considered slow then I would question the whole idea of the dynamic configuration feature. Otherwise, what is the point of having a feature that provides guarantees that it "eventually" works? Maybe you want to provide one SDK implementation which handles dynamic config and second which does not?
I find this is implementation-specific. The solution depends on concurrency and memory model of given runtime/language. |
|
See this old blog post where I did a pretty deep investigation into perf of different java metric systems and found record time of otel java anywhere from 20ns-110ns. https://opentelemetry.io/blog/2024/java-metric-systems-compared/#results Micrometer and Prometheus are similar so I def do not want to add 80ns per record for a niche use case. |
jack-berg
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.
Approve because I think this is the right sentiment. But in practice in otel java, I think we'll need to make dynamic config something users opt in to the possibility of at initialization time. That way, we can save the vast majority of users who won't use dynamic config the performance hit. I don't think this needs to be part of the spec, but if other languages implement dynamic config and come across similar challenges, perhaps we can update the spec later.
just wanted to clarify that the benchmark is performing 100 volatile reads in this time this was the only way I could get a difference to show up between volatile and non-volatile reads as @laurit notes in open-telemetry/opentelemetry-java#7700 (comment), this difference between volatile and non-volatile reads is probably due to a compiler optimization:
|
|
.8ns is much better |
That's what the Internet says about volatile as well. Apparently x86 reads already have memory semantics that are the same-(ish?) as volatile and all volatile does is prevent compiler optimizations. That doesn't mean that volatile reads won't be more costly on other architectures, but we can cross that bridge when needed. I'm happy to pay an extra .8ns per operation for the simplicity of using volatile. |
@carlosalberto , I think this PR can be merged. |
### Traces - Restore `TraceIdRatioBased` and give it a deprecation timeline. Update recommended warnings based on feedback in issue [#4601](#4601). ([#4627](#4627)) - Changes of `TracerConfig.disabled` MUST be eventually visible. ([#4645](#4645)) - Remove text related to the former expermental probability sampling specification. ([#4673](#4673)) ### Metrics - Changes of `MeterConfig.disabled` MUST be eventually visible. ([#4645](#4645)) ### Logs - Add minimum_severity and trace_based logger configuration parameters. ([#4612](#4612)) - Changes of `LoggerConfig.disabled` MUST be eventually visible. ([#4645](#4645)) --------- Co-authored-by: Armin Ruech <[email protected]>
Fixes #4643
What
Clarify that changes of disabled config MUST be eventually visible.
Why
Currently, the implementation that would not never synchronize modification and access to
disabledconfig are compliant with the specification. This is not correct as then the user may never see the changes when the configuration changes.Per #4645 (comment)
Languages remain free to document and implement their own refresh/caching behaviors as long as they are eventually consistent.