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

[api] Mark ActivityExtensions.RecordException obsolete #5841

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ysolomchenko
Copy link
Contributor

Fixes #5665

Changes

Mark ActivityExtensions.RecordException obsolete

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added the pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package label Sep 18, 2024
@ysolomchenko ysolomchenko marked this pull request as ready for review September 18, 2024 09:55
@ysolomchenko ysolomchenko requested a review from a team September 18, 2024 09:55
@@ -110,6 +111,7 @@ public static void RecordException(this Activity? activity, Exception? ex)
/// <remarks> The exception is recorded as per <a href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/exceptions.md">specification</a>.
/// "exception.stacktrace" is represented using the value of <a href="https://learn.microsoft.com/dotnet/api/system.exception.tostring">Exception.ToString</a>.
/// </remarks>
[Obsolete("Call Activity.AddException instead this method will be removed in a future version.")]
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 replace the implementation of this method with a call to activity.AddException?

Copy link
Contributor Author

@ysolomchenko ysolomchenko Sep 19, 2024

Choose a reason for hiding this comment

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

activity.AddException is not available in version 8.0.0 and was only introduced starting from version 9.0.0-rc.1.24431.7. Should we consider upgrading our version to System.Diagnostics.DiagnosticSource v9.0.0-rc.1.24431.7, or would we prefer to wait for the official release of v9.0.0?

Copy link
Member

Choose a reason for hiding this comment

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

#5846 will be addressed soon by @rajkumar-rangaraj , so we can wait for that PR to merge first. @ysolomchenko or do you prefer to merge this as-is, and change the implementation to use actiity.AddException as a following after the other changes are in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be better to wait until #5846 is done before finishing that PR

Copy link
Member

Choose a reason for hiding this comment

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

Just merged it 👍

@@ -97,6 +97,7 @@ public static Status GetStatus(this Activity? activity)
/// <remarks> The exception is recorded as per <a href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/exceptions.md">specification</a>.
/// "exception.stacktrace" is represented using the value of <a href="https://learn.microsoft.com/dotnet/api/system.exception.tostring">Exception.ToString</a>.
/// </remarks>
[Obsolete("Call Activity.AddException instead this method will be removed in a future version.")]
Copy link
Member

Choose a reason for hiding this comment

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

can we explicitly call out that the end result is same when using the suggested alternative?

@CodeBlanch CodeBlanch requested a review from a team as a code owner September 20, 2024 19:52
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.26%. Comparing base (6250307) to head (b5c7bc4).
Report is 321 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5841      +/-   ##
==========================================
+ Coverage   83.38%   86.26%   +2.87%     
==========================================
  Files         297      257      -40     
  Lines       12531    11168    -1363     
==========================================
- Hits        10449     9634     -815     
+ Misses       2082     1534     -548     
Flag Coverage Δ
unittests ?
unittests-Project-Experimental 85.99% <ø> (?)
unittests-Project-Stable 86.18% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/OpenTelemetry.Api/Trace/ActivityExtensions.cs 90.32% <ø> (-5.14%) ⬇️

... and 223 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark ActivityExtensions.RecordException obsolete
3 participants