From ccfbcc62d19cb14f35c5cceba4d9295dfb8a820c Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Wed, 31 May 2023 20:32:43 -0700 Subject: [PATCH] Mark Exemplars internal (#4533) Co-authored-by: Alan West <3676547+alanwest@users.noreply.github.com> --- examples/AspNetCore/Program.cs | 3 ++- .../ConsoleMetricExporter.cs | 2 ++ .../Implementation/MetricItemExtensions.cs | 3 ++- .../.publicApi/net462/PublicAPI.Unshipped.txt | 25 ------------------- .../.publicApi/net6.0/PublicAPI.Unshipped.txt | 25 ------------------- .../netstandard2.0/PublicAPI.Unshipped.txt | 25 ------------------- .../netstandard2.1/PublicAPI.Unshipped.txt | 25 ------------------- .../Builder/MeterProviderBuilderExtensions.cs | 4 ++- .../Exemplar/AlwaysOffExemplarFilter.cs | 2 +- .../Exemplar/AlwaysOnExemplarFilter.cs | 2 +- .../Metrics/Exemplar/Exemplar.cs | 4 ++- .../Metrics/Exemplar/ExemplarFilter.cs | 2 +- .../Exemplar/TraceBasedExemplarFilter.cs | 2 +- src/OpenTelemetry/Metrics/MetricPoint.cs | 2 +- test/Benchmarks/Metrics/ExemplarBenchmarks.cs | 2 +- .../Program.cs | 3 ++- .../Metrics/MetricTestsBase.cs | 2 +- 17 files changed, 21 insertions(+), 112 deletions(-) diff --git a/examples/AspNetCore/Program.cs b/examples/AspNetCore/Program.cs index bc4e0602cda..6361941dc48 100644 --- a/examples/AspNetCore/Program.cs +++ b/examples/AspNetCore/Program.cs @@ -110,7 +110,8 @@ // Ensure the MeterProvider subscribes to any custom Meters. builder .AddMeter(Instrumentation.MeterName) - .SetExemplarFilter(new TraceBasedExemplarFilter()) + + // .SetExemplarFilter(new TraceBasedExemplarFilter()) .AddRuntimeInstrumentation() .AddHttpClientInstrumentation() .AddAspNetCoreInstrumentation(); diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs index 25654d7122b..4be38f11356 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs @@ -189,6 +189,7 @@ public override ExportResult Export(in Batch batch) } var exemplarString = new StringBuilder(); + /* Commenting out as Exemplars is marked internal foreach (var exemplar in metricPoint.GetExemplars()) { if (exemplar.Timestamp != default) @@ -219,6 +220,7 @@ public override ExportResult Export(in Batch batch) exemplarString.AppendLine(); } } + */ msg = new StringBuilder(); msg.Append('('); diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/MetricItemExtensions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/MetricItemExtensions.cs index 5ac61d2e068..8db6ff57d5f 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/MetricItemExtensions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/MetricItemExtensions.cs @@ -18,7 +18,6 @@ using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; -using Google.Protobuf; using Google.Protobuf.Collections; using OpenTelemetry.Metrics; using OtlpCollector = OpenTelemetry.Proto.Collector.Metrics.V1; @@ -270,6 +269,7 @@ internal static OtlpMetrics.Metric ToOtlpMetric(this Metric metric) } } + /* Commenting out as Exemplars is marked internal var exemplars = metricPoint.GetExemplars(); foreach (var examplar in exemplars) { @@ -303,6 +303,7 @@ internal static OtlpMetrics.Metric ToOtlpMetric(this Metric metric) dataPoint.Exemplars.Add(otlpExemplar); } } + */ histogram.DataPoints.Add(dataPoint); } diff --git a/src/OpenTelemetry/.publicApi/net462/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net462/PublicAPI.Unshipped.txt index 846034361b3..36c92a3992d 100644 --- a/src/OpenTelemetry/.publicApi/net462/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net462/PublicAPI.Unshipped.txt @@ -2,24 +2,12 @@ OpenTelemetry.Logs.LogRecord.Attributes.get -> System.Collections.Generic.IReadO OpenTelemetry.Logs.LogRecord.Attributes.set -> void OpenTelemetry.Logs.LogRecord.Body.get -> string? OpenTelemetry.Logs.LogRecord.Body.set -> void -OpenTelemetry.Metrics.AlwaysOffExemplarFilter -OpenTelemetry.Metrics.AlwaysOffExemplarFilter.AlwaysOffExemplarFilter() -> void -OpenTelemetry.Metrics.AlwaysOnExemplarFilter -OpenTelemetry.Metrics.AlwaysOnExemplarFilter.AlwaysOnExemplarFilter() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.Base2ExponentialBucketHistogramConfiguration() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.set -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.set -> void -OpenTelemetry.Metrics.Exemplar -OpenTelemetry.Metrics.Exemplar.DoubleValue.get -> double -OpenTelemetry.Metrics.Exemplar.Exemplar() -> void -OpenTelemetry.Metrics.Exemplar.SpanId.get -> System.Diagnostics.ActivitySpanId? -OpenTelemetry.Metrics.Exemplar.Timestamp.get -> System.DateTimeOffset -OpenTelemetry.Metrics.Exemplar.TraceId.get -> System.Diagnostics.ActivityTraceId? -OpenTelemetry.Metrics.ExemplarFilter -OpenTelemetry.Metrics.ExemplarFilter.ExemplarFilter() -> void OpenTelemetry.Metrics.ExponentialHistogramBuckets OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator.Current.get -> long @@ -32,20 +20,7 @@ OpenTelemetry.Metrics.ExponentialHistogramData.PositiveBuckets.get -> OpenTeleme OpenTelemetry.Metrics.ExponentialHistogramData.Scale.get -> int OpenTelemetry.Metrics.ExponentialHistogramData.ZeroCount.get -> long OpenTelemetry.Metrics.MetricType.ExponentialHistogram = 80 -> OpenTelemetry.Metrics.MetricType -OpenTelemetry.Metrics.TraceBasedExemplarFilter -OpenTelemetry.Metrics.TraceBasedExemplarFilter.TraceBasedExemplarFilter() -> void override OpenTelemetry.BaseExportProcessor.ToString() -> string! override OpenTelemetry.BaseProcessor.ToString() -> string! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~OpenTelemetry.Metrics.Exemplar.FilteredTags.get -> System.Collections.Generic.List> -OpenTelemetry.Metrics.MetricPoint.GetExemplars() -> OpenTelemetry.Metrics.Exemplar[]! OpenTelemetry.Metrics.MetricPoint.GetExponentialHistogramData() -> OpenTelemetry.Metrics.ExponentialHistogramData! -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool OpenTelemetry.Resources.ResourceBuilder.AddDetector(System.Func! resourceDetectorFactory) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry/.publicApi/net6.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net6.0/PublicAPI.Unshipped.txt index 846034361b3..36c92a3992d 100644 --- a/src/OpenTelemetry/.publicApi/net6.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net6.0/PublicAPI.Unshipped.txt @@ -2,24 +2,12 @@ OpenTelemetry.Logs.LogRecord.Attributes.get -> System.Collections.Generic.IReadO OpenTelemetry.Logs.LogRecord.Attributes.set -> void OpenTelemetry.Logs.LogRecord.Body.get -> string? OpenTelemetry.Logs.LogRecord.Body.set -> void -OpenTelemetry.Metrics.AlwaysOffExemplarFilter -OpenTelemetry.Metrics.AlwaysOffExemplarFilter.AlwaysOffExemplarFilter() -> void -OpenTelemetry.Metrics.AlwaysOnExemplarFilter -OpenTelemetry.Metrics.AlwaysOnExemplarFilter.AlwaysOnExemplarFilter() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.Base2ExponentialBucketHistogramConfiguration() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.set -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.set -> void -OpenTelemetry.Metrics.Exemplar -OpenTelemetry.Metrics.Exemplar.DoubleValue.get -> double -OpenTelemetry.Metrics.Exemplar.Exemplar() -> void -OpenTelemetry.Metrics.Exemplar.SpanId.get -> System.Diagnostics.ActivitySpanId? -OpenTelemetry.Metrics.Exemplar.Timestamp.get -> System.DateTimeOffset -OpenTelemetry.Metrics.Exemplar.TraceId.get -> System.Diagnostics.ActivityTraceId? -OpenTelemetry.Metrics.ExemplarFilter -OpenTelemetry.Metrics.ExemplarFilter.ExemplarFilter() -> void OpenTelemetry.Metrics.ExponentialHistogramBuckets OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator.Current.get -> long @@ -32,20 +20,7 @@ OpenTelemetry.Metrics.ExponentialHistogramData.PositiveBuckets.get -> OpenTeleme OpenTelemetry.Metrics.ExponentialHistogramData.Scale.get -> int OpenTelemetry.Metrics.ExponentialHistogramData.ZeroCount.get -> long OpenTelemetry.Metrics.MetricType.ExponentialHistogram = 80 -> OpenTelemetry.Metrics.MetricType -OpenTelemetry.Metrics.TraceBasedExemplarFilter -OpenTelemetry.Metrics.TraceBasedExemplarFilter.TraceBasedExemplarFilter() -> void override OpenTelemetry.BaseExportProcessor.ToString() -> string! override OpenTelemetry.BaseProcessor.ToString() -> string! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~OpenTelemetry.Metrics.Exemplar.FilteredTags.get -> System.Collections.Generic.List> -OpenTelemetry.Metrics.MetricPoint.GetExemplars() -> OpenTelemetry.Metrics.Exemplar[]! OpenTelemetry.Metrics.MetricPoint.GetExponentialHistogramData() -> OpenTelemetry.Metrics.ExponentialHistogramData! -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool OpenTelemetry.Resources.ResourceBuilder.AddDetector(System.Func! resourceDetectorFactory) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 846034361b3..36c92a3992d 100644 --- a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -2,24 +2,12 @@ OpenTelemetry.Logs.LogRecord.Attributes.get -> System.Collections.Generic.IReadO OpenTelemetry.Logs.LogRecord.Attributes.set -> void OpenTelemetry.Logs.LogRecord.Body.get -> string? OpenTelemetry.Logs.LogRecord.Body.set -> void -OpenTelemetry.Metrics.AlwaysOffExemplarFilter -OpenTelemetry.Metrics.AlwaysOffExemplarFilter.AlwaysOffExemplarFilter() -> void -OpenTelemetry.Metrics.AlwaysOnExemplarFilter -OpenTelemetry.Metrics.AlwaysOnExemplarFilter.AlwaysOnExemplarFilter() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.Base2ExponentialBucketHistogramConfiguration() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.set -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.set -> void -OpenTelemetry.Metrics.Exemplar -OpenTelemetry.Metrics.Exemplar.DoubleValue.get -> double -OpenTelemetry.Metrics.Exemplar.Exemplar() -> void -OpenTelemetry.Metrics.Exemplar.SpanId.get -> System.Diagnostics.ActivitySpanId? -OpenTelemetry.Metrics.Exemplar.Timestamp.get -> System.DateTimeOffset -OpenTelemetry.Metrics.Exemplar.TraceId.get -> System.Diagnostics.ActivityTraceId? -OpenTelemetry.Metrics.ExemplarFilter -OpenTelemetry.Metrics.ExemplarFilter.ExemplarFilter() -> void OpenTelemetry.Metrics.ExponentialHistogramBuckets OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator.Current.get -> long @@ -32,20 +20,7 @@ OpenTelemetry.Metrics.ExponentialHistogramData.PositiveBuckets.get -> OpenTeleme OpenTelemetry.Metrics.ExponentialHistogramData.Scale.get -> int OpenTelemetry.Metrics.ExponentialHistogramData.ZeroCount.get -> long OpenTelemetry.Metrics.MetricType.ExponentialHistogram = 80 -> OpenTelemetry.Metrics.MetricType -OpenTelemetry.Metrics.TraceBasedExemplarFilter -OpenTelemetry.Metrics.TraceBasedExemplarFilter.TraceBasedExemplarFilter() -> void override OpenTelemetry.BaseExportProcessor.ToString() -> string! override OpenTelemetry.BaseProcessor.ToString() -> string! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~OpenTelemetry.Metrics.Exemplar.FilteredTags.get -> System.Collections.Generic.List> -OpenTelemetry.Metrics.MetricPoint.GetExemplars() -> OpenTelemetry.Metrics.Exemplar[]! OpenTelemetry.Metrics.MetricPoint.GetExponentialHistogramData() -> OpenTelemetry.Metrics.ExponentialHistogramData! -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool OpenTelemetry.Resources.ResourceBuilder.AddDetector(System.Func! resourceDetectorFactory) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry/.publicApi/netstandard2.1/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/netstandard2.1/PublicAPI.Unshipped.txt index 846034361b3..36c92a3992d 100644 --- a/src/OpenTelemetry/.publicApi/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/netstandard2.1/PublicAPI.Unshipped.txt @@ -2,24 +2,12 @@ OpenTelemetry.Logs.LogRecord.Attributes.get -> System.Collections.Generic.IReadO OpenTelemetry.Logs.LogRecord.Attributes.set -> void OpenTelemetry.Logs.LogRecord.Body.get -> string? OpenTelemetry.Logs.LogRecord.Body.set -> void -OpenTelemetry.Metrics.AlwaysOffExemplarFilter -OpenTelemetry.Metrics.AlwaysOffExemplarFilter.AlwaysOffExemplarFilter() -> void -OpenTelemetry.Metrics.AlwaysOnExemplarFilter -OpenTelemetry.Metrics.AlwaysOnExemplarFilter.AlwaysOnExemplarFilter() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.Base2ExponentialBucketHistogramConfiguration() -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.set -> void OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.get -> int OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.set -> void -OpenTelemetry.Metrics.Exemplar -OpenTelemetry.Metrics.Exemplar.DoubleValue.get -> double -OpenTelemetry.Metrics.Exemplar.Exemplar() -> void -OpenTelemetry.Metrics.Exemplar.SpanId.get -> System.Diagnostics.ActivitySpanId? -OpenTelemetry.Metrics.Exemplar.Timestamp.get -> System.DateTimeOffset -OpenTelemetry.Metrics.Exemplar.TraceId.get -> System.Diagnostics.ActivityTraceId? -OpenTelemetry.Metrics.ExemplarFilter -OpenTelemetry.Metrics.ExemplarFilter.ExemplarFilter() -> void OpenTelemetry.Metrics.ExponentialHistogramBuckets OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator.Current.get -> long @@ -32,20 +20,7 @@ OpenTelemetry.Metrics.ExponentialHistogramData.PositiveBuckets.get -> OpenTeleme OpenTelemetry.Metrics.ExponentialHistogramData.Scale.get -> int OpenTelemetry.Metrics.ExponentialHistogramData.ZeroCount.get -> long OpenTelemetry.Metrics.MetricType.ExponentialHistogram = 80 -> OpenTelemetry.Metrics.MetricType -OpenTelemetry.Metrics.TraceBasedExemplarFilter -OpenTelemetry.Metrics.TraceBasedExemplarFilter.TraceBasedExemplarFilter() -> void override OpenTelemetry.BaseExportProcessor.ToString() -> string! override OpenTelemetry.BaseProcessor.ToString() -> string! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~abstract OpenTelemetry.Metrics.ExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~OpenTelemetry.Metrics.Exemplar.FilteredTags.get -> System.Collections.Generic.List> -OpenTelemetry.Metrics.MetricPoint.GetExemplars() -> OpenTelemetry.Metrics.Exemplar[]! OpenTelemetry.Metrics.MetricPoint.GetExponentialHistogramData() -> OpenTelemetry.Metrics.ExponentialHistogramData! -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOffExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(double value, System.ReadOnlySpan> tags) -> bool -~override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(long value, System.ReadOnlySpan> tags) -> bool OpenTelemetry.Resources.ResourceBuilder.AddDetector(System.Func! resourceDetectorFactory) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs index 21763741efe..bd9eb90890a 100644 --- a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs +++ b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs @@ -310,7 +310,7 @@ public static MeterProviderBuilder ConfigureResource(this MeterProviderBuilder m /// . /// ExemplarFilter to use. /// The supplied for chaining. - public static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder meterProviderBuilder, ExemplarFilter exemplarFilter) + internal static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder meterProviderBuilder, ExemplarFilter exemplarFilter) { Guard.ThrowIfNull(exemplarFilter); @@ -325,6 +325,7 @@ public static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder m return meterProviderBuilder; } +#pragma warning disable SA1202 // `public` members should come before `internal` members /// /// Run the given actions to initialize the . /// @@ -339,5 +340,6 @@ public static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder m return null; } +#pragma warning restore SA1202 } } diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs index 2d3f3cab898..dbc4c2a9b26 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs @@ -20,7 +20,7 @@ namespace OpenTelemetry.Metrics; /// An ExemplarFilter which makes no measurements eligible for being an Exemplar. /// Using this ExemplarFilter is as good as disabling Exemplar feature. /// -public sealed class AlwaysOffExemplarFilter : ExemplarFilter +internal sealed class AlwaysOffExemplarFilter : ExemplarFilter { public override bool ShouldSample(long value, ReadOnlySpan> tags) { diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs index 79adb9eeba3..4c13efc64ef 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs @@ -19,7 +19,7 @@ namespace OpenTelemetry.Metrics; /// /// An ExemplarFilter which makes all measurements eligible for being an Exemplar. /// -public sealed class AlwaysOnExemplarFilter : ExemplarFilter +internal sealed class AlwaysOnExemplarFilter : ExemplarFilter { public override bool ShouldSample(long value, ReadOnlySpan> tags) { diff --git a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs index 32f3c2dab2a..6f1a6ed1901 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs @@ -18,10 +18,11 @@ namespace OpenTelemetry.Metrics { +#pragma warning disable SA1623 // The property's documentation summary text should begin with: `Gets or sets` /// /// Represents an Exemplar data. /// - public struct Exemplar + internal struct Exemplar { /// /// Gets the timestamp (UTC). @@ -51,4 +52,5 @@ public struct Exemplar /// public List> FilteredTags { get; internal set; } } +#pragma warning restore SA1623 } diff --git a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs index 9e79570ce77..a41e7dade1b 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs @@ -18,7 +18,7 @@ namespace OpenTelemetry.Metrics; /// /// The base class for defining Exemplar Filter. /// -public abstract class ExemplarFilter +internal abstract class ExemplarFilter { /// /// Determines if a given measurement is eligible for being diff --git a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs index 69c4c29e9f8..ef85d1f8057 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs @@ -22,7 +22,7 @@ namespace OpenTelemetry.Metrics; /// An ExemplarFilter which makes those measurements eligible for being an Exemplar, /// which are recorded in the context of a sampled parent activity (span). /// -public sealed class TraceBasedExemplarFilter : ExemplarFilter +internal sealed class TraceBasedExemplarFilter : ExemplarFilter { public override bool ShouldSample(long value, ReadOnlySpan> tags) { diff --git a/src/OpenTelemetry/Metrics/MetricPoint.cs b/src/OpenTelemetry/Metrics/MetricPoint.cs index f0c3a0b70f0..b8b07501c1e 100644 --- a/src/OpenTelemetry/Metrics/MetricPoint.cs +++ b/src/OpenTelemetry/Metrics/MetricPoint.cs @@ -336,7 +336,7 @@ public bool TryGetHistogramMinMaxValues(out double min, out double max) /// /// . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly Exemplar[] GetExemplars() + internal readonly Exemplar[] GetExemplars() { // TODO: Do not expose Exemplar data structure (array now) return this.mpComponents?.Exemplars ?? Array.Empty(); diff --git a/test/Benchmarks/Metrics/ExemplarBenchmarks.cs b/test/Benchmarks/Metrics/ExemplarBenchmarks.cs index c4355229dc7..ec25fa5e3d3 100644 --- a/test/Benchmarks/Metrics/ExemplarBenchmarks.cs +++ b/test/Benchmarks/Metrics/ExemplarBenchmarks.cs @@ -131,7 +131,7 @@ public void HistogramWithTagReduction() this.histogramWithTagReduction.Record(random.Next(1000), tags); } - public class HighValueExemplarFilter : ExemplarFilter + internal class HighValueExemplarFilter : ExemplarFilter { public override bool ShouldSample(long value, ReadOnlySpan> tags) { diff --git a/test/OpenTelemetry.Tests.Stress.Metrics/Program.cs b/test/OpenTelemetry.Tests.Stress.Metrics/Program.cs index 9dd7a9872fb..6147c2fb247 100644 --- a/test/OpenTelemetry.Tests.Stress.Metrics/Program.cs +++ b/test/OpenTelemetry.Tests.Stress.Metrics/Program.cs @@ -44,7 +44,8 @@ public static void Main() using var meterProvider = Sdk.CreateMeterProviderBuilder() .AddMeter(TestMeter.Name) - .SetExemplarFilter(new AlwaysOnExemplarFilter()) + + // .SetExemplarFilter(new AlwaysOnExemplarFilter()) .AddPrometheusHttpListener( options => options.UriPrefixes = new string[] { $"http://localhost:9185/" }) .Build(); diff --git a/test/OpenTelemetry.Tests/Metrics/MetricTestsBase.cs b/test/OpenTelemetry.Tests/Metrics/MetricTestsBase.cs index 3b3312c3057..181027e37a2 100644 --- a/test/OpenTelemetry.Tests/Metrics/MetricTestsBase.cs +++ b/test/OpenTelemetry.Tests/Metrics/MetricTestsBase.cs @@ -123,7 +123,7 @@ public static void CheckTagsForNthMetricPoint(List metrics, List exemplar.Timestamp != default).ToArray(); }