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

AspNetCore instrumentation options to be configurable from DI #1997

Merged

Conversation

cijothomas
Copy link
Member

@cijothomas cijothomas commented Apr 20, 2021

Ability to bind AspNetCoreOptions from DI - similar to https://github.com/open-telemetry/opentelemetry-dotnet/pull/1942/files
Building on this: #1889

Usage example:

// For options which can be bound from IConfiguration.
services.Configure<AspNetCoreInstrumentationOptions>(this.Configuration.GetSection("AspNetCoreInstrumentation"));

// For options which can be configured from code only.
services.Configure<AspNetCoreInstrumentationOptions>(options =>
{
    options.Filter = (req) =>
    {
        return req.Request.Host != null;
    };
});

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@cijothomas
Copy link
Member Author

WIP : This can be simplified.

@codecov
Copy link

codecov bot commented Apr 20, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@13866c0). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1997   +/-   ##
=======================================
  Coverage        ?   83.91%           
=======================================
  Files           ?      192           
  Lines           ?     6184           
  Branches        ?        0           
=======================================
  Hits            ?     5189           
  Misses          ?      995           
  Partials        ?        0           
Impacted Files Coverage Δ
...penTelemetry/Internal/ServiceProviderExtensions.cs 66.66% <ø> (ø)
...tion.AspNetCore/TracerProviderBuilderExtensions.cs 100.00% <100.00%> (ø)

@cijothomas cijothomas marked this pull request as ready for review April 20, 2021 01:30
@cijothomas cijothomas requested a review from a team April 20, 2021 01:30
Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

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

LGTM

@cijothomas cijothomas merged commit f65b650 into open-telemetry:main Apr 20, 2021
@cijothomas cijothomas deleted the cijothomas/aspnetcore_config_via_di branch April 20, 2021 05:31
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.

2 participants