-
Notifications
You must be signed in to change notification settings - Fork 771
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
[sdk] ConcurrencyMode and export processor registration APIs #5758
Closed
CodeBlanch
wants to merge
10
commits into
open-telemetry:main
from
CodeBlanch:export-processor-factory
Closed
[sdk] ConcurrencyMode and export processor registration APIs #5758
CodeBlanch
wants to merge
10
commits into
open-telemetry:main
from
CodeBlanch:export-processor-factory
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
documentation
Documentation related
pkg:OpenTelemetry.Exporter.Console
Issues related to OpenTelemetry.Exporter.Console NuGet package
pkg:OpenTelemetry.Exporter.InMemory
Issues related to OpenTelemetry.Exporter.InMemory NuGet package
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol
Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package
pkg:OpenTelemetry.Exporter.Zipkin
Issues related to OpenTelemetry.Exporter.Zipkin NuGet package
pkg:OpenTelemetry
Issues related to OpenTelemetry NuGet package
labels
Jul 24, 2024
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
github-actions
bot
added
the
Stale
Issues and pull requests which have been flagged for closing due to inactivity
label
Aug 1, 2024
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Documentation related
pkg:OpenTelemetry.Exporter.Console
Issues related to OpenTelemetry.Exporter.Console NuGet package
pkg:OpenTelemetry.Exporter.InMemory
Issues related to OpenTelemetry.Exporter.InMemory NuGet package
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol
Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package
pkg:OpenTelemetry.Exporter.Zipkin
Issues related to OpenTelemetry.Exporter.Zipkin NuGet package
pkg:OpenTelemetry
Issues related to OpenTelemetry NuGet package
Stale
Issues and pull requests which have been flagged for closing due to inactivity
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to #5642
Relates to #5643
Changes
ConcurrencyModes
andConcurrencyModesAttribute
AddBatchExportProcessor
andAddSimpleExportProcessor
extensions onLoggerProviderBuilder
andTracerProviderBuilder
IDeferredLoggerProviderBuilder
onOpenTelemetryLoggerOptions
Details
ConcurrencyModes
We want to allow users (component authors) to be able to opt-out of the
lock
used by SimpleExportProcessor. @reyang introducedConcurrencyModes
on #5643 but the challenge there isSimpleExportProcessor<T>
needs to implement all the logic which makes it a) not very simple and b) more expensive (perf-wise). The goal here was to supportConcurrencyModes
but in a way where we could specialize the implementation(s) without leaking them into public APIs. There could also be moreConcurrencyModes
in the future for exampleGlobal
was originally in the design which uses an OS-level synchronization mechanism and further complicatesSimpleExportProcessor<T>
.AddBatchExportProcessor and AddSimpleExportProcessor extensions
Mistakes have been made in the design of
BatchExportProcessor<T>
. Users (component authors) must correctly pass in settings on the ctor. Those settings should be controllable by users. Some exporters do this manually (OneCollector), some do it usingBatchExportActivityProcessorOptions
(Geneva), and some don't give users any configurability at all (AzureMonitor).Adding
AddBatchExportProcessor
andAddSimpleExportProcessor
extensions allow the SDK to take care of this so it is always done correctly and gives it a spot to inspectConcurrencyMode
to select the correct implementation to use whenSimpleExportProcessor<T>
is requested.Implement IDeferredLoggerProviderBuilder on OpenTelemetryLoggerOptions
In
1.9.0
we exposedLoggerProviderBuilder
which is where the new extensions landed. The problem is we also haveOpenTelemetryLoggerOptions
and a lot of shipped registration extensions targeting it which need to create simple or batch processors. I really didn't want to add new builder methods onOpenTelemetryLoggerOptions
as we ought to obsolete the existing ones. What I did was implementIDeferredLoggerProviderBuilder
onOpenTelemetryLoggerOptions
so that component authors can access theLoggerProviderBuilder
extensions if needed. This is an explicit implementation so it is hidden from users unless they perform a cast. Is this safe to do? Yes.OpenTelemetryLoggerOptions
can perform all the late-bound builder tasks because it has theIServiceProvider
available. It just can't do the early stuff which needsIServiceCollection
. So it may beIDeferredLoggerProviderBuilder
but it can't beILoggerProviderBuilder
.Follow-up work
PeriodicExportingMetricReader
is really subject to the same pitfalls asBatchExportProcessor<T>
but that isn't addressed here. If this goes forward similar work will need to happen for it. Probably an extension onMeterProviderBuilder
along the lines ofAddPeriodicExportingMetricReader
.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes