-
Notifications
You must be signed in to change notification settings - Fork 781
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] Better obsolete message for Activity.SetStatus extension method #5872
Conversation
@@ -29,7 +29,7 @@ public static class ActivityExtensions | |||
/// <param name="activity">Activity instance.</param> | |||
/// <param name="status">Activity execution status.</param> | |||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |||
[Obsolete("Call Activity.SetStatus instead this method will be removed in a future version.")] | |||
[Obsolete("Call Activity.SetStatus(ActivityStatusCode code, string? description = null) instead. This method will be removed in a future version.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't spend time looking at what others are doing or what's the official guidance (if there is any). IIRC the typical pattern is to mention the method name rather than the parameters while using ObsoleteAttribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reyang, If you prefer, we could use this. I was aware about these changes and I needed some time to find correct method to fix warnings/errors.
[Obsolete("Call Activity.SetStatus(ActivityStatusCode code, string? description = null) instead. This method will be removed in a future version.")] | |
[Obsolete("Call Activity.SetStatus(ActivityStatusCode, string?) instead. This method will be removed in a future version.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this? Really really? 🤣 Because there are 3 other obsoletes in this file we should update too if we do. And probably all the others ones sprinkled around the code. But IMO we don't really need it. The existing message is good enough IMO, and there is also a doc link "see" ref thing in <remarks>
which will jump users to the overload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reyang, If you prefer, we could use this.
I don't prefer any of these, I like the current one (just the method name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you : )
The reason behind this - the name is of the method is not changing. Only set of parameters. For RecordException there is a recommendation to call AddException.
Feel free to close the PR if you think that it is not worth to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe send users to this URL https://learn.microsoft.com/dotnet/api/system.diagnostics.activity.setstatus from the warning message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the change as it brings clarity. I've left a small note regarding the verbosity (too verbose?).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5872 +/- ##
==========================================
+ Coverage 83.38% 86.25% +2.87%
==========================================
Files 297 257 -40
Lines 12531 11214 -1317
==========================================
- Hits 10449 9673 -776
+ Misses 2082 1541 -541
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Follow up: #5781
Found while working on errors in open-telemetry/opentelemetry-dotnet-contrib#2121
Changes
Previous message was not user friednly:
It was referring to the method with the same same without any signature.
Merge requirement checklist
[ ] Unit tests added/updated[ ] AppropriateCHANGELOG.md
files updated for non-trivial changes[ ] Changes in public API reviewed (if applicable)