Skip to content

Commit

Permalink
[sdk-traces] SamplingResult constructors accept null parameters (#5614)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek authored May 16, 2024
1 parent 1bbafaa commit 808abc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
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

0 comments on commit 808abc8

Please sign in to comment.