-
Notifications
You must be signed in to change notification settings - Fork 889
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
Clarification on SimpleProcessor concurrency #4134
Comments
Kudos to @cijothomas for noticing the issue. |
Two sentences from the spec which states that only one export() will be called at a time.
If exporters are authored with this assumption, then pairing them with SimpleProcessor may yield unexpected results. For example, if a stdout/console exporter assumes it'll only be called from one thread at a time, it does not have to lock the stdout while writing, like shown below.
If SimpleProcessor calls such an exporter from different threads, then the output can get mixed up. (Trask confirmed that Java's stdout exporter makes a single call to write to console, so the output is not mixed up. But .NET consoleexporter makes multiple calls without syncronization, so unless the paired processor ensures synchronous calling, output gets mixed up!) I think we should update the wording on Exporter spec, to allow concurrent Export() methods, and also modify the SimpleExportProcessor section to make it clear that they should export concurrently or synchronously, depending on the Exporter's advertised expectation. If exporter has no trouble being called concurrently, then SimpleProcessor can leverage that. Otherwise, SimpleProcessor must ensure only calls to export() are done one after another. |
I self-assigned this. Will send a PR to clarify the wording here next week. |
We've tried to clear this up before. I think it is my wording in there around what is to be done to support concurrency that may be confusing :) The "never be called concurrently" applies to the So So yes, exporting can happen concurrently, but no we can not allow |
Why? Exporters like the ones to etw, user_events can not only be called concurrently, but they must be called that way to ensure highest perf with no contention. |
TC Triage: There are general issues with concurrency assumptions that are not panning out in practice as intended. This is one of a set of issues where we need to improve our concurrency portions of the specification. @jmacd is willing to sponsor this issue. |
Same as open-telemetry#4173 for metrics SDK. Towards open-telemetry#4134
Same as open-telemetry#4173 for trace SDK. Fixes open-telemetry#4134
The current specification states that "Export will never be called concurrently for the same exporter instance," but some exporters (e.g., ETW, user_events, LTTng) can handle concurrent exports. This leads to potential inefficiencies.
There is also discrepancy regarding the concurrency behavior of the SimpleProcessor across different OpenTelemetry language implementations (not all languages synchronize the calls to the exporter).
Proposed Solution:
Allow Exporter Concurrency: Update the specification to allow exporters to be used concurrently.
References:
The text was updated successfully, but these errors were encountered: