Skip to content

Implementation of RecordException in TelemetrySpan - #1116

Merged
cijothomas merged 11 commits into
open-telemetry:masterfrom
eddynaka:feature/record-exception
Aug 21, 2020
Merged

Implementation of RecordException in TelemetrySpan#1116
cijothomas merged 11 commits into
open-telemetry:masterfrom
eddynaka:feature/record-exception

Conversation

@eddynaka

Copy link
Copy Markdown
Contributor

Fixes #1115.

Changes

Please provide a brief description of the changes here. Update the
CHANGELOG.md for non-trivial changes.

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

  • Design discussion issue #
  • Changes in public API reviewed

@eddynaka
eddynaka requested a review from a team August 20, 2020 21:58
@codecov

codecov Bot commented Aug 20, 2020

Copy link
Copy Markdown

Codecov Report

Merging #1116 into master will increase coverage by 0.15%.
The diff coverage is 94.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1116      +/-   ##
==========================================
+ Coverage   77.51%   77.67%   +0.15%     
==========================================
  Files         222      222              
  Lines        6241     6272      +31     
==========================================
+ Hits         4838     4872      +34     
+ Misses       1403     1400       -3     
Impacted Files Coverage Δ
...rc/OpenTelemetry.Exporter.ZPages/ZPagesExporter.cs 90.90% <0.00%> (-9.10%) ⬇️
...c/OpenTelemetry.Exporter.ZPages/ZPagesProcessor.cs 90.90% <ø> (-0.21%) ⬇️
src/OpenTelemetry.Api/Trace/ActivityExtensions.cs 96.42% <90.90%> (-3.58%) ⬇️
src/OpenTelemetry.Api/Trace/TelemetrySpan.cs 84.05% <100.00%> (+3.70%) ⬆️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 100.00% <100.00%> (ø)
....Exporter.ZPages/ZPagesExporterHelperExtensions.cs 100.00% <100.00%> (ø)
...ZPages/Implementation/ZPagesExporterEventSource.cs 62.50% <0.00%> (+6.25%) ⬆️
src/OpenTelemetry/Trace/ActivityExporterSync.cs 80.00% <0.00%> (+80.00%) ⬆️

Dictionary<string, object> attributes = new Dictionary<string, object>
{
{ SemanticConventions.AttributeExceptionType, ex.GetType().Name },
{ SemanticConventions.AttributeExceptionStacktrace, ex.ToInvariantString() },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Due to the potential size of the stack trace, I feel that later we should have an option to not add it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it would be better to trim instead of not add?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mean an option in this method itself?
Or for individual exporters?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good questions.

It seems good to have "config" options to limit the size of attribute values in general: trim at some upper bound, and also an option to not add the stack trace. Both should be off by default: they are more like escape valves if this becomes a problem with actual usage.

I see these settings as part of API configuration. Anyway, I see it as separate from this PR.

Comment thread src/OpenTelemetry.Api/Trace/TelemetrySpan.cs Outdated
Comment thread src/OpenTelemetry.Api/Trace/TelemetrySpan.cs

@CodeBlanch CodeBlanch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@eddynaka Are you going to add an Activity extension that does similar? I'm thinking we could call it from instrumentation when an exception is detected?

@eddynaka

Copy link
Copy Markdown
Contributor Author

LGTM

@eddynaka Are you going to add an Activity extension that does similar? I'm thinking we could call it from instrumentation when an exception is detected?

something like this?

public static void RecordException(this Activity activity, Exception ex)
{
// TODO....
}

IF yes, what activityExtension should I add...we have some....

@CodeBlanch

Copy link
Copy Markdown
Member

@eddynaka Ya that's what I was thinking. Maybe in here src\OpenTelemetry.Api\Trace\ActivityExtensions.cs?

@eddynaka

Copy link
Copy Markdown
Contributor Author

I will do that when I wake up :)

@eddynaka

Copy link
Copy Markdown
Contributor Author

@eddynaka Ya that's what I was thinking. Maybe in here src\OpenTelemetry.Api\Trace\ActivityExtensions.cs?

Just pushed. Let me know what do you think!

{
// The set of constants matches the specification as of this commit.
// https://github.com/open-telemetry/opentelemetry-specification/tree/709293fe132709705f0e0dd4252992e87a6ec899/specification/trace/semantic_conventions
// https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/trace/semantic_conventions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: The comment above says this matches a particular commit. So lets link to that particular commit, not master as master changes.

@cijothomas
cijothomas merged commit 1b6c39d into open-telemetry:master Aug 21, 2020
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.

Span should provide Record Exception Method

5 participants