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

Minor refactoring for instrumentation libraries #5162

Merged

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Dec 12, 2023

Changes

  • Make methods static

@utpilla utpilla requested a review from a team December 12, 2023 21:59
{
var context = payload as HttpContext;
if (context == null)
{
AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), EventName, HttpServerRequestDurationMetricName);
AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), nameof(OnStopEventWritten), HttpServerRequestDurationMetricName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to log the name of the method instead.


public override void OnEventWritten(string name, object payload)
{
if (name == OnStopEvent)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed the order of the if conditions. For the common case, we don't want to waste cycles doing a string match for the exception event first.

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Merging #5162 (14b276e) into main (7fec53d) will decrease coverage by 0.06%.
The diff coverage is 76.92%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5162      +/-   ##
==========================================
- Coverage   83.54%   83.48%   -0.06%     
==========================================
  Files         297      297              
  Lines       12368    12367       -1     
==========================================
- Hits        10333    10325       -8     
- Misses       2035     2042       +7     
Flag Coverage Δ
unittests 83.48% <76.92%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ementation/HttpHandlerMetricsDiagnosticListener.cs 88.46% <85.71%> (ø)
...AspNetCore/Implementation/HttpInMetricsListener.cs 89.47% <66.66%> (ø)

... and 7 files with indirect coverage changes

@utpilla utpilla merged commit a736574 into open-telemetry:main Dec 13, 2023
40 checks passed
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