Skip to content

Adding Activity.AddException - #102905

Merged
tarekgh merged 4 commits into
dotnet:mainfrom
tarekgh:Activity.AddException
Jun 3, 2024
Merged

Adding Activity.AddException#102905
tarekgh merged 4 commits into
dotnet:mainfrom
tarekgh:Activity.AddException

Conversation

@tarekgh

@tarekgh tarekgh commented May 31, 2024

Copy link
Copy Markdown
Member

fixes #53641

@ghost

ghost commented May 31, 2024

Copy link
Copy Markdown

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

tarekgh commented May 31, 2024

Copy link
Copy Markdown
Member Author

CC @reyang @cijothomas @CodeBlanch

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

👍

@tarekgh
tarekgh merged commit b23dea6 into dotnet:main Jun 3, 2024
/// <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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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