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

Implementation of RecordException in TelemetrySpan #1116

Merged
merged 11 commits into from
Aug 21, 2020
Merged

Implementation of RecordException in TelemetrySpan #1116

merged 11 commits into from
Aug 21, 2020

Conversation

eddynaka
Copy link
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
Copy link

codecov bot commented Aug 20, 2020

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
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
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
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
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.

src/OpenTelemetry.Api/Trace/TelemetrySpan.cs Outdated Show resolved Hide resolved
Copy link
Member

@CodeBlanch CodeBlanch left a comment

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
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
Member

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

@eddynaka
Copy link
Contributor Author

I will do that when I wake up :)

@eddynaka
Copy link
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!

@@ -23,7 +23,8 @@ namespace OpenTelemetry.Trace
internal static class SemanticConventions
{
// 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
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