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

Add exception.count in Runtime metrics #431

Merged
merged 12 commits into from
Jun 23, 2022

Conversation

xiang17
Copy link
Contributor

@xiang17 xiang17 commented Jun 15, 2022

Adding feature for #335.

Changes

Add exception.counter in Runtime metrics.

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

@xiang17 xiang17 requested a review from a team June 15, 2022 23:28
@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #431 (d232fa0) into main (d8d0e93) will not change coverage.
The diff coverage is 0.00%.

❗ Current head d232fa0 differs from pull request most recent head d25f9c2. Consider uploading reports for the commit d25f9c2 to get more accurate results

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #431   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        163     163           
  Lines       4898    4918   +20     
=====================================
- Misses      4898    4918   +20     
Impacted Files Coverage Δ
...elemetry.Instrumentation.Runtime/RuntimeMetrics.cs 0.00% <0.00%> (ø)
...y.Instrumentation.Runtime/RuntimeMetricsOptions.cs 0.00% <0.00%> (ø)

@xiang17 xiang17 changed the title Add exception.counter in Runtime metrics Add exception.count in Runtime metrics Jun 17, 2022
@reyang reyang added the comp:instrumentation.runtime Things related to OpenTelemetry.Instrumentation.Runtime label Jun 17, 2022

if (options.IsExceptionCountEnabled)
{
var exceptionCounter = this.meter.CreateCounter<long>($"{metricPrefix}exception.count", description: "Number of exceptions thrown.");
Copy link
Member

Choose a reason for hiding this comment

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

description is not indicating if this is including FirstChance exceptions or not.

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 still think it's not necessary to mention it in the short description after reading through the the description for FirstChanceException and the comparison between first chance vs second chance exception.

  1. FirstChanceException indeed is the count of "exceptions thrown", just with two limits: "in managed code" and "before runtime searches for handler":

Occurs when an exception is thrown in managed code, before the runtime searches the call stack for an exception handler in the application domain.

  1. In comparison, second chance exception happens when the application doesn't handle it, i.e. the application crashes, then there is no need to "count" it because it'll always be 0 until it got to 1 and crashes immediately later. The user wouldn't have doubts on whether it's first chance or second chance exception if he/she knows about this concept.

If the user does get question on more detailed definition, he/she can refer to the detailed markdown doc, as for any other metrics in the Runtime metrics.

Is my understanding correct? Do you think it's still needed to add first chance in the description field for some reason?

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM. Could improve descriptions in future PRs.

@cijothomas cijothomas merged commit 76f0b06 into open-telemetry:main Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.runtime Things related to OpenTelemetry.Instrumentation.Runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants