diff --git a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt index 8ce68138218..6a4426d4ce6 100644 --- a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt @@ -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>! 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>? attributes) -> void OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, System.Collections.Generic.IEnumerable>? attributes, string? traceStateString) -> void OpenTelemetry.Trace.SamplingResult.TraceStateString.get -> string? OpenTelemetry.Trace.TraceIdRatioBasedSampler diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index bbcbbcdd6a8..1ba0afa19c7 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -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 diff --git a/src/OpenTelemetry/Trace/SamplingResult.cs b/src/OpenTelemetry/Trace/SamplingResult.cs index 25120d4ee9a..96a2fcbeeb2 100644 --- a/src/OpenTelemetry/Trace/SamplingResult.cs +++ b/src/OpenTelemetry/Trace/SamplingResult.cs @@ -32,7 +32,7 @@ public SamplingResult(bool isSampled) /// indicates whether an activity object is recorded and sampled. /// 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. - public SamplingResult(SamplingDecision decision, IEnumerable> attributes) + public SamplingResult(SamplingDecision decision, IEnumerable>? attributes) : this(decision, attributes, traceStateString: null) { } @@ -42,7 +42,7 @@ public SamplingResult(SamplingDecision decision, IEnumerable /// indicates whether an activity object is recorded and sampled. /// traceStateString associated with the created Activity. - public SamplingResult(SamplingDecision decision, string traceStateString) + public SamplingResult(SamplingDecision decision, string? traceStateString) : this(decision, attributes: null, traceStateString) { } @@ -67,7 +67,7 @@ public SamplingResult(SamplingDecision decision, IEnumerable - /// 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. /// public SamplingDecision Decision { get; }