-
Notifications
You must be signed in to change notification settings - Fork 302
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.GrpcCore] Record exceptions as activity events flag #1648
[Instrumentation.GrpcCore] Record exceptions as activity events flag #1648
Conversation
…hinets/opentelemetry-dotnet-contrib into record-exceptions-option
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1648 +/- ##
==========================================
+ Coverage 73.91% 80.17% +6.25%
==========================================
Files 267 116 -151
Lines 9615 3077 -6538
==========================================
- Hits 7107 2467 -4640
+ Misses 2508 610 -1898
Flags with carried forward coverage won't be shown. Click here to find out more. |
test/OpenTelemetry.Instrumentation.GrpcCore.Tests/GrpcCoreClientInterceptorTests.cs
Show resolved
Hide resolved
Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
…hinets/opentelemetry-dotnet-contrib into record-exceptions-option
# Conflicts: # src/OpenTelemetry.Instrumentation.GrpcCore/CHANGELOG.md
@cijothomas , @Kielek I've made suggested changes. Ready for another review |
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.
@cijothomas, based on https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-spans.md
I would say that when possible exception should be always recorded as events. Do we really need the option to enable it? I would consider adding possibility to opt-out. To met the spec, it should be enabled by default.
@IliaBrahinets, please do not change the code based on this comment. We need to find agreement here, it should probably impact more packages than only this one.
|
||
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-spans.md | ||
internal const string AttributeExceptionEventName = "exception"; | ||
internal const string AttributeExceptionType = "exception.type"; | ||
internal const string AttributeExceptionMessage = "exception.message"; | ||
internal const string AttributeExceptionStacktrace = "exception.stacktrace"; |
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.
All this const are used only in tests file. I am not sure if it worth to put it into production code.
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.
Then existing AttributeActivityIdentifier
const should be also taken into account. I think it is simpler to manage all semantic convetions from one place within a library (including tests). Libraries which use Shared/SemanticConventions.cs
include many unused consts. BTW probably it is worth to migrate OpenTelemetry.Instrumentation.GrpcCore
to Shared/SemanticConventions.cs
. though it lacks "otel.status_code" and "otel.status_description" attributes.
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.
Any references to otel.status_code and otel.status_descrription should be removed from instrumentation libraries.
It should be responsibility of exporter to map it correctly. If these are still used in production code, it is just leftover from open-telemetry/opentelemetry-dotnet#2569
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.
Turns out that otel.status_code and otel.status_descrription are used in tests only. As the result of the discussion:
- otel.status_code and otel.status_description should be replaced by
Activity.Status
andActivity.StatusDescription
in tests - Use
Shared/SemanticConventions.cs
inOpenTelemetry.Instrumentation.GrpcCore
I would like to submit another PR for the suggested changes, @Kielek what do you think ?
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.
PRs are more than welcomed :)
I think it should be off by default, and controlled via an option.
|
Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
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.
LGTM.
@IliaBrahinets, please resolve conflicts. It is related to moving publicAPI file to the parent folder. Ref: #1711
@pcwiese, it will be great if you can review
The conflicts have been resolved. |
Changes
RecordException
flag has been added in bothServerTracingInterceptorOptions
andClientTracingInterceptorOptions
. When set totrue
exceptions are recored as activity events.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes