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

Adding Activity.AddException #102905

Merged
merged 4 commits into from
Jun 3, 2024
Merged

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented May 31, 2024

fixes #53641

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@tarekgh tarekgh added this to the 9.0.0 milestone May 31, 2024
@tarekgh tarekgh requested a review from noahfalk May 31, 2024 01:26
@tarekgh
Copy link
Member Author

tarekgh commented May 31, 2024

CC @reyang @cijothomas @CodeBlanch

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

👍

@tarekgh tarekgh merged commit b23dea6 into dotnet:main Jun 3, 2024
83 checks passed
/// <para>- Any registered <see cref="ActivityListener"/> with the <see cref="ActivityListener.ExceptionRecorder"/> callback that adds "exception.message", "exception.stacktrace", or "exception.type" tags
/// will not have these tags overwritten, except by any subsequent <see cref="ActivityListener"/> that explicitly overwrites them.</para>
/// </remarks>
public Activity AddException(Exception exception, TagList tags = default, DateTimeOffset timestamp = default)
Copy link
Contributor

Choose a reason for hiding this comment

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

@tarekgh Sorry just noticed this but should we use in TagList tags here? It is kind of big struct that might save some copy cycles.

Copy link
Member Author

Choose a reason for hiding this comment

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

I raised the question in #53641 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't be too worried either way. Presumably to get to this point the dev already threw and caught an Exception costing them 10s of microseconds. Spending an extra 10? nanoseconds copying a struct seems neglible.

Copy link
Member Author

Choose a reason for hiding this comment

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

I already opened a PR #103009 for it.

The other point is we always pass TagList by ref in other APIs. Consistency is good beside getting minor perf is not bad.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2024
@tarekgh tarekgh deleted the Activity.AddException branch August 6, 2024 20:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activity should have AddExceptionMethod
6 participants