-
Notifications
You must be signed in to change notification settings - Fork 751
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] Nullable #5801
base: main
Are you sure you want to change the base?
[Api] Nullable #5801
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5801 +/- ##
==========================================
+ Coverage 83.38% 86.39% +3.01%
==========================================
Files 297 257 -40
Lines 12531 11169 -1362
==========================================
- Hits 10449 9650 -799
+ Misses 2082 1519 -563
Flags with carried forward coverage won't be shown. Click here to find out more.
|
de9f690
to
8ebf150
Compare
8ebf150
to
8bf04e4
Compare
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.
LGTM with fixes.
While reviewing, please focus on Baggage and RuntimeContext related things.
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. |
@@ -7,7 +7,7 @@ namespace OpenTelemetry.Metrics; | |||
|
|||
internal sealed class PullMetricScope : IDisposable | |||
{ | |||
private static readonly RuntimeContextSlot<bool> Slot = RuntimeContext.RegisterSlot<bool>("otel.pull_metric"); | |||
private static readonly RuntimeContextSlot<bool> Slot = RuntimeContext.RegisterSlot<bool>("otel.pull_metric")!; |
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 think this one needs a closer look.
I'm not familiar with the RuntimeContext api. If the RegisterSlot method can return a nullable, that might suggest something failed.
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.
Fixed in fe4d9bf
I double checked. There is no possibility to return null (at least as long someone does no play with reflection with contextSlotType
field in RuntimeContext
class.
@@ -19,12 +19,12 @@ namespace System.Runtime.CompilerServices | |||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | |||
internal sealed class CallerArgumentExpressionAttribute : Attribute | |||
{ | |||
public CallerArgumentExpressionAttribute(string parameterName) | |||
public CallerArgumentExpressionAttribute(string? parameterName) |
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.
Should doublecheck this. The original class doesn't have nullable. (link)
My understanding is that this should never be null.
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.
See also https://github.com/dotnet/runtime/blob/v9.0.0-rc.1.24431.7/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/CallerArgumentExpressionAttributeTests.cs (the same tests we have copied to this repository).
I am not against dropping support for null, but it is kind of break for what we have in dotnet repository.
Whatever we decide, the impact should be low. It is extremely internal class. Any recommendation based on this?
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.
Thanks. I think this changes is good.
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.
these changes LGTM.
One thing to note, I don't know the Baggage
or RuntimeContext
classes well enough to say if these values SHOULD be nullable.
Towards #3958
Changes
OpenTelemety.Api mark as nullable
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes