-
Notifications
You must be signed in to change notification settings - Fork 764
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 otlp log extension methods for LoggerProviderBuilder #5103
Add otlp log extension methods for LoggerProviderBuilder #5103
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5103 +/- ##
==========================================
- Coverage 83.48% 83.19% -0.30%
==========================================
Files 297 297
Lines 12395 12530 +135
==========================================
+ Hits 10348 10424 +76
- Misses 2047 2106 +59
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ng/opentelemetry-dotnet into yunl/OtlpLoggingExtension
This reverts commit 6cf59f0.
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs
Outdated
Show resolved
Hide resolved
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs
Outdated
Show resolved
Hide resolved
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs
Outdated
Show resolved
Hide resolved
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Api.ProviderBuilderExtensions/AssemblyInfo.cs
Outdated
Show resolved
Hide resolved
@utpilla @vishweshbankwar I'm not going to approve this because I did some of the work and I don't want to self-approve but just FYI I think it is in a good state for final review/merge. |
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs
Show resolved
Hide resolved
src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs
Outdated
Show resolved
Hide resolved
|
||
var config = sp.GetRequiredService<IConfiguration>(); | ||
var config = sp!.GetRequiredService<IConfiguration>(); | ||
|
||
var sdkLimitOptions = new SdkLimitOptions(config); |
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.
The newly added AddOtlpLogExporter
methods are registering OptionsFactory for SdkLimitOptions
and ExperimentalOptions
.
Shouldn't we be using IOptionsFactory<TOptions>.Create
method to create these options?
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.
The SdkLimitOptions
and ExperimentalOptions
will be registered into the IOptionsFactory<T>
which takes IConfiguration as one of the parameters:
https://github.com/open-telemetry/opentelemetry-dotnet/blob/e3759a1e0ea6e23b80cad33a206795fda8e240ff/src/Shared/Options/ConfigurationExtensions.cs#L137C1-L145C12
So the options can be retrieved when constructing new option instances with IConfiguration
.
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.
My question is instead of using the regular ctor for SdkLimitOptions
and ExperimentalOptions
, shouldn't we be using either: IOptionsFactory<TOptions>.Create
or IOptionsMonitor<TOptions>.Get
to get these options. Shouldn't we be utilizing the OptionsFactory
that we are now registering in this PR for these two options?
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.
It isn't as important to use Options API with SdkLimitOptions
and ExperimentalOptions
because they are internal
but I went ahead and refactored it so it is nice and consistent now.
Towards #4433
Based on #4596
Changes
https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/diagnostics/experimental-apis/OTEL1000.md.
under experimental flag for dependency Injection.
LoggerProvider
needs access toILoggerFactory
(for example an exporter trying to useIHttpClientFactory
to construct anHttpClient
instance)Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes