Skip to content
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

[di] Expose a detached LoggerProviderBuilder extension on IServiceCollection which may modify services #4531

Merged

Conversation

CodeBlanch
Copy link
Member

Relates to #4517

Changes

  • Adds an overload to the IServiceCollection.ConfigureOpenTelemetryLoggerProvider extension which doesn't require IServiceProvider and allows for IServiceCollection modification.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated

@CodeBlanch CodeBlanch requested a review from a team May 31, 2023 20:25
/// </summary>
internal sealed class LoggerProviderServiceCollectionBuilder : LoggerProviderBuilder, ILoggerProviderBuilder
internal sealed class LoggerProviderBuilderBase : LoggerProviderBuilder, ILoggerProviderBuilder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@utpilla

Originally when this was added you commented that you would prefer it was named LoggerProviderBuilderBase so it matched tracing & metrics. Just FYI it ended up being exactly that 😄

Comment on lines +5 to +10
* Added an `IServiceCollection.ConfigureOpenTelemetryMeterProvider` overload
which may be used to configure `MeterProviderBuilder`s while the
`IServiceCollection` is modifiable (before the `IServiceProvider` has been
created).
([#4517](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4517))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge issue from #4517

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #4531 (331cfd0) into main (2f77b31) will increase coverage by 0.07%.
The diff coverage is 97.72%.

❗ Current head 331cfd0 differs from pull request most recent head 105628d. Consider uploading reports for the commit 105628d to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4531      +/-   ##
==========================================
+ Coverage   85.31%   85.38%   +0.07%     
==========================================
  Files         319      320       +1     
  Lines       12634    12647      +13     
==========================================
+ Hits        10779    10799      +20     
+ Misses       1855     1848       -7     
Impacted Files Coverage Δ
...ons/Logs/LoggerProviderServiceCollectionBuilder.cs 95.83% <95.83%> (ø)
...encyInjectionLoggingServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
...lemetry.Extensions.Hosting/OpenTelemetryBuilder.cs 90.00% <100.00%> (ø)
...elemetry/Logs/Builder/LoggerProviderBuilderBase.cs 96.96% <100.00%> (ø)
...ry/Logs/Builder/LoggerProviderBuilderExtensions.cs 97.91% <100.00%> (ø)
...try/Logs/ILogger/OpenTelemetryLoggingExtensions.cs 100.00% <100.00%> (ø)
src/OpenTelemetry/Sdk.cs 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@alanwest alanwest merged commit 0ddbdb4 into open-telemetry:main Jun 1, 2023
@CodeBlanch CodeBlanch deleted the di-configurelogging-withservices branch June 1, 2023 17:02
mfogliatto pushed a commit to mfogliatto/opentelemetry-dotnet that referenced this pull request Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants