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

Specify which exceptions SHOULD be recorded #761

Closed

Conversation

Oberon00
Copy link
Member

@Oberon00 Oberon00 commented Aug 6, 2020

Replaces #521 "Semantic conventions for when to record exceptions.

Issues that came up in this PR but should be handled separately:

Change summary

  • State that exceptions that leave the scope of a Span SHOULD be recorded.

Major changes this PR underwent

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 6, 2020

CLA Check
The committers are authorized under a signed CLA.

@Oberon00 Oberon00 changed the title Error recording Specify which exceptions should be recorded (and which MUST NOT) Aug 6, 2020
@Oberon00

This comment has been minimized.

@Oberon00 Oberon00 marked this pull request as ready for review August 6, 2020 07:22
@Oberon00 Oberon00 requested review from a team August 6, 2020 07:22
@Oberon00 Oberon00 added area:api Cross language API specification issue area:error-reporting Related to error reporting area:semantic-conventions Related to semantic conventions spec:trace Related to the specification/trace directory labels Aug 6, 2020
@Oberon00 Oberon00 changed the title Specify which exceptions should be recorded (and which MUST NOT) Specify which exceptions should be recorded, add boolean exception.left_scope Aug 7, 2020
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Armin Ruech <[email protected]>
@arminru arminru requested a review from a team August 10, 2020 14:33
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

I would vote to not merge this PR:

  • This PR without clearly stated adds a notion of "back" propagation which we haven't defined yet and there may be other informations that we may need to propagate not only exceptions.
  • Unclear what do we try to achieve with the special "left_scope" (also name is bad, initially I thought about where is the "right_scope", probably "left_the_scope").
  • Why do we not say that exception should be recorded in every Span that "observes" it. Which means:
    • ParentSpan -> ChildSpan
    • ChildSpan throws exception, and records it, does not handle the exception
    • ParentSpan catches that exception (may throw, or handle) then it also records the exception.

specification/trace/semantic_conventions/exceptions.md Outdated Show resolved Hide resolved
@Oberon00
Copy link
Member Author

This PR without clearly stated adds a notion of "back" propagation which we haven't defined yet

Actually no. In fact I tried very hard to make clear that no back back propagation is needed at all. That's why added

Note that multiple events (on the same or different Spans) might be logged for the same exception object instance.

and also

SHOULD be set to true if the exception event is recorded while observing the exception leaving the scope of the span.

If you tell me what makes you think of back propagation here, I will try to reword the spec to make it more clear.

Unclear what do we try to achieve with the special "left_scope" (also name is bad, initially I thought about where is the "right_scope", probably "left_the_scope").

It is a piece of information that can be used to determine which exception is likely to have been a cause for failure. Also it's very easy to implement this in instrumentations (no back propagation needed, you just will have a literal true if you implement your instrumentation in certain ways and leave it unset if you implement it in other ways).

Why do we not say that exception should be recorded in every Span that "observes" it.

But we do?

An unhandled exception that leaves the scope of a span SHOULD be recorded as an Event on that span.

(actually the "unhandled" is redundant here, I will remove it).

We have no SHOULD requirement for a span that catches an exception which occurs somewhere within it, since such exceptions typically go unobserved (you would have to instrument every catch block, which would generate noise for catch blocks that only do some cleanup and then rethrow).

@Oberon00

This comment has been minimized.

@Oberon00 Oberon00 changed the title Specify which exceptions SHOULD be recorded, add exception.escaped Specify which exceptions SHOULD be recorded Aug 11, 2020
@Oberon00 Oberon00 added release:required-for-ga Must be resolved before GA release, or nice to have before GA and removed release:after-ga Not required before GA release, and not going to work on before GA labels Aug 11, 2020
@Oberon00
Copy link
Member Author

Oberon00 commented Aug 11, 2020

As discussed in the SIG meeting today, removed the new semantic attribute (will submit it as a separate PR; EDIT: #784) and changed after-ga to required-for-ga for the remainder.

CC @bogdandrutu

specification/trace/semantic_conventions/exceptions.md Outdated Show resolved Hide resolved
specification/trace/semantic_conventions/exceptions.md Outdated Show resolved Hide resolved
specification/trace/semantic_conventions/exceptions.md Outdated Show resolved Hide resolved
Comment on lines 33 to 34
E.g. one event might be logged in an instrumented exception constructor
and another event might be logged when an exception leaves the scope of a span.
Copy link
Member

Choose a reason for hiding this comment

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

Should we do this? Can we avoid it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, it does add information about the path of the exception although the full stacktrace would not be relevant each time. I don't think this can be easily avoided.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm.. is the stacktrace not captured when the exception is generated (at least in some languages)? Also what is the point of having stacktrace twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no point, but you usually dont't know if the exception was already/will again be recorded.

Maybe a clever exporter can do de-duplication.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this is a "Note" stating what I think can happen in practice.

To allow improving this situation, we could do something like assign an ID to each exception when it is first observed and only record the ID for each further occurrence. But that's probably an after-ga thing.

@tigrannajaryan
Copy link
Member

@Oberon00 it is not entirely clear who these recommendations are targeted to. Is it for OpenTelemetry SDK developers or for application developers who use the OpenTelemetry in their apps? Can you please clarify the intent?

@Oberon00
Copy link
Member Author

Oberon00 commented Aug 14, 2020

@tigrannajaryan
At this point, recommendation in semantic conventions are always directed "to whom it may concern".

In languages that only support recordException APIs, this will be something that has to be done by the user (whoever calls these APIs), although SDK implementors should probably mention this spec part in their documentation for this method.

In other languages, where the API can provide more convenient support for this (for example Python already has a context manager for Spans that automatically sets the status code if an exception is thrown, see https://github.com/open-telemetry/opentelemetry-python/blob/b3c2a0372e27eff4594891db8ad04c438e9fdf4c/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L677), the SDK+API may also help implement this SHOULD requirement.

@Oberon00 Oberon00 requested a review from bogdandrutu August 14, 2020 10:59
@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 22, 2020
@Oberon00
Copy link
Member Author

Oberon00 commented Aug 22, 2020

@murphpdx You originially proposed this in #521. If you are still interested, please speak up, otherwise it seems to me that interest in this spec is too low. Personally, I also don't think it is too important to have this in the spec (although I do think it would be somewhat useful and IIRC @bogdandrutu did say in the SIG meeting that we should specify this before release)

I would merge the definitions of "escaped" plus the example into/after #784, if this goes stale.

@github-actions github-actions bot removed the Stale label Aug 23, 2020
@arminru arminru requested a review from jkwatson August 24, 2020 17:03
@github-actions
Copy link

github-actions bot commented Sep 1, 2020

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 1, 2020
@Oberon00
Copy link
Member Author

Oberon00 commented Sep 1, 2020

Closing this, because there does not seem to be enough interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api Cross language API specification issue area:error-reporting Related to error reporting area:semantic-conventions Related to semantic conventions release:required-for-ga Must be resolved before GA release, or nice to have before GA spec:trace Related to the specification/trace directory Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants