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

[sdk-traces] SamplingResult constructors accept null parameters #5614

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ OpenTelemetry.Trace.SamplingResult.Equals(OpenTelemetry.Trace.SamplingResult oth
OpenTelemetry.Trace.SamplingResult.SamplingResult() -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(bool isSampled) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, string! traceStateString) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object!>>! attributes) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, string? traceStateString) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object!>>? attributes) -> void
OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object!>>? attributes, string? traceStateString) -> void
OpenTelemetry.Trace.SamplingResult.TraceStateString.get -> string?
OpenTelemetry.Trace.TraceIdRatioBasedSampler
Expand Down
5 changes: 5 additions & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
supported in stable builds.
([#5607](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5607))

* Fixed the nullable annotations for the `SamplingResult` constructors
to allow `null` being supplied as `attributes` or `traceStateString`
which has always been supported.
([#5614](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5614))

## 1.8.1

Released 2024-Apr-17
Expand Down
6 changes: 3 additions & 3 deletions src/OpenTelemetry/Trace/SamplingResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public SamplingResult(bool isSampled)
/// <param name="decision">indicates whether an activity object is recorded and sampled.</param>
/// <param name="attributes">Attributes associated with the sampling decision. Attributes list passed to
/// this method must be immutable. Mutations of the collection and/or attribute values may lead to unexpected behavior.</param>
public SamplingResult(SamplingDecision decision, IEnumerable<KeyValuePair<string, object>> attributes)
public SamplingResult(SamplingDecision decision, IEnumerable<KeyValuePair<string, object>>? attributes)
: this(decision, attributes, traceStateString: null)
{
}
Expand All @@ -42,7 +42,7 @@ public SamplingResult(SamplingDecision decision, IEnumerable<KeyValuePair<string
/// </summary>
/// <param name="decision">indicates whether an activity object is recorded and sampled.</param>
/// <param name="traceStateString">traceStateString associated with the created Activity.</param>
public SamplingResult(SamplingDecision decision, string traceStateString)
public SamplingResult(SamplingDecision decision, string? traceStateString)
: this(decision, attributes: null, traceStateString)
{
}
Expand All @@ -67,7 +67,7 @@ public SamplingResult(SamplingDecision decision, IEnumerable<KeyValuePair<string
}

/// <summary>
/// Gets a value indicating indicates whether an activity object is recorded and sampled.
/// Gets a value indicating whether an activity object is recorded and sampled.
/// </summary>
public SamplingDecision Decision { get; }

Expand Down
Loading