From 185d62254c144a1b658d618dd257593941946131 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 8 Sep 2023 13:00:12 -0700 Subject: [PATCH] [sdk] Add missing XML comments and nullable decorations for public APIs (#4840) --- .../OpenTelemetry.Api.csproj | 2 - .../net462/PublicAPI.Unshipped.txt | 18 +++---- .../net6.0/PublicAPI.Unshipped.txt | 18 +++---- .../netstandard2.0/PublicAPI.Unshipped.txt | 18 +++---- .../netstandard2.1/PublicAPI.Unshipped.txt | 18 +++---- .../Stable/net462/PublicAPI.Shipped.txt | 44 +++++++-------- .../Stable/net6.0/PublicAPI.Shipped.txt | 44 +++++++-------- .../netstandard2.0/PublicAPI.Shipped.txt | 44 +++++++-------- .../netstandard2.1/PublicAPI.Shipped.txt | 44 +++++++-------- src/OpenTelemetry/BaseExportProcessor.cs | 16 ++++++ .../BatchExportProcessorOptions.cs | 4 ++ src/OpenTelemetry/CompositeProcessor.cs | 13 +++++ .../Metrics/AggregationTemporality.cs | 6 +++ .../Metrics/BaseExportingMetricReader.cs | 9 ++++ .../Builder/MeterProviderBuilderBase.cs | 3 ++ ...AlignedHistogramBucketExemplarReservoir.cs | 14 ++--- .../Exemplar/AlwaysOffExemplarFilter.cs | 8 ++- .../Exemplar/AlwaysOnExemplarFilter.cs | 8 ++- .../Metrics/Exemplar/Exemplar.cs | 4 +- .../Metrics/Exemplar/ExemplarFilter.cs | 7 ++- .../Metrics/Exemplar/ExemplarReservoir.cs | 7 ++- .../Exemplar/SimpleExemplarReservoir.cs | 14 ++--- .../Exemplar/TraceBasedExemplarFilter.cs | 8 ++- .../ExplicitBucketHistogramConfiguration.cs | 6 ++- .../Metrics/ExponentialHistogramBuckets.cs | 21 ++++++-- .../Metrics/ExponentialHistogramData.cs | 27 ++++++++-- src/OpenTelemetry/Metrics/ExportModes.cs | 5 ++ .../Metrics/ExportModesAttribute.cs | 12 +++++ src/OpenTelemetry/Metrics/HistogramBuckets.cs | 36 ++++++++----- .../Metrics/HistogramConfiguration.cs | 5 ++ .../Metrics/IPullMetricExporter.cs | 7 ++- .../Metrics/MeterProviderExtensions.cs | 13 ++++- src/OpenTelemetry/Metrics/Metric.cs | 54 +++++++++++++------ src/OpenTelemetry/Metrics/MetricPoint.cs | 44 +++++++++------ src/OpenTelemetry/Metrics/MetricReader.cs | 28 +++++----- .../Metrics/MetricStreamConfiguration.cs | 12 +++-- .../Metrics/MetricStreamIdentity.cs | 20 +++---- src/OpenTelemetry/Metrics/MetricType.cs | 5 ++ .../Metrics/MetricTypeExtensions.cs | 35 ++++++++++++ .../Metrics/PeriodicExportingMetricReader.cs | 2 + .../PeriodicExportingMetricReaderOptions.cs | 9 ++++ src/OpenTelemetry/OpenTelemetry.csproj | 4 -- src/OpenTelemetry/ReadOnlyTagCollection.cs | 8 +-- .../SuppressInstrumentationScope.cs | 3 ++ .../Trace/BatchActivityExportProcessor.cs | 11 ++++ src/OpenTelemetry/Trace/Sampler.cs | 3 ++ .../Trace/SimpleActivityExportProcessor.cs | 7 +++ 47 files changed, 503 insertions(+), 245 deletions(-) diff --git a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj index 8f99f229bc6..9e79b2e4a20 100644 --- a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj +++ b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj @@ -3,8 +3,6 @@ $(DefaultTargetFrameworks) OpenTelemetry .NET API OpenTelemetry - - $(NoWarn),CS0618 core- diff --git a/src/OpenTelemetry/.publicApi/Experimental/net462/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Experimental/net462/PublicAPI.Unshipped.txt index c274d8400be..862c997fe22 100644 --- a/src/OpenTelemetry/.publicApi/Experimental/net462/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/Experimental/net462/PublicAPI.Unshipped.txt @@ -31,12 +31,12 @@ static OpenTelemetry.Logs.LoggerProviderExtensions.ForceFlush(this OpenTelemetry static OpenTelemetry.Logs.LoggerProviderExtensions.Shutdown(this OpenTelemetry.Logs.LoggerProvider! provider, int timeoutMilliseconds = -1) -> bool static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! static OpenTelemetry.Sdk.CreateLoggerProviderBuilder() -> OpenTelemetry.Logs.LoggerProviderBuilder! -~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> -~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 +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>? +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 diff --git a/src/OpenTelemetry/.publicApi/Experimental/net6.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Experimental/net6.0/PublicAPI.Unshipped.txt index c274d8400be..862c997fe22 100644 --- a/src/OpenTelemetry/.publicApi/Experimental/net6.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/Experimental/net6.0/PublicAPI.Unshipped.txt @@ -31,12 +31,12 @@ static OpenTelemetry.Logs.LoggerProviderExtensions.ForceFlush(this OpenTelemetry static OpenTelemetry.Logs.LoggerProviderExtensions.Shutdown(this OpenTelemetry.Logs.LoggerProvider! provider, int timeoutMilliseconds = -1) -> bool static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! static OpenTelemetry.Sdk.CreateLoggerProviderBuilder() -> OpenTelemetry.Logs.LoggerProviderBuilder! -~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> -~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 +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>? +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 diff --git a/src/OpenTelemetry/.publicApi/Experimental/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Experimental/netstandard2.0/PublicAPI.Unshipped.txt index c274d8400be..862c997fe22 100644 --- a/src/OpenTelemetry/.publicApi/Experimental/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/Experimental/netstandard2.0/PublicAPI.Unshipped.txt @@ -31,12 +31,12 @@ static OpenTelemetry.Logs.LoggerProviderExtensions.ForceFlush(this OpenTelemetry static OpenTelemetry.Logs.LoggerProviderExtensions.Shutdown(this OpenTelemetry.Logs.LoggerProvider! provider, int timeoutMilliseconds = -1) -> bool static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! static OpenTelemetry.Sdk.CreateLoggerProviderBuilder() -> OpenTelemetry.Logs.LoggerProviderBuilder! -~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> -~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 +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>? +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 diff --git a/src/OpenTelemetry/.publicApi/Experimental/netstandard2.1/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Experimental/netstandard2.1/PublicAPI.Unshipped.txt index c274d8400be..862c997fe22 100644 --- a/src/OpenTelemetry/.publicApi/Experimental/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/Experimental/netstandard2.1/PublicAPI.Unshipped.txt @@ -31,12 +31,12 @@ static OpenTelemetry.Logs.LoggerProviderExtensions.ForceFlush(this OpenTelemetry static OpenTelemetry.Logs.LoggerProviderExtensions.Shutdown(this OpenTelemetry.Logs.LoggerProvider! provider, int timeoutMilliseconds = -1) -> bool static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetExemplarFilter(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.ExemplarFilter! exemplarFilter) -> OpenTelemetry.Metrics.MeterProviderBuilder! static OpenTelemetry.Sdk.CreateLoggerProviderBuilder() -> OpenTelemetry.Logs.LoggerProviderBuilder! -~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> -~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 +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>? +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 diff --git a/src/OpenTelemetry/.publicApi/Stable/net462/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/net462/PublicAPI.Shipped.txt index 9493925dfd8..210314bea9b 100644 --- a/src/OpenTelemetry/.publicApi/Stable/net462/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/net462/PublicAPI.Shipped.txt @@ -1,28 +1,28 @@ #nullable enable ~OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator -~OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter exporter) -> void -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[] -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void -~OpenTelemetry.Metrics.Metric.Description.get -> string -~OpenTelemetry.Metrics.Metric.MeterName.get -> string -~OpenTelemetry.Metrics.Metric.MeterVersion.get -> string -~OpenTelemetry.Metrics.Metric.Name.get -> string -~OpenTelemetry.Metrics.Metric.Unit.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string[] -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void -~OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void +OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]? +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void +OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func? +OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void +OpenTelemetry.Metrics.Metric.Description.get -> string! +OpenTelemetry.Metrics.Metric.MeterName.get -> string! +OpenTelemetry.Metrics.Metric.MeterVersion.get -> string! +OpenTelemetry.Metrics.Metric.Name.get -> string! +OpenTelemetry.Metrics.Metric.Unit.get -> string! +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]? +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void +OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void ~override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder! ~override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder! -~readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter -~static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration +readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter! +static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration! abstract OpenTelemetry.BaseExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T! data) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -253,7 +253,7 @@ OpenTelemetry.ProviderExtensions OpenTelemetry.ReadOnlyTagCollection OpenTelemetry.ReadOnlyTagCollection.Count.get -> int OpenTelemetry.ReadOnlyTagCollection.Enumerator -OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair +OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair OpenTelemetry.ReadOnlyTagCollection.Enumerator.Enumerator() -> void OpenTelemetry.ReadOnlyTagCollection.Enumerator.MoveNext() -> bool OpenTelemetry.ReadOnlyTagCollection.GetEnumerator() -> OpenTelemetry.ReadOnlyTagCollection.Enumerator diff --git a/src/OpenTelemetry/.publicApi/Stable/net6.0/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/net6.0/PublicAPI.Shipped.txt index 9493925dfd8..210314bea9b 100644 --- a/src/OpenTelemetry/.publicApi/Stable/net6.0/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/net6.0/PublicAPI.Shipped.txt @@ -1,28 +1,28 @@ #nullable enable ~OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator -~OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter exporter) -> void -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[] -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void -~OpenTelemetry.Metrics.Metric.Description.get -> string -~OpenTelemetry.Metrics.Metric.MeterName.get -> string -~OpenTelemetry.Metrics.Metric.MeterVersion.get -> string -~OpenTelemetry.Metrics.Metric.Name.get -> string -~OpenTelemetry.Metrics.Metric.Unit.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string[] -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void -~OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void +OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]? +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void +OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func? +OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void +OpenTelemetry.Metrics.Metric.Description.get -> string! +OpenTelemetry.Metrics.Metric.MeterName.get -> string! +OpenTelemetry.Metrics.Metric.MeterVersion.get -> string! +OpenTelemetry.Metrics.Metric.Name.get -> string! +OpenTelemetry.Metrics.Metric.Unit.get -> string! +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]? +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void +OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void ~override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder! ~override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder! -~readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter -~static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration +readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter! +static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration! abstract OpenTelemetry.BaseExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T! data) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -253,7 +253,7 @@ OpenTelemetry.ProviderExtensions OpenTelemetry.ReadOnlyTagCollection OpenTelemetry.ReadOnlyTagCollection.Count.get -> int OpenTelemetry.ReadOnlyTagCollection.Enumerator -OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair +OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair OpenTelemetry.ReadOnlyTagCollection.Enumerator.Enumerator() -> void OpenTelemetry.ReadOnlyTagCollection.Enumerator.MoveNext() -> bool OpenTelemetry.ReadOnlyTagCollection.GetEnumerator() -> OpenTelemetry.ReadOnlyTagCollection.Enumerator diff --git a/src/OpenTelemetry/.publicApi/Stable/netstandard2.0/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/netstandard2.0/PublicAPI.Shipped.txt index 9493925dfd8..210314bea9b 100644 --- a/src/OpenTelemetry/.publicApi/Stable/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/netstandard2.0/PublicAPI.Shipped.txt @@ -1,28 +1,28 @@ #nullable enable ~OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator -~OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter exporter) -> void -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[] -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void -~OpenTelemetry.Metrics.Metric.Description.get -> string -~OpenTelemetry.Metrics.Metric.MeterName.get -> string -~OpenTelemetry.Metrics.Metric.MeterVersion.get -> string -~OpenTelemetry.Metrics.Metric.Name.get -> string -~OpenTelemetry.Metrics.Metric.Unit.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string[] -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void -~OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void +OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]? +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void +OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func? +OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void +OpenTelemetry.Metrics.Metric.Description.get -> string! +OpenTelemetry.Metrics.Metric.MeterName.get -> string! +OpenTelemetry.Metrics.Metric.MeterVersion.get -> string! +OpenTelemetry.Metrics.Metric.Name.get -> string! +OpenTelemetry.Metrics.Metric.Unit.get -> string! +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]? +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void +OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void ~override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder! ~override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder! -~readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter -~static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration +readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter! +static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration! abstract OpenTelemetry.BaseExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T! data) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -253,7 +253,7 @@ OpenTelemetry.ProviderExtensions OpenTelemetry.ReadOnlyTagCollection OpenTelemetry.ReadOnlyTagCollection.Count.get -> int OpenTelemetry.ReadOnlyTagCollection.Enumerator -OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair +OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair OpenTelemetry.ReadOnlyTagCollection.Enumerator.Enumerator() -> void OpenTelemetry.ReadOnlyTagCollection.Enumerator.MoveNext() -> bool OpenTelemetry.ReadOnlyTagCollection.GetEnumerator() -> OpenTelemetry.ReadOnlyTagCollection.Enumerator diff --git a/src/OpenTelemetry/.publicApi/Stable/netstandard2.1/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/netstandard2.1/PublicAPI.Shipped.txt index 9493925dfd8..210314bea9b 100644 --- a/src/OpenTelemetry/.publicApi/Stable/netstandard2.1/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry/.publicApi/Stable/netstandard2.1/PublicAPI.Shipped.txt @@ -1,28 +1,28 @@ #nullable enable ~OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator -~OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter exporter) -> void -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[] -~OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func -~OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void -~OpenTelemetry.Metrics.Metric.Description.get -> string -~OpenTelemetry.Metrics.Metric.MeterName.get -> string -~OpenTelemetry.Metrics.Metric.MeterVersion.get -> string -~OpenTelemetry.Metrics.Metric.Name.get -> string -~OpenTelemetry.Metrics.Metric.Unit.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string -~OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string[] -~OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void -~OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void +OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]? +OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void +OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func? +OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void +OpenTelemetry.Metrics.Metric.Description.get -> string! +OpenTelemetry.Metrics.Metric.MeterName.get -> string! +OpenTelemetry.Metrics.Metric.MeterVersion.get -> string! +OpenTelemetry.Metrics.Metric.Name.get -> string! +OpenTelemetry.Metrics.Metric.Unit.get -> string! +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string? +OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]? +OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void +OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void ~override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder! ~override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder! -~readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter -~static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider provider, int timeoutMilliseconds = -1) -> bool -~static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration +readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter! +static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool +static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration! abstract OpenTelemetry.BaseExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T! data) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -253,7 +253,7 @@ OpenTelemetry.ProviderExtensions OpenTelemetry.ReadOnlyTagCollection OpenTelemetry.ReadOnlyTagCollection.Count.get -> int OpenTelemetry.ReadOnlyTagCollection.Enumerator -OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair +OpenTelemetry.ReadOnlyTagCollection.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair OpenTelemetry.ReadOnlyTagCollection.Enumerator.Enumerator() -> void OpenTelemetry.ReadOnlyTagCollection.Enumerator.MoveNext() -> bool OpenTelemetry.ReadOnlyTagCollection.GetEnumerator() -> OpenTelemetry.ReadOnlyTagCollection.Enumerator diff --git a/src/OpenTelemetry/BaseExportProcessor.cs b/src/OpenTelemetry/BaseExportProcessor.cs index 4d2f11e758a..fe42f3987c5 100644 --- a/src/OpenTelemetry/BaseExportProcessor.cs +++ b/src/OpenTelemetry/BaseExportProcessor.cs @@ -47,7 +47,11 @@ public enum ExportProcessorType public abstract class BaseExportProcessor : BaseProcessor where T : class { + /// + /// Gets the exporter used by the processor. + /// protected readonly BaseExporter exporter; + private readonly string friendlyTypeName; private bool disposed; @@ -74,6 +78,7 @@ public sealed override void OnStart(T data) { } + /// public override void OnEnd(T data) { this.OnExport(data); @@ -86,6 +91,17 @@ internal override void SetParentProvider(BaseProvider parentProvider) this.exporter.ParentProvider = parentProvider; } + /// + /// Called synchronously when a telemetry object is exported. + /// + /// + /// The exported telemetry object. + /// + /// + /// This function is called synchronously on the thread which ended + /// the telemetry object. This function should be thread-safe, and + /// should not block indefinitely or throw exceptions. + /// protected abstract void OnExport(T data); /// diff --git a/src/OpenTelemetry/BatchExportProcessorOptions.cs b/src/OpenTelemetry/BatchExportProcessorOptions.cs index c096ac7c113..9b92a9107a6 100644 --- a/src/OpenTelemetry/BatchExportProcessorOptions.cs +++ b/src/OpenTelemetry/BatchExportProcessorOptions.cs @@ -18,6 +18,10 @@ namespace OpenTelemetry; +/// +/// Contains batch export processor options. +/// +/// The type of telemetry object to be exported. public class BatchExportProcessorOptions where T : class { diff --git a/src/OpenTelemetry/CompositeProcessor.cs b/src/OpenTelemetry/CompositeProcessor.cs index 0d94e8df1fe..fb314c6f7ec 100644 --- a/src/OpenTelemetry/CompositeProcessor.cs +++ b/src/OpenTelemetry/CompositeProcessor.cs @@ -21,12 +21,20 @@ namespace OpenTelemetry; +/// +/// Represents a chain of s. +/// +/// The type of object to be processed. public class CompositeProcessor : BaseProcessor { internal readonly DoublyLinkedListNode Head; private DoublyLinkedListNode tail; private bool disposed; + /// + /// Initializes a new instance of the class. + /// + /// Processors to add to the composite processor chain. public CompositeProcessor(IEnumerable> processors) { Guard.ThrowIfNull(processors); @@ -46,6 +54,11 @@ public CompositeProcessor(IEnumerable> processors) } } + /// + /// Adds a processor to the composite processor chain. + /// + /// . + /// The current instance to support call chaining. public CompositeProcessor AddProcessor(BaseProcessor processor) { Guard.ThrowIfNull(processor); diff --git a/src/OpenTelemetry/Metrics/AggregationTemporality.cs b/src/OpenTelemetry/Metrics/AggregationTemporality.cs index e7af80b2a95..0bbd4a5f749 100644 --- a/src/OpenTelemetry/Metrics/AggregationTemporality.cs +++ b/src/OpenTelemetry/Metrics/AggregationTemporality.cs @@ -14,8 +14,14 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; +/// +/// Enumeration used to define the aggregation temporality for a . +/// public enum AggregationTemporality : byte { /// diff --git a/src/OpenTelemetry/Metrics/BaseExportingMetricReader.cs b/src/OpenTelemetry/Metrics/BaseExportingMetricReader.cs index e8c2e2d4d47..1ed668d1843 100644 --- a/src/OpenTelemetry/Metrics/BaseExportingMetricReader.cs +++ b/src/OpenTelemetry/Metrics/BaseExportingMetricReader.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; using OpenTelemetry.Internal; @@ -25,7 +27,11 @@ namespace OpenTelemetry.Metrics; /// public class BaseExportingMetricReader : MetricReader { + /// + /// Gets the exporter used by the metric reader. + /// protected readonly BaseExporter exporter; + private readonly ExportModes supportedExportModes = ExportModes.Push | ExportModes.Pull; private readonly string exportCalledMessage; private readonly string exportSucceededMessage; @@ -75,6 +81,9 @@ public BaseExportingMetricReader(BaseExporter exporter) internal BaseExporter Exporter => this.exporter; + /// + /// Gets the supported . + /// protected ExportModes SupportedExportModes => this.supportedExportModes; internal override void SetParentProvider(BaseProvider parentProvider) diff --git a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderBase.cs b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderBase.cs index 4994eae7286..bae9b3e9ee3 100644 --- a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderBase.cs +++ b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderBase.cs @@ -30,6 +30,9 @@ public class MeterProviderBuilderBase : MeterProviderBuilder, IMeterProviderBuil private readonly bool allowBuild; private readonly MeterProviderServiceCollectionBuilder innerBuilder; + /// + /// Initializes a new instance of the class. + /// public MeterProviderBuilderBase() { var services = new ServiceCollection(); diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlignedHistogramBucketExemplarReservoir.cs b/src/OpenTelemetry/Metrics/Exemplar/AlignedHistogramBucketExemplarReservoir.cs index 73090ce9949..9dabf73820f 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/AlignedHistogramBucketExemplarReservoir.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/AlignedHistogramBucketExemplarReservoir.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; namespace OpenTelemetry.Metrics; @@ -23,23 +25,21 @@ namespace OpenTelemetry.Metrics; /// internal sealed class AlignedHistogramBucketExemplarReservoir : ExemplarReservoir { - private readonly int length; private readonly Exemplar[] runningExemplars; private readonly Exemplar[] tempExemplars; public AlignedHistogramBucketExemplarReservoir(int length) { - this.length = length; this.runningExemplars = new Exemplar[length + 1]; this.tempExemplars = new Exemplar[length + 1]; } - public override void Offer(long value, ReadOnlySpan> tags, int index = default) + public override void Offer(long value, ReadOnlySpan> tags, int index = default) { this.OfferAtBoundary(value, tags, index); } - public override void Offer(double value, ReadOnlySpan> tags, int index = default) + public override void Offer(double value, ReadOnlySpan> tags, int index = default) { this.OfferAtBoundary(value, tags, index); } @@ -59,7 +59,7 @@ public override Exemplar[] Collect(ReadOnlyTagCollection actualTags, bool reset) // TODO: The cost is paid irrespective of whether the // Exporter supports Exemplar or not. One idea is to // defer this until first exporter attempts read. - this.tempExemplars[i].FilteredTags = this.runningExemplars[i].FilteredTags.Except(actualTags.KeyAndValues.ToList()).ToList(); + this.tempExemplars[i].FilteredTags = this.runningExemplars[i].FilteredTags!.Except(actualTags.KeyAndValues.ToList()).ToList(); } if (reset) @@ -71,7 +71,7 @@ public override Exemplar[] Collect(ReadOnlyTagCollection actualTags, bool reset) return this.tempExemplars; } - private void OfferAtBoundary(double value, ReadOnlySpan> tags, int index) + private void OfferAtBoundary(double value, ReadOnlySpan> tags, int index) { ref var exemplar = ref this.runningExemplars[index]; exemplar.Timestamp = DateTimeOffset.UtcNow; @@ -91,7 +91,7 @@ private void OfferAtBoundary(double value, ReadOnlySpan>(tags.Length); + exemplar.FilteredTags = new List>(tags.Length); } else { diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs index 88077a2b100..7c0cba8be88 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; #if EXPOSE_EXPERIMENTAL_FEATURES @@ -32,12 +34,14 @@ namespace OpenTelemetry.Metrics; #endif sealed class AlwaysOffExemplarFilter : ExemplarFilter { - public override bool ShouldSample(long value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(long value, ReadOnlySpan> tags) { return false; } - public override bool ShouldSample(double value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(double value, ReadOnlySpan> tags) { return false; } diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs index 45886c2f35c..6dd1dd20eb1 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; #if EXPOSE_EXPERIMENTAL_FEATURES @@ -30,12 +32,14 @@ namespace OpenTelemetry.Metrics; #endif sealed class AlwaysOnExemplarFilter : ExemplarFilter { - public override bool ShouldSample(long value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(long value, ReadOnlySpan> tags) { return true; } - public override bool ShouldSample(double value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(double value, ReadOnlySpan> tags) { return true; } diff --git a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs index 7e5352c0bc3..772f4764d51 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; namespace OpenTelemetry.Metrics; @@ -59,6 +61,6 @@ struct Exemplar /// /// Gets the FilteredTags (i.e any tags that were dropped during aggregation). /// - public List> FilteredTags { get; internal set; } + public List>? FilteredTags { get; internal set; } } diff --git a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs index b6739989a93..a3cec80acf4 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs @@ -13,6 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // + +#nullable enable + namespace OpenTelemetry.Metrics; #if EXPOSE_EXPERIMENTAL_FEATURES @@ -45,7 +48,7 @@ abstract class ExemplarFilter /// false to indicate this measurement is not eligible to become Exemplar /// and will not be given to the ExemplarReservoir. /// - public abstract bool ShouldSample(long value, ReadOnlySpan> tags); + public abstract bool ShouldSample(long value, ReadOnlySpan> tags); /// /// Determines if a given measurement is eligible for being @@ -63,5 +66,5 @@ abstract class ExemplarFilter /// false to indicate this measurement is not eligible to become Exemplar /// and will not be given to the ExemplarReservoir. /// - public abstract bool ShouldSample(double value, ReadOnlySpan> tags); + public abstract bool ShouldSample(double value, ReadOnlySpan> tags); } diff --git a/src/OpenTelemetry/Metrics/Exemplar/ExemplarReservoir.cs b/src/OpenTelemetry/Metrics/Exemplar/ExemplarReservoir.cs index 59b530e9d56..504190e623c 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/ExemplarReservoir.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/ExemplarReservoir.cs @@ -13,6 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // + +#nullable enable + namespace OpenTelemetry.Metrics; /// @@ -27,7 +30,7 @@ internal abstract class ExemplarReservoir /// The complete set of tags provided with the measurement. /// The histogram bucket index where this measurement is going to be stored. /// This is optional and is only relevant for Histogram with buckets. - public abstract void Offer(long value, ReadOnlySpan> tags, int index = default); + public abstract void Offer(long value, ReadOnlySpan> tags, int index = default); /// /// Offers measurement to the reservoir. @@ -36,7 +39,7 @@ internal abstract class ExemplarReservoir /// The complete set of tags provided with the measurement. /// The histogram bucket index where this measurement is going to be stored. /// This is optional and is only relevant for Histogram with buckets. - public abstract void Offer(double value, ReadOnlySpan> tags, int index = default); + public abstract void Offer(double value, ReadOnlySpan> tags, int index = default); /// /// Collects all the exemplars accumulated by the Reservoir. diff --git a/src/OpenTelemetry/Metrics/Exemplar/SimpleExemplarReservoir.cs b/src/OpenTelemetry/Metrics/Exemplar/SimpleExemplarReservoir.cs index c42efee38be..ff78cc25294 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/SimpleExemplarReservoir.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/SimpleExemplarReservoir.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; namespace OpenTelemetry.Metrics; @@ -39,12 +41,12 @@ public SimpleExemplarReservoir(int poolSize) this.random = new Random(); } - public override void Offer(long value, ReadOnlySpan> tags, int index = default) + public override void Offer(long value, ReadOnlySpan> tags, int index = default) { this.Offer(value, tags); } - public override void Offer(double value, ReadOnlySpan> tags, int index = default) + public override void Offer(double value, ReadOnlySpan> tags, int index = default) { this.Offer(value, tags); } @@ -64,7 +66,7 @@ public override Exemplar[] Collect(ReadOnlyTagCollection actualTags, bool reset) // TODO: The cost is paid irrespective of whether the // Exporter supports Exemplar or not. One idea is to // defer this until first exporter attempts read. - this.tempExemplars[i].FilteredTags = this.runningExemplars[i].FilteredTags.Except(actualTags.KeyAndValues.ToList()).ToList(); + this.tempExemplars[i].FilteredTags = this.runningExemplars[i].FilteredTags!.Except(actualTags.KeyAndValues.ToList()).ToList(); } if (reset) @@ -77,7 +79,7 @@ public override Exemplar[] Collect(ReadOnlyTagCollection actualTags, bool reset) return this.tempExemplars; } - private void Offer(double value, ReadOnlySpan> tags) + private void Offer(double value, ReadOnlySpan> tags) { if (this.measurementsSeen < this.poolSize) { @@ -112,7 +114,7 @@ private void Offer(double value, ReadOnlySpan> tags this.measurementsSeen++; } - private void StoreTags(ref Exemplar exemplar, ReadOnlySpan> tags) + private void StoreTags(ref Exemplar exemplar, ReadOnlySpan> tags) { if (tags == default) { @@ -126,7 +128,7 @@ private void StoreTags(ref Exemplar exemplar, ReadOnlySpan>(tags.Length); + exemplar.FilteredTags = new List>(tags.Length); } else { diff --git a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs index 41db4a22e06..ee0353447ba 100644 --- a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs +++ b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; namespace OpenTelemetry.Metrics; @@ -34,12 +36,14 @@ namespace OpenTelemetry.Metrics; #endif sealed class TraceBasedExemplarFilter : ExemplarFilter { - public override bool ShouldSample(long value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(long value, ReadOnlySpan> tags) { return Activity.Current?.Recorded ?? false; } - public override bool ShouldSample(double value, ReadOnlySpan> tags) + /// + public override bool ShouldSample(double value, ReadOnlySpan> tags) { return Activity.Current?.Recorded ?? false; } diff --git a/src/OpenTelemetry/Metrics/ExplicitBucketHistogramConfiguration.cs b/src/OpenTelemetry/Metrics/ExplicitBucketHistogramConfiguration.cs index 931921bdeca..32022390881 100644 --- a/src/OpenTelemetry/Metrics/ExplicitBucketHistogramConfiguration.cs +++ b/src/OpenTelemetry/Metrics/ExplicitBucketHistogramConfiguration.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; /// @@ -36,7 +38,7 @@ public class ExplicitBucketHistogramConfiguration : HistogramConfiguration /// /// Note: A copy is made of the provided array. /// - public double[] Boundaries + public double[]? Boundaries { get { @@ -70,7 +72,7 @@ public double[] Boundaries } } - internal double[] CopiedBoundaries { get; private set; } + internal double[]? CopiedBoundaries { get; private set; } private static bool IsSortedAndDistinct(double[] values) { diff --git a/src/OpenTelemetry/Metrics/ExponentialHistogramBuckets.cs b/src/OpenTelemetry/Metrics/ExponentialHistogramBuckets.cs index 84db5a4a0bf..02f42f6c63d 100644 --- a/src/OpenTelemetry/Metrics/ExponentialHistogramBuckets.cs +++ b/src/OpenTelemetry/Metrics/ExponentialHistogramBuckets.cs @@ -18,6 +18,10 @@ namespace OpenTelemetry.Metrics; +/// +/// Contains the buckets of an exponential histogram. +/// +// Note: Does not implement IEnumerable<> to prevent accidental boxing. public sealed class ExponentialHistogramBuckets { private long[] buckets = Array.Empty(); @@ -27,8 +31,15 @@ internal ExponentialHistogramBuckets() { } + /// + /// Gets the exponential histogram offset. + /// public int Offset { get; private set; } + /// + /// Returns an enumerator that iterates through the . + /// + /// . public Enumerator GetEnumerator() => new(this.buckets, this.size); internal void SnapshotBuckets(CircularBufferBuckets buckets) @@ -45,10 +56,12 @@ internal void SnapshotBuckets(CircularBufferBuckets buckets) internal ExponentialHistogramBuckets Copy() { - var copy = new ExponentialHistogramBuckets(); - copy.size = this.size; - copy.Offset = this.Offset; - copy.buckets = new long[this.buckets.Length]; + var copy = new ExponentialHistogramBuckets + { + size = this.size, + Offset = this.Offset, + buckets = new long[this.buckets.Length], + }; Array.Copy(this.buckets, copy.buckets, this.buckets.Length); return copy; } diff --git a/src/OpenTelemetry/Metrics/ExponentialHistogramData.cs b/src/OpenTelemetry/Metrics/ExponentialHistogramData.cs index 2cae22cb512..f181dc556cc 100644 --- a/src/OpenTelemetry/Metrics/ExponentialHistogramData.cs +++ b/src/OpenTelemetry/Metrics/ExponentialHistogramData.cs @@ -18,6 +18,9 @@ namespace OpenTelemetry.Metrics; +/// +/// Contains the data for an exponential histogram. +/// public sealed class ExponentialHistogramData { internal ExponentialHistogramData() @@ -26,21 +29,35 @@ internal ExponentialHistogramData() this.NegativeBuckets = new(); } + /// + /// Gets the exponential histogram scale. + /// public int Scale { get; internal set; } + /// + /// Gets the exponential histogram zero count. + /// public long ZeroCount { get; internal set; } + /// + /// Gets the exponential histogram positive buckets. + /// public ExponentialHistogramBuckets PositiveBuckets { get; private set; } + /// + /// Gets the exponential histogram negative buckets. + /// internal ExponentialHistogramBuckets NegativeBuckets { get; private set; } internal ExponentialHistogramData Copy() { - var copy = new ExponentialHistogramData(); - copy.Scale = this.Scale; - copy.ZeroCount = this.ZeroCount; - copy.PositiveBuckets = this.PositiveBuckets.Copy(); - copy.NegativeBuckets = this.NegativeBuckets.Copy(); + var copy = new ExponentialHistogramData + { + Scale = this.Scale, + ZeroCount = this.ZeroCount, + PositiveBuckets = this.PositiveBuckets.Copy(), + NegativeBuckets = this.NegativeBuckets.Copy(), + }; return copy; } } diff --git a/src/OpenTelemetry/Metrics/ExportModes.cs b/src/OpenTelemetry/Metrics/ExportModes.cs index a6d92ea8a54..06010dd3f12 100644 --- a/src/OpenTelemetry/Metrics/ExportModes.cs +++ b/src/OpenTelemetry/Metrics/ExportModes.cs @@ -14,8 +14,13 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; +/// +/// Describes the mode of a metric exporter. +/// [Flags] public enum ExportModes : byte { diff --git a/src/OpenTelemetry/Metrics/ExportModesAttribute.cs b/src/OpenTelemetry/Metrics/ExportModesAttribute.cs index 91e5321bb9c..7c5738d2b27 100644 --- a/src/OpenTelemetry/Metrics/ExportModesAttribute.cs +++ b/src/OpenTelemetry/Metrics/ExportModesAttribute.cs @@ -14,17 +14,29 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; +/// +/// An attribute for declaring the supported of a metric exporter. +/// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class ExportModesAttribute : Attribute { private readonly ExportModes supportedExportModes; + /// + /// Initializes a new instance of the class. + /// + /// . public ExportModesAttribute(ExportModes supported) { this.supportedExportModes = supported; } + /// + /// Gets the supported . + /// public ExportModes Supported => this.supportedExportModes; } diff --git a/src/OpenTelemetry/Metrics/HistogramBuckets.cs b/src/OpenTelemetry/Metrics/HistogramBuckets.cs index f0ac32c5db9..9289aa95b74 100644 --- a/src/OpenTelemetry/Metrics/HistogramBuckets.cs +++ b/src/OpenTelemetry/Metrics/HistogramBuckets.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; using System.Runtime.CompilerServices; @@ -27,9 +29,9 @@ public class HistogramBuckets { internal const int DefaultBoundaryCountForBinarySearch = 50; - internal readonly double[] ExplicitBounds; + internal readonly double[]? ExplicitBounds; - internal readonly long[] RunningBucketCounts; + internal readonly long[]? RunningBucketCounts; internal readonly long[] SnapshotBucketCounts; internal double RunningSum; @@ -43,20 +45,20 @@ public class HistogramBuckets internal int IsCriticalSectionOccupied = 0; - private readonly BucketLookupNode bucketLookupTreeRoot; + private readonly BucketLookupNode? bucketLookupTreeRoot; private readonly Func findHistogramBucketIndex; - internal HistogramBuckets(double[] explicitBounds) + internal HistogramBuckets(double[]? explicitBounds) { this.ExplicitBounds = explicitBounds; this.findHistogramBucketIndex = this.FindBucketIndexLinear; if (explicitBounds != null && explicitBounds.Length >= DefaultBoundaryCountForBinarySearch) { - this.bucketLookupTreeRoot = ConstructBalancedBST(explicitBounds, 0, explicitBounds.Length); + this.bucketLookupTreeRoot = ConstructBalancedBST(explicitBounds, 0, explicitBounds.Length)!; this.findHistogramBucketIndex = this.FindBucketIndexBinary; - static BucketLookupNode ConstructBalancedBST(double[] values, int min, int max) + static BucketLookupNode? ConstructBalancedBST(double[] values, int min, int max) { if (min == max) { @@ -79,6 +81,10 @@ static BucketLookupNode ConstructBalancedBST(double[] values, int min, int max) this.SnapshotBucketCounts = explicitBounds != null ? new long[explicitBounds.Length + 1] : new long[0]; } + /// + /// Returns an enumerator that iterates through the . + /// + /// . public Enumerator GetEnumerator() => new(this); internal HistogramBuckets Copy() @@ -102,13 +108,13 @@ internal int FindBucketIndex(double value) [MethodImpl(MethodImplOptions.AggressiveInlining)] internal int FindBucketIndexBinary(double value) { - BucketLookupNode current = this.bucketLookupTreeRoot; + BucketLookupNode? current = this.bucketLookupTreeRoot; Debug.Assert(current != null, "Bucket root was null."); do { - if (value <= current.LowerBoundExclusive) + if (value <= current!.LowerBoundExclusive) { current = current.Left; } @@ -123,14 +129,18 @@ internal int FindBucketIndexBinary(double value) } while (current != null); - return this.ExplicitBounds.Length; + Debug.Assert(this.ExplicitBounds != null, "ExplicitBounds was null."); + + return this.ExplicitBounds!.Length; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal int FindBucketIndexLinear(double value) { + Debug.Assert(this.ExplicitBounds != null, "ExplicitBounds was null."); + int i; - for (i = 0; i < this.ExplicitBounds.Length; i++) + for (i = 0; i < this.ExplicitBounds!.Length; i++) { // Upper bound is inclusive if (value <= this.ExplicitBounds[i]) @@ -178,7 +188,7 @@ public bool MoveNext() if (this.index < this.numberOfBuckets) { double explicitBound = this.index < this.numberOfBuckets - 1 - ? this.histogramMeasurements.ExplicitBounds[this.index] + ? this.histogramMeasurements.ExplicitBounds![this.index] : double.PositiveInfinity; long bucketCount = this.histogramMeasurements.SnapshotBucketCounts[this.index]; this.Current = new HistogramBucket(explicitBound, bucketCount); @@ -198,8 +208,8 @@ private sealed class BucketLookupNode public int Index { get; set; } - public BucketLookupNode Left { get; set; } + public BucketLookupNode? Left { get; set; } - public BucketLookupNode Right { get; set; } + public BucketLookupNode? Right { get; set; } } } diff --git a/src/OpenTelemetry/Metrics/HistogramConfiguration.cs b/src/OpenTelemetry/Metrics/HistogramConfiguration.cs index 37980098937..39b184ce41f 100644 --- a/src/OpenTelemetry/Metrics/HistogramConfiguration.cs +++ b/src/OpenTelemetry/Metrics/HistogramConfiguration.cs @@ -14,8 +14,13 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; +/// +/// Stores configuration for a histogram MetricStream. +/// public class HistogramConfiguration : MetricStreamConfiguration { /// diff --git a/src/OpenTelemetry/Metrics/IPullMetricExporter.cs b/src/OpenTelemetry/Metrics/IPullMetricExporter.cs index 897b0166672..7394968a832 100644 --- a/src/OpenTelemetry/Metrics/IPullMetricExporter.cs +++ b/src/OpenTelemetry/Metrics/IPullMetricExporter.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; /// @@ -21,5 +23,8 @@ namespace OpenTelemetry.Metrics; /// public interface IPullMetricExporter { - Func Collect { get; set; } + /// + /// Gets or sets the Collect delegate. + /// + Func? Collect { get; set; } } diff --git a/src/OpenTelemetry/Metrics/MeterProviderExtensions.cs b/src/OpenTelemetry/Metrics/MeterProviderExtensions.cs index 18e1f32e28d..73b8b8ebd2b 100644 --- a/src/OpenTelemetry/Metrics/MeterProviderExtensions.cs +++ b/src/OpenTelemetry/Metrics/MeterProviderExtensions.cs @@ -14,10 +14,16 @@ // limitations under the License. // +#nullable enable + +using System.Diagnostics.CodeAnalysis; using OpenTelemetry.Internal; namespace OpenTelemetry.Metrics; +/// +/// Contains extension methods for the class. +/// public static class MeterProviderExtensions { /// @@ -111,7 +117,10 @@ public static bool Shutdown(this MeterProvider provider, int timeoutMilliseconds /// The MeterProvider from which Exporter should be found. /// The exporter instance. /// true if the exporter of specified Type is found; otherwise false. - internal static bool TryFindExporter(this MeterProvider provider, out T exporter) + internal static bool TryFindExporter( + this MeterProvider provider, + [NotNullWhen(true)] + out T? exporter) where T : BaseExporter { if (provider is MeterProviderSdk meterProviderSdk) @@ -122,7 +131,7 @@ internal static bool TryFindExporter(this MeterProvider provider, out T expor exporter = null; return false; - static bool TryFindExporter(MetricReader reader, out T exporter) + static bool TryFindExporter(MetricReader? reader, out T? exporter) { if (reader is BaseExportingMetricReader exportingMetricReader) { diff --git a/src/OpenTelemetry/Metrics/Metric.cs b/src/OpenTelemetry/Metrics/Metric.cs index 8c1d819476a..1f01b39f2ee 100644 --- a/src/OpenTelemetry/Metrics/Metric.cs +++ b/src/OpenTelemetry/Metrics/Metric.cs @@ -14,12 +14,14 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics.Metrics; namespace OpenTelemetry.Metrics; /// -/// Represents a Metric stream which can contain multiple MetricPoints. +/// Represents a metric stream which can contain multiple metric points. /// public sealed class Metric { @@ -52,7 +54,7 @@ internal Metric( AggregationTemporality temporality, int maxMetricPointsPerMetricStream, bool emitOverflowAttribute, - ExemplarFilter exemplarFilter = null) + ExemplarFilter? exemplarFilter = null) { this.InstrumentIdentity = instrumentIdentity; @@ -163,41 +165,61 @@ internal Metric( this.InstrumentDisposed = false; } + /// + /// Gets the for the metric stream. + /// public MetricType MetricType { get; private set; } + /// + /// Gets the for the metric stream. + /// public AggregationTemporality Temporality { get; private set; } + /// + /// Gets the name for the metric stream. + /// public string Name => this.InstrumentIdentity.InstrumentName; + /// + /// Gets the description for the metric stream. + /// public string Description => this.InstrumentIdentity.Description; + /// + /// Gets the unit for the metric stream. + /// public string Unit => this.InstrumentIdentity.Unit; + /// + /// Gets the meter name for the metric stream. + /// public string MeterName => this.InstrumentIdentity.MeterName; + /// + /// Gets the meter version for the metric stream. + /// public string MeterVersion => this.InstrumentIdentity.MeterVersion; + /// + /// Gets the for the metric stream. + /// internal MetricStreamIdentity InstrumentIdentity { get; private set; } internal bool InstrumentDisposed { get; set; } + /// + /// Get the metric points for the metric stream. + /// + /// . public MetricPointsAccessor GetMetricPoints() - { - return this.aggStore.GetMetricPoints(); - } + => this.aggStore.GetMetricPoints(); - internal void UpdateLong(long value, ReadOnlySpan> tags) - { - this.aggStore.Update(value, tags); - } + internal void UpdateLong(long value, ReadOnlySpan> tags) + => this.aggStore.Update(value, tags); - internal void UpdateDouble(double value, ReadOnlySpan> tags) - { - this.aggStore.Update(value, tags); - } + internal void UpdateDouble(double value, ReadOnlySpan> tags) + => this.aggStore.Update(value, tags); internal int Snapshot() - { - return this.aggStore.Snapshot(); - } + => this.aggStore.Snapshot(); } diff --git a/src/OpenTelemetry/Metrics/MetricPoint.cs b/src/OpenTelemetry/Metrics/MetricPoint.cs index 2105f8e2f61..262884b81e7 100644 --- a/src/OpenTelemetry/Metrics/MetricPoint.cs +++ b/src/OpenTelemetry/Metrics/MetricPoint.cs @@ -45,7 +45,7 @@ public struct MetricPoint internal MetricPoint( AggregatorStore aggregatorStore, AggregationType aggType, - KeyValuePair[] tagKeysAndValues, + KeyValuePair[] tagKeysAndValues, double[] histogramExplicitBounds, int exponentialHistogramMaxSize, int exponentialHistogramMaxScale) @@ -304,7 +304,7 @@ public ExponentialHistogramData GetExponentialHistogramData() /// The histogram maximum value. /// True if minimum and maximum value exist, false otherwise. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryGetHistogramMinMaxValues(out double min, out double max) + public readonly bool TryGetHistogramMinMaxValues(out double min, out double max) { if (this.aggType == AggregationType.HistogramWithMinMax || this.aggType == AggregationType.HistogramWithMinMaxBuckets) @@ -432,7 +432,7 @@ internal void Update(long number) this.MetricPointStatus = MetricPointStatus.CollectPending; } - internal void UpdateWithExemplar(long number, ReadOnlySpan> tags, bool isSampled) + internal void UpdateWithExemplar(long number, ReadOnlySpan> tags, bool isSampled) { switch (this.aggType) { @@ -629,7 +629,7 @@ internal void Update(double number) this.MetricPointStatus = MetricPointStatus.CollectPending; } - internal void UpdateWithExemplar(double number, ReadOnlySpan> tags, bool isSampled) + internal void UpdateWithExemplar(double number, ReadOnlySpan> tags, bool isSampled) { switch (this.aggType) { @@ -855,7 +855,9 @@ internal void TakeSnapshot(bool outputDelta) histogramBuckets.RunningSum = 0; } - for (int i = 0; i < histogramBuckets.RunningBucketCounts.Length; i++) + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + + for (int i = 0; i < histogramBuckets.RunningBucketCounts!.Length; i++) { histogramBuckets.SnapshotBucketCounts[i] = histogramBuckets.RunningBucketCounts[i]; if (outputDelta) @@ -913,7 +915,9 @@ internal void TakeSnapshot(bool outputDelta) histogramBuckets.RunningMax = double.NegativeInfinity; } - for (int i = 0; i < histogramBuckets.RunningBucketCounts.Length; i++) + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + + for (int i = 0; i < histogramBuckets.RunningBucketCounts!.Length; i++) { histogramBuckets.SnapshotBucketCounts[i] = histogramBuckets.RunningBucketCounts[i]; if (outputDelta) @@ -1103,7 +1107,9 @@ internal void TakeSnapshotWithExemplar(bool outputDelta) histogramBuckets.RunningSum = 0; } - for (int i = 0; i < histogramBuckets.RunningBucketCounts.Length; i++) + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + + for (int i = 0; i < histogramBuckets.RunningBucketCounts!.Length; i++) { histogramBuckets.SnapshotBucketCounts[i] = histogramBuckets.RunningBucketCounts[i]; if (outputDelta) @@ -1163,7 +1169,9 @@ internal void TakeSnapshotWithExemplar(bool outputDelta) histogramBuckets.RunningMax = double.NegativeInfinity; } - for (int i = 0; i < histogramBuckets.RunningBucketCounts.Length; i++) + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + + for (int i = 0; i < histogramBuckets.RunningBucketCounts!.Length; i++) { histogramBuckets.SnapshotBucketCounts[i] = histogramBuckets.RunningBucketCounts[i]; if (outputDelta) @@ -1275,7 +1283,7 @@ private static void ReleaseLock(ref int isCriticalSectionOccupied) Interlocked.Exchange(ref isCriticalSectionOccupied, 0); } - private void UpdateHistogram(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateHistogram(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) { var histogramBuckets = this.mpComponents!.HistogramBuckets; @@ -1297,7 +1305,7 @@ private void UpdateHistogram(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateHistogramWithMinMax(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) { var histogramBuckets = this.mpComponents!.HistogramBuckets; @@ -1321,18 +1329,20 @@ private void UpdateHistogramWithMinMax(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateHistogramWithBuckets(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) { var histogramBuckets = this.mpComponents!.HistogramBuckets; int i = histogramBuckets.FindBucketIndex(number); + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + AcquireLock(ref histogramBuckets.IsCriticalSectionOccupied); unchecked { this.runningValue.AsLong++; histogramBuckets.RunningSum += number; - histogramBuckets.RunningBucketCounts[i]++; + histogramBuckets.RunningBucketCounts![i]++; if (reportExemplar) { // TODO: Need to ensure that the lock is always released. @@ -1344,18 +1354,20 @@ private void UpdateHistogramWithBuckets(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateHistogramWithBucketsAndMinMax(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) { var histogramBuckets = this.mpComponents!.HistogramBuckets; int i = histogramBuckets.FindBucketIndex(number); AcquireLock(ref histogramBuckets.IsCriticalSectionOccupied); + Debug.Assert(histogramBuckets.RunningBucketCounts != null, "histogramBuckets.RunningBucketCounts was null"); + unchecked { this.runningValue.AsLong++; histogramBuckets.RunningSum += number; - histogramBuckets.RunningBucketCounts[i]++; + histogramBuckets.RunningBucketCounts![i]++; if (reportExemplar) { // TODO: Need to ensure that the lock is always released. @@ -1371,7 +1383,7 @@ private void UpdateHistogramWithBucketsAndMinMax(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateBase2ExponentialHistogram(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) #pragma warning restore IDE0060 // Remove unused parameter { if (number < 0) @@ -1394,7 +1406,7 @@ private void UpdateBase2ExponentialHistogram(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) + private void UpdateBase2ExponentialHistogramWithMinMax(double number, ReadOnlySpan> tags = default, bool reportExemplar = false) #pragma warning restore IDE0060 // Remove unused parameter { if (number < 0) diff --git a/src/OpenTelemetry/Metrics/MetricReader.cs b/src/OpenTelemetry/Metrics/MetricReader.cs index 43ce7300b16..783b11d7018 100644 --- a/src/OpenTelemetry/Metrics/MetricReader.cs +++ b/src/OpenTelemetry/Metrics/MetricReader.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; using System.Diagnostics.Metrics; using OpenTelemetry.Internal; @@ -27,10 +29,10 @@ public abstract partial class MetricReader : IDisposable { private const MetricReaderTemporalityPreference MetricReaderTemporalityPreferenceUnspecified = (MetricReaderTemporalityPreference)0; - private static Func cumulativeTemporalityPreferenceFunc = + private static readonly Func CumulativeTemporalityPreferenceFunc = (instrumentType) => AggregationTemporality.Cumulative; - private static Func monotonicDeltaTemporalityPreferenceFunc = (instrumentType) => + private static readonly Func MonotonicDeltaTemporalityPreferenceFunc = (instrumentType) => { return instrumentType.GetGenericTypeDefinition() switch { @@ -53,11 +55,14 @@ public abstract partial class MetricReader : IDisposable private readonly object onCollectLock = new(); private readonly TaskCompletionSource shutdownTcs = new(); private MetricReaderTemporalityPreference temporalityPreference = MetricReaderTemporalityPreferenceUnspecified; - private Func temporalityFunc = cumulativeTemporalityPreferenceFunc; + private Func temporalityFunc = CumulativeTemporalityPreferenceFunc; private int shutdownCount; - private TaskCompletionSource collectionTcs; - private BaseProvider parentProvider; + private TaskCompletionSource? collectionTcs; + private BaseProvider? parentProvider; + /// + /// Gets or sets the metric reader temporality preference. + /// public MetricReaderTemporalityPreference TemporalityPreference { get @@ -78,16 +83,11 @@ public MetricReaderTemporalityPreference TemporalityPreference } this.temporalityPreference = value; - switch (value) + this.temporalityFunc = value switch { - case MetricReaderTemporalityPreference.Delta: - this.temporalityFunc = monotonicDeltaTemporalityPreferenceFunc; - break; - case MetricReaderTemporalityPreference.Cumulative: - default: - this.temporalityFunc = cumulativeTemporalityPreferenceFunc; - break; - } + MetricReaderTemporalityPreference.Delta => MonotonicDeltaTemporalityPreferenceFunc, + _ => CumulativeTemporalityPreferenceFunc, + }; } } diff --git a/src/OpenTelemetry/Metrics/MetricStreamConfiguration.cs b/src/OpenTelemetry/Metrics/MetricStreamConfiguration.cs index 301f562475b..2b7840ad820 100644 --- a/src/OpenTelemetry/Metrics/MetricStreamConfiguration.cs +++ b/src/OpenTelemetry/Metrics/MetricStreamConfiguration.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; /// @@ -21,7 +23,7 @@ namespace OpenTelemetry.Metrics; /// public class MetricStreamConfiguration { - private string name; + private string? name; /// /// Gets the drop configuration. @@ -38,7 +40,7 @@ public class MetricStreamConfiguration /// /// Note: If not provided the instrument name will be used. /// - public string Name + public string? Name { get => this.name; set @@ -58,7 +60,7 @@ public string Name /// /// Note: If not provided the instrument description will be used. /// - public string Description { get; set; } + public string? Description { get; set; } /// /// Gets or sets the optional tag keys to include in the metric stream. @@ -75,7 +77,7 @@ public string Name /// A copy is made of the provided array. /// /// - public string[] TagKeys + public string[]? TagKeys { get { @@ -104,7 +106,7 @@ public string[] TagKeys } } - internal string[] CopiedTagKeys { get; private set; } + internal string[]? CopiedTagKeys { get; private set; } internal int? ViewId { get; set; } diff --git a/src/OpenTelemetry/Metrics/MetricStreamIdentity.cs b/src/OpenTelemetry/Metrics/MetricStreamIdentity.cs index 8da8615ea60..31523a2e0b8 100644 --- a/src/OpenTelemetry/Metrics/MetricStreamIdentity.cs +++ b/src/OpenTelemetry/Metrics/MetricStreamIdentity.cs @@ -14,16 +14,18 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics.Metrics; namespace OpenTelemetry.Metrics; internal readonly struct MetricStreamIdentity : IEquatable { - private static readonly StringArrayEqualityComparer StringArrayComparer = new StringArrayEqualityComparer(); + private static readonly StringArrayEqualityComparer StringArrayComparer = new(); private readonly int hashCode; - public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration metricStreamConfiguration) + public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration? metricStreamConfiguration) { this.MeterName = instrument.Meter.Name; this.MeterVersion = instrument.Meter.Version ?? string.Empty; @@ -72,8 +74,8 @@ public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration met hash = (hash * 31) + this.HistogramRecordMinMax.GetHashCode(); hash = (hash * 31) + this.ExponentialHistogramMaxSize.GetHashCode(); hash = (hash * 31) + this.ExponentialHistogramMaxScale.GetHashCode(); - hash = (hash * 31) + (this.Unit?.GetHashCode() ?? 0); - hash = (hash * 31) + (this.Description?.GetHashCode() ?? 0); + hash = (hash * 31) + this.Unit.GetHashCode(); + hash = (hash * 31) + this.Description.GetHashCode(); hash = (hash * 31) + (this.ViewId ?? 0); hash = (hash * 31) + (this.TagKeys != null ? StringArrayComparer.GetHashCode(this.TagKeys) : 0); if (this.HistogramBucketBounds != null) @@ -106,9 +108,9 @@ public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration met public string MetricStreamName { get; } - public string[] TagKeys { get; } + public string[]? TagKeys { get; } - public double[] HistogramBucketBounds { get; } + public double[]? HistogramBucketBounds { get; } public int ExponentialHistogramMaxSize { get; } @@ -120,7 +122,7 @@ public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration met public static bool operator !=(MetricStreamIdentity metricIdentity1, MetricStreamIdentity metricIdentity2) => !metricIdentity1.Equals(metricIdentity2); - public readonly override bool Equals(object obj) + public override readonly bool Equals(object? obj) { return obj is MetricStreamIdentity other && this.Equals(other); } @@ -141,9 +143,9 @@ public bool Equals(MetricStreamIdentity other) && HistogramBoundsEqual(this.HistogramBucketBounds, other.HistogramBucketBounds); } - public readonly override int GetHashCode() => this.hashCode; + public override readonly int GetHashCode() => this.hashCode; - private static bool HistogramBoundsEqual(double[] bounds1, double[] bounds2) + private static bool HistogramBoundsEqual(double[]? bounds1, double[]? bounds2) { if (ReferenceEquals(bounds1, bounds2)) { diff --git a/src/OpenTelemetry/Metrics/MetricType.cs b/src/OpenTelemetry/Metrics/MetricType.cs index 41dbbc1ac39..c1f4422d583 100644 --- a/src/OpenTelemetry/Metrics/MetricType.cs +++ b/src/OpenTelemetry/Metrics/MetricType.cs @@ -14,8 +14,13 @@ // limitations under the License. // +#nullable enable + namespace OpenTelemetry.Metrics; +/// +/// Enumeration used to define the type of a . +/// [Flags] public enum MetricType : byte { diff --git a/src/OpenTelemetry/Metrics/MetricTypeExtensions.cs b/src/OpenTelemetry/Metrics/MetricTypeExtensions.cs index 665ccd5ee78..238294e03d2 100644 --- a/src/OpenTelemetry/Metrics/MetricTypeExtensions.cs +++ b/src/OpenTelemetry/Metrics/MetricTypeExtensions.cs @@ -14,10 +14,15 @@ // limitations under the License. // +#nullable enable + using System.Runtime.CompilerServices; namespace OpenTelemetry.Metrics; +/// +/// Contains extension methods for performing common operations against the class. +/// public static class MetricTypeExtensions { #pragma warning disable SA1310 // field should not contain an underscore @@ -45,6 +50,12 @@ public static class MetricTypeExtensions #pragma warning restore SA1310 // field should not contain an underscore + /// + /// Determines if the supplied is a sum definition. + /// + /// . + /// if the supplied + /// is a sum definition. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsSum(this MetricType self) { @@ -52,24 +63,48 @@ public static bool IsSum(this MetricType self) return type == METRIC_TYPE_MONOTONIC_SUM || type == METRIC_TYPE_NON_MONOTONIC_SUM; } + /// + /// Determines if the supplied is a gauge definition. + /// + /// . + /// if the supplied + /// is a gauge definition. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsGauge(this MetricType self) { return (self & METRIC_TYPE_MASK) == METRIC_TYPE_GAUGE; } + /// + /// Determines if the supplied is a histogram definition. + /// + /// . + /// if the supplied + /// is a histogram definition. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsHistogram(this MetricType self) { return self.HasFlag(METRIC_TYPE_HISTOGRAM); } + /// + /// Determines if the supplied is a double definition. + /// + /// . + /// if the supplied + /// is a double definition. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsDouble(this MetricType self) { return (self & POINT_KIND_MASK) == POINT_KIND_R8; } + /// + /// Determines if the supplied is a long definition. + /// + /// . + /// if the supplied + /// is a long definition. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsLong(this MetricType self) { diff --git a/src/OpenTelemetry/Metrics/PeriodicExportingMetricReader.cs b/src/OpenTelemetry/Metrics/PeriodicExportingMetricReader.cs index 89a36372023..eb95aed58aa 100644 --- a/src/OpenTelemetry/Metrics/PeriodicExportingMetricReader.cs +++ b/src/OpenTelemetry/Metrics/PeriodicExportingMetricReader.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#nullable enable + using System.Diagnostics; using OpenTelemetry.Internal; diff --git a/src/OpenTelemetry/Metrics/PeriodicExportingMetricReaderOptions.cs b/src/OpenTelemetry/Metrics/PeriodicExportingMetricReaderOptions.cs index 58d15a8f621..a84cf0fdb6a 100644 --- a/src/OpenTelemetry/Metrics/PeriodicExportingMetricReaderOptions.cs +++ b/src/OpenTelemetry/Metrics/PeriodicExportingMetricReaderOptions.cs @@ -14,11 +14,20 @@ // limitations under the License. // +#nullable enable + using Microsoft.Extensions.Configuration; using OpenTelemetry.Internal; namespace OpenTelemetry.Metrics; +/// +/// Contains periodic metric reader options. +/// +/// +/// Note: OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT environment +/// variables are parsed during object construction. +/// public class PeriodicExportingMetricReaderOptions { internal const string OTelMetricExportIntervalEnvVarKey = "OTEL_METRIC_EXPORT_INTERVAL"; diff --git a/src/OpenTelemetry/OpenTelemetry.csproj b/src/OpenTelemetry/OpenTelemetry.csproj index 37c4ba254ef..33136b0376f 100644 --- a/src/OpenTelemetry/OpenTelemetry.csproj +++ b/src/OpenTelemetry/OpenTelemetry.csproj @@ -2,10 +2,6 @@ $(DefaultTargetFrameworks);netstandard2.1 OpenTelemetry .NET SDK - - $(NoWarn),1591,CS0618 core- diff --git a/src/OpenTelemetry/ReadOnlyTagCollection.cs b/src/OpenTelemetry/ReadOnlyTagCollection.cs index 9826afb9c25..f66e2bb165e 100644 --- a/src/OpenTelemetry/ReadOnlyTagCollection.cs +++ b/src/OpenTelemetry/ReadOnlyTagCollection.cs @@ -25,11 +25,11 @@ namespace OpenTelemetry; // prevent accidental boxing. public readonly struct ReadOnlyTagCollection { - internal readonly KeyValuePair[] KeyAndValues; + internal readonly KeyValuePair[] KeyAndValues; - internal ReadOnlyTagCollection(KeyValuePair[]? keyAndValues) + internal ReadOnlyTagCollection(KeyValuePair[]? keyAndValues) { - this.KeyAndValues = keyAndValues ?? Array.Empty>(); + this.KeyAndValues = keyAndValues ?? Array.Empty>(); } /// @@ -62,7 +62,7 @@ internal Enumerator(ReadOnlyTagCollection source) /// /// Gets the tag at the current position of the enumerator. /// - public KeyValuePair Current { get; private set; } + public KeyValuePair Current { get; private set; } /// /// Advances the enumerator to the next element of the +/// Contains methods managing instrumentation of internal operations. +/// public sealed class SuppressInstrumentationScope : IDisposable { // An integer value which controls whether instrumentation should be suppressed (disabled). diff --git a/src/OpenTelemetry/Trace/BatchActivityExportProcessor.cs b/src/OpenTelemetry/Trace/BatchActivityExportProcessor.cs index ef8ed97f8a7..e2587003b70 100644 --- a/src/OpenTelemetry/Trace/BatchActivityExportProcessor.cs +++ b/src/OpenTelemetry/Trace/BatchActivityExportProcessor.cs @@ -20,8 +20,19 @@ namespace OpenTelemetry; +/// +/// Implements processor that batches objects before calling exporter. +/// public class BatchActivityExportProcessor : BatchExportProcessor { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// public BatchActivityExportProcessor( BaseExporter exporter, int maxQueueSize = DefaultMaxQueueSize, diff --git a/src/OpenTelemetry/Trace/Sampler.cs b/src/OpenTelemetry/Trace/Sampler.cs index b196440f580..1431836a2f7 100644 --- a/src/OpenTelemetry/Trace/Sampler.cs +++ b/src/OpenTelemetry/Trace/Sampler.cs @@ -25,6 +25,9 @@ namespace OpenTelemetry.Trace; /// public abstract class Sampler { + /// + /// Initializes a new instance of the class. + /// protected Sampler() { this.Description = this.GetType().Name; diff --git a/src/OpenTelemetry/Trace/SimpleActivityExportProcessor.cs b/src/OpenTelemetry/Trace/SimpleActivityExportProcessor.cs index 8037280525f..21382428075 100644 --- a/src/OpenTelemetry/Trace/SimpleActivityExportProcessor.cs +++ b/src/OpenTelemetry/Trace/SimpleActivityExportProcessor.cs @@ -20,8 +20,15 @@ namespace OpenTelemetry; +/// +/// Implements processor that exports objects at each OnEnd call. +/// public class SimpleActivityExportProcessor : SimpleExportProcessor { + /// + /// Initializes a new instance of the class. + /// + /// . public SimpleActivityExportProcessor(BaseExporter exporter) : base(exporter) {