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

PropertyFetcher API Improvements #1238

Merged

Conversation

CodeBlanch
Copy link
Member

@CodeBlanch CodeBlanch commented Sep 6, 2020

Continuing the discussion started on #1232.

Changes

Attempting to make the PropertyFetcher API slightly nicer, and a bit better on perf.

Old API:

public class PropertyFetcher

New API:

public class PropertyFetcher<T>

Usage:

        private readonly PropertyFetcher<HttpContext> stopContextFetcher = new PropertyFetcher<HttpContext>("HttpContext");
        private readonly PropertyFetcher<object> beforeActionActionDescriptorFetcher = new PropertyFetcher<object>("actionDescriptor");

Details

  • When you know the type, you can provide it. That's the "HttpContext" case above. Saves a cast. In the case of value types, saves a box/unbox. A little nicer to code against.
  • When you don't know the type, use object. That's the "actionDescriptor" case above. Maintains the existing behavior.

TODOs

  • Update all the spots PropertyFetcher is used
  • CHANGELOG.md updated for non-trivial changes
  • Changes in public API reviewed

@codecov
Copy link

codecov bot commented Sep 8, 2020

Codecov Report

Merging #1238 into master will increase coverage by 0.05%.
The diff coverage is 92.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1238      +/-   ##
==========================================
+ Coverage   79.05%   79.10%   +0.05%     
==========================================
  Files         215      215              
  Lines        6169     6170       +1     
==========================================
+ Hits         4877     4881       +4     
+ Misses       1292     1289       -3     
Impacted Files Coverage Δ
...tp/Implementation/HttpHandlerDiagnosticListener.cs 87.67% <80.00%> (-0.17%) ⬇️
...c/OpenTelemetry/Instrumentation/PropertyFetcher.cs 95.65% <90.00%> (+8.69%) ⬆️
...umentation.AspNet/Implementation/HttpInListener.cs 94.25% <100.00%> (ø)
...tation.AspNetCore/Implementation/HttpInListener.cs 90.72% <100.00%> (+0.19%) ⬆️
...ent/Implementation/GrpcClientDiagnosticListener.cs 90.32% <100.00%> (ø)
...ient/Implementation/SqlClientDiagnosticListener.cs 78.46% <100.00%> (ø)
...us/Implementation/PrometheusExporterEventSource.cs 72.72% <0.00%> (+9.09%) ⬆️

@CodeBlanch CodeBlanch marked this pull request as ready for review September 9, 2020 02:38
@CodeBlanch CodeBlanch requested a review from a team September 9, 2020 02:38
Copy link
Member

@reyang reyang 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 768eaa3 into open-telemetry:master Sep 12, 2020
@CodeBlanch CodeBlanch deleted the propertyfetcher-improvements branch September 12, 2020 03:54
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.

4 participants