From 547cd87f289cc0740070f359d5d08d76f9c09a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 14 May 2024 11:20:53 +0200 Subject: [PATCH] SamplingResult constructor accepts null parameters --- src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt | 4 ++-- src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt | 2 ++ src/OpenTelemetry/CHANGELOG.md | 5 +++++ src/OpenTelemetry/Trace/SamplingResult.cs | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt index 8ce68138218..782de5a158f 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 +*REMOVED*OpenTelemetry.Trace.SamplingResult.SamplingResult(OpenTelemetry.Trace.SamplingDecision decision, string! traceStateString) -> void +*REMOVED*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/.publicApi/Stable/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt index a9a6c031d7a..78400a27cb9 100644 --- a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt @@ -25,4 +25,6 @@ OpenTelemetry.ReadOnlyFilteredTagCollection.Enumerator.Enumerator() -> void OpenTelemetry.ReadOnlyFilteredTagCollection.Enumerator.MoveNext() -> bool OpenTelemetry.ReadOnlyFilteredTagCollection.GetEnumerator() -> OpenTelemetry.ReadOnlyFilteredTagCollection.Enumerator OpenTelemetry.ReadOnlyFilteredTagCollection.ReadOnlyFilteredTagCollection() -> 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 static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilterType exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index bbcbbcdd6a8..7950843c200 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)) +* `SamplingResult(SamplingDecision decision, IEnumerable>? attributes)` + and `SamplingResult(SamplingDecision decision, string? traceStateString)` constructors + accept `null` for `attributes` and `traceStateString` parameters respectively. + ([#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; }