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

[Instrumentation.EventCounters] Support long event source names better in EventCounters instrumentation #740

Merged
merged 10 commits into from
Nov 11, 2022

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Oct 28, 2022

EventCounters instrumentation does not work for several well-known EventSources.

E.g. Microsoft-AspNetCore-Server-Kestrel or most of the counters in Microsoft.AspNetCore.Http.Connections.
It happens because of instrument length limitations (63 symbols).

End users can't do anything about it except republish all events, so we need to find a reasonable way to allow at least well-known event sources. Kestrel counters, for example, are extremely useful and can't be measured in other ways (DiagSource/ActivitySource instrumentation in hosting).

So, EventCounters.Microsoft-AspNetCore-Server-Kestrel. is already 50 chars and it doesn't even include event name.

This change proposes:

  • use ec. prefix instead of EventCounters. - It seems less important than event source/event names
  • When the instrument name in EventCounters is too long, I suggest abbreviating shorten the event source portion of it:
    ec.Microsoft-AspNetCore-Server-Kestrel.tls-handshakes-per-second -> ec.Microsoft-AspNetCore-Server-Kestr.tls-handshakes-per-second. It generates stable and common name for a single instrument.

Happy to consider other options for shortening the name.

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #

@lmolkova lmolkova requested a review from a team October 28, 2022 00:37
@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Merging #740 (5803f8a) into main (005fdb7) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   77.41%   77.56%   +0.15%     
==========================================
  Files         176      176              
  Lines        5299     5308       +9     
==========================================
+ Hits         4102     4117      +15     
+ Misses       1197     1191       -6     
Impacted Files Coverage Δ
...ons/Internal/ActivityEventAttachingLogProcessor.cs 93.33% <100.00%> (ø)
...trumentation.EventCounters/EventCountersMetrics.cs 85.07% <100.00%> (+7.48%) ⬆️
...ounters/EventCountersInstrumentationEventSource.cs 27.27% <0.00%> (+27.27%) ⬆️

@mic-max
Copy link
Contributor

mic-max commented Nov 2, 2022

Thanks for the change, I hadn't realised that some of the well-known counters were going to fail this!
The main point of prefixing with EventCounters. is just to help avoid possible collisions, so I think changing to ec. is fine and saves on the character count.
I agree that if anything needs to be shortened in the instrument name it should be the event source and then if still too long after doing so the SDK can just fail and log its warning.

Copy link
Contributor

@Kielek Kielek left a comment

Choose a reason for hiding this comment

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

Approved, but please add entry to the changelog under unreleased section https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.EventCounters/CHANGELOG.md
(Short description + link to this PR).

@utpilla utpilla added the comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters label Nov 8, 2022
@lmolkova lmolkova force-pushed the support-long-event-source-names branch from 1e5eee6 to d8ffb92 Compare November 9, 2022 17:36
@utpilla utpilla changed the title Support long event source names better in EventCounters instrumentation [Instrumentation.EventCounters] Support long event source names better in EventCounters instrumentation Nov 10, 2022
@lmolkova lmolkova force-pushed the support-long-event-source-names branch 2 times, most recently from 82063e7 to dc75cb0 Compare November 10, 2022 02:20
@lmolkova
Copy link
Contributor Author

@open-telemetry/dotnet-contrib-approvers, if there are no objections, can someone please merge it?

@lmolkova lmolkova force-pushed the support-long-event-source-names branch from 472415f to 1d04da6 Compare November 11, 2022 01:11
@lmolkova lmolkova force-pushed the support-long-event-source-names branch from 14fedbb to 5803f8a Compare November 11, 2022 01:16
@utpilla utpilla merged commit edae331 into open-telemetry:main Nov 11, 2022
@utpilla
Copy link
Contributor

utpilla commented Nov 11, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants