-
Notifications
You must be signed in to change notification settings - Fork 292
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] Stabilize and Enable Testing #620
[Instrumentation.EventCounters] Stabilize and Enable Testing #620
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #620 +/- ##
==========================================
- Coverage 77.76% 77.69% -0.07%
==========================================
Files 175 175
Lines 5261 5249 -12
==========================================
- Hits 4091 4078 -13
- Misses 1170 1171 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I like this feature for OTel : ) I left some suggestions inline
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersInstrumentationOptions.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersInstrumentationOptions.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersInstrumentationOptions.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersInstrumentationOptions.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
Outdated
Show resolved
Hide resolved
The PR looks good. There are some duplicate checks with instrument names that should be avoided. |
|
||
/// <inheritdoc /> | ||
protected override void OnEventWritten(EventWrittenEventArgs eventData) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could eventData
be null
?
return; | ||
} | ||
|
||
var value = Convert.ToDouble(hasMean ? mean : increment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the try-catch
block from UpdateInstrumentWithEvent
to here to include the Convert.ToDouble
method in the try
block as that could also throw exceptions.
/// <inheritdoc /> | ||
protected override void OnEventWritten(EventWrittenEventArgs eventData) | ||
{ | ||
if (this.options == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, just dropping an event if the constructor hasn't finished setting the options
field. I'll add comments as this is an obscure situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never enable events until the options are set, right? If options is null
we just enqueue it and wait till the ctor has set options before proceeding to enable events for the enqueued EventSources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya this is to avoid creating instruments for event sources we don't care about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions. They are not blocking this PR. We would also have to enable Public API Analyzer for this project.
Towards #215 since spec is not stable
Changes
EventCounters
named events by default and that are from a configured EventSource name, which includes nothing by default.Resources
Follow-up PR Plans
meterProvider.AddEventCounterListener
multiple times.AddEventSources
more complicated...)For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes