From 2785ffbbaa5487d54e4f3cefe1821fc18af86550 Mon Sep 17 00:00:00 2001 From: Eddy Nakamura Date: Tue, 24 Nov 2020 14:45:36 -0300 Subject: [PATCH] Metrics are obsolete (#1611) * Metrics are obsolete * updating changelog * updating changelog --- examples/Console/Examples.Console.csproj | 1 + src/OpenTelemetry.Api/CHANGELOG.md | 6 ++++++ src/OpenTelemetry.Api/Metrics/BlankLabelSet.cs | 3 +++ src/OpenTelemetry.Api/Metrics/BoundCounterMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/BoundMeasureMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/CounterMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/DoubleObserverMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/DoubleObserverMetricHandle.cs | 3 +++ src/OpenTelemetry.Api/Metrics/Int64ObserverMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/Int64ObserverMetricHandle.cs | 3 +++ src/OpenTelemetry.Api/Metrics/LabelSet.cs | 3 +++ src/OpenTelemetry.Api/Metrics/MeasureMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/Meter.cs | 1 + src/OpenTelemetry.Api/Metrics/MeterFactoryBase.cs | 1 + src/OpenTelemetry.Api/Metrics/MeterProvider.cs | 1 + src/OpenTelemetry.Api/Metrics/NoopBoundCounterMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/NoopBoundMeasureMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/NoopCounterMetric.cs | 2 ++ src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetric.cs | 2 ++ .../Metrics/NoopDoubleObserverMetricHandle.cs | 3 +++ src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetric.cs | 2 ++ .../Metrics/NoopInt64ObserverMetricHandle.cs | 3 +++ src/OpenTelemetry.Api/Metrics/NoopMeasureMetric.cs | 2 ++ src/OpenTelemetry.Api/OpenTelemetry.Api.csproj | 2 ++ .../OpenTelemetry.Exporter.Prometheus.csproj | 1 + src/OpenTelemetry/CHANGELOG.md | 6 ++++++ src/OpenTelemetry/Metrics/Aggregators/Aggregator.cs | 1 + .../Metrics/Aggregators/DoubleCounterSumAggregator.cs | 1 + .../Metrics/Aggregators/DoubleLastValueAggregator.cs | 1 + .../Aggregators/DoubleMeasureMinMaxSumCountAggregator.cs | 1 + .../Metrics/Aggregators/Int64CounterSumAggregator.cs | 1 + .../Metrics/Aggregators/Int64LastValueAggregator.cs | 1 + .../Aggregators/Int64MeasureMinMaxSumCountAggregator.cs | 1 + src/OpenTelemetry/Metrics/BoundCounterMetricSdkBase.cs | 2 ++ src/OpenTelemetry/Metrics/Export/AggregationType.cs | 3 +++ src/OpenTelemetry/Metrics/Export/DoubleSumData.cs | 3 +++ src/OpenTelemetry/Metrics/Export/DoubleSummaryData.cs | 3 +++ src/OpenTelemetry/Metrics/Export/Int64SumData.cs | 3 +++ src/OpenTelemetry/Metrics/Export/Int64SummaryData.cs | 3 +++ src/OpenTelemetry/Metrics/Export/Metric.cs | 2 ++ src/OpenTelemetry/Metrics/Export/MetricData.cs | 1 + src/OpenTelemetry/Metrics/Export/MetricExporter.cs | 2 ++ src/OpenTelemetry/Metrics/Export/MetricProcessor.cs | 2 ++ src/OpenTelemetry/Metrics/Export/UngroupedBatcher.cs | 2 ++ src/OpenTelemetry/Metrics/MeterProviderBuilder.cs | 1 + src/OpenTelemetry/OpenTelemetry.csproj | 2 +- .../OpenTelemetry.Exporter.Prometheus.Tests.csproj | 1 + test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj | 1 + 48 files changed, 98 insertions(+), 1 deletion(-) diff --git a/examples/Console/Examples.Console.csproj b/examples/Console/Examples.Console.csproj index 26662ab86ea..68f89702451 100644 --- a/examples/Console/Examples.Console.csproj +++ b/examples/Console/Examples.Console.csproj @@ -4,6 +4,7 @@ Exe netcoreapp3.1 false + $(NoWarn),CS0618 diff --git a/src/OpenTelemetry.Api/CHANGELOG.md b/src/OpenTelemetry.Api/CHANGELOG.md index 4a489ec7fbd..011b1ab7231 100644 --- a/src/OpenTelemetry.Api/CHANGELOG.md +++ b/src/OpenTelemetry.Api/CHANGELOG.md @@ -8,6 +8,12 @@ extension) will now be set as the `Unset`, `Error`, or `Ok` string representation instead of the `0`, `1`, or `2` integer representation. ([#1579](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1579)) +* Metrics API/SDK support is in an experimental state and is not recommended for + production use. All metric APIs have been marked with the `Obsolete` + attribute. See + [#1501](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501) + for more information. + ([#1611](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1611)) ## 1.0.0-rc1.1 diff --git a/src/OpenTelemetry.Api/Metrics/BlankLabelSet.cs b/src/OpenTelemetry.Api/Metrics/BlankLabelSet.cs index 2cdc7afe59b..70f9482cdd8 100644 --- a/src/OpenTelemetry.Api/Metrics/BlankLabelSet.cs +++ b/src/OpenTelemetry.Api/Metrics/BlankLabelSet.cs @@ -14,11 +14,14 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics { /// /// Blank or No-op labelset. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class BlankLabelSet : LabelSet { } diff --git a/src/OpenTelemetry.Api/Metrics/BoundCounterMetric.cs b/src/OpenTelemetry.Api/Metrics/BoundCounterMetric.cs index 878f70797a6..5c62de07e91 100644 --- a/src/OpenTelemetry.Api/Metrics/BoundCounterMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/BoundCounterMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using OpenTelemetry.Trace; namespace OpenTelemetry.Metrics @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics /// Bound counter metric with the defined . /// /// The type of counter. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class BoundCounterMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/BoundMeasureMetric.cs b/src/OpenTelemetry.Api/Metrics/BoundMeasureMetric.cs index 8ab3768f26b..69163a56267 100644 --- a/src/OpenTelemetry.Api/Metrics/BoundMeasureMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/BoundMeasureMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using OpenTelemetry.Trace; namespace OpenTelemetry.Metrics @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics /// Bound measure metric with the defined . /// /// The type of Measure. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class BoundMeasureMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/CounterMetric.cs b/src/OpenTelemetry.Api/Metrics/CounterMetric.cs index 06f169021f6..46ce9a703c3 100644 --- a/src/OpenTelemetry.Api/Metrics/CounterMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/CounterMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using OpenTelemetry.Trace; @@ -23,6 +24,7 @@ namespace OpenTelemetry.Metrics /// Counter instrument. /// /// The type of counter. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class CounterMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/DoubleObserverMetric.cs b/src/OpenTelemetry.Api/Metrics/DoubleObserverMetric.cs index 1166b1addec..bb75b9eeded 100644 --- a/src/OpenTelemetry.Api/Metrics/DoubleObserverMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/DoubleObserverMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics /// /// Observer instrument for Double values. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class DoubleObserverMetric { /// diff --git a/src/OpenTelemetry.Api/Metrics/DoubleObserverMetricHandle.cs b/src/OpenTelemetry.Api/Metrics/DoubleObserverMetricHandle.cs index 835d44f2176..ec214d4d646 100644 --- a/src/OpenTelemetry.Api/Metrics/DoubleObserverMetricHandle.cs +++ b/src/OpenTelemetry.Api/Metrics/DoubleObserverMetricHandle.cs @@ -14,11 +14,14 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics { /// /// Handle to the metrics observer with the defined . /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class DoubleObserverMetricHandle { /// diff --git a/src/OpenTelemetry.Api/Metrics/Int64ObserverMetric.cs b/src/OpenTelemetry.Api/Metrics/Int64ObserverMetric.cs index 4a437a5c01c..6f6c00f5d74 100644 --- a/src/OpenTelemetry.Api/Metrics/Int64ObserverMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/Int64ObserverMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics /// /// Observer instrument for Int64 values. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class Int64ObserverMetric { /// diff --git a/src/OpenTelemetry.Api/Metrics/Int64ObserverMetricHandle.cs b/src/OpenTelemetry.Api/Metrics/Int64ObserverMetricHandle.cs index b85a4ed3882..40e6ccb60b1 100644 --- a/src/OpenTelemetry.Api/Metrics/Int64ObserverMetricHandle.cs +++ b/src/OpenTelemetry.Api/Metrics/Int64ObserverMetricHandle.cs @@ -14,11 +14,14 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics { /// /// Handle to the metrics observer with the defined . /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class Int64ObserverMetricHandle { /// diff --git a/src/OpenTelemetry.Api/Metrics/LabelSet.cs b/src/OpenTelemetry.Api/Metrics/LabelSet.cs index 9c71f944e5b..ea785a905f8 100644 --- a/src/OpenTelemetry.Api/Metrics/LabelSet.cs +++ b/src/OpenTelemetry.Api/Metrics/LabelSet.cs @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. // + +using System; using System.Collections.Generic; using System.Linq; @@ -21,6 +23,7 @@ namespace OpenTelemetry.Metrics /// /// Normalized name value pairs of metric labels. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class LabelSet { /// diff --git a/src/OpenTelemetry.Api/Metrics/MeasureMetric.cs b/src/OpenTelemetry.Api/Metrics/MeasureMetric.cs index 173b21f3191..a00245ac90f 100644 --- a/src/OpenTelemetry.Api/Metrics/MeasureMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/MeasureMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using OpenTelemetry.Trace; @@ -23,6 +24,7 @@ namespace OpenTelemetry.Metrics /// Measure instrument. /// /// The type of measure. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class MeasureMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/Meter.cs b/src/OpenTelemetry.Api/Metrics/Meter.cs index 70bf0f97b01..9bac322408a 100644 --- a/src/OpenTelemetry.Api/Metrics/Meter.cs +++ b/src/OpenTelemetry.Api/Metrics/Meter.cs @@ -22,6 +22,7 @@ namespace OpenTelemetry.Metrics /// /// Main interface to obtain metric instruments. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class Meter { /// diff --git a/src/OpenTelemetry.Api/Metrics/MeterFactoryBase.cs b/src/OpenTelemetry.Api/Metrics/MeterFactoryBase.cs index 963cbb6f106..2967b747c90 100644 --- a/src/OpenTelemetry.Api/Metrics/MeterFactoryBase.cs +++ b/src/OpenTelemetry.Api/Metrics/MeterFactoryBase.cs @@ -22,6 +22,7 @@ namespace OpenTelemetry.Metrics /// Libraries should use this class as follows to obtain Meter instance. /// MeterFactoryBase.Default.GetMeter("libraryname", "version"). /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class MeterFactoryBase { private static ProxyMeter proxyMeter = new ProxyMeter(); diff --git a/src/OpenTelemetry.Api/Metrics/MeterProvider.cs b/src/OpenTelemetry.Api/Metrics/MeterProvider.cs index 6b574aef1a1..402f35572b2 100644 --- a/src/OpenTelemetry.Api/Metrics/MeterProvider.cs +++ b/src/OpenTelemetry.Api/Metrics/MeterProvider.cs @@ -21,6 +21,7 @@ namespace OpenTelemetry.Metrics /// /// MeterProvider is the entry point of the OpenTelemetry Metrics API. It provides access to Meters. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class MeterProvider : BaseProvider { private static ProxyMeter proxyMeter = new ProxyMeter(); diff --git a/src/OpenTelemetry.Api/Metrics/NoopBoundCounterMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopBoundCounterMetric.cs index acda009c1d7..fb93e223d57 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopBoundCounterMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopBoundCounterMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using OpenTelemetry.Trace; namespace OpenTelemetry.Metrics @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics /// No-Op bound counter metric. /// /// The type of counter. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopBoundCounterMetric : BoundCounterMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/NoopBoundMeasureMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopBoundMeasureMetric.cs index bb8d928e4db..ef73f02ec84 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopBoundMeasureMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopBoundMeasureMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using OpenTelemetry.Trace; namespace OpenTelemetry.Metrics @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics /// No op measure handle. /// /// The type of Measure. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopBoundMeasureMetric : BoundMeasureMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/NoopCounterMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopCounterMetric.cs index 70d4bd4849a..b1c028d9f78 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopCounterMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopCounterMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using OpenTelemetry.Trace; @@ -23,6 +24,7 @@ namespace OpenTelemetry.Metrics /// A no-op counter instrument. /// /// The type of counter. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopCounterMetric : CounterMetric where T : struct { diff --git a/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetric.cs index 5c0246dd4e3..c77b89b1443 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics /// /// A no-op observer instrument. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopDoubleObserverMetric : DoubleObserverMetric { /// diff --git a/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetricHandle.cs b/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetricHandle.cs index 6dfbaa20c76..e049d5e87f6 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetricHandle.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopDoubleObserverMetricHandle.cs @@ -14,11 +14,14 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics { /// /// No-Op observer handle. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopDoubleObserverMetricHandle : DoubleObserverMetricHandle { /// diff --git a/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetric.cs index 10a4a12cb3f..771ce2c36c3 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics /// /// A no-op observer instrument. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopInt64ObserverMetric : Int64ObserverMetric { /// diff --git a/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetricHandle.cs b/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetricHandle.cs index afe16a24ab9..db779d45262 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetricHandle.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopInt64ObserverMetricHandle.cs @@ -14,11 +14,14 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics { /// /// No-Op observer handle. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopInt64ObserverMetricHandle : Int64ObserverMetricHandle { /// diff --git a/src/OpenTelemetry.Api/Metrics/NoopMeasureMetric.cs b/src/OpenTelemetry.Api/Metrics/NoopMeasureMetric.cs index e935a01e08f..9cd6f2deb6d 100644 --- a/src/OpenTelemetry.Api/Metrics/NoopMeasureMetric.cs +++ b/src/OpenTelemetry.Api/Metrics/NoopMeasureMetric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics /// No op measure instrument. /// /// The type of counter. Only long and double are supported now. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public sealed class NoopMeasureMetric : MeasureMetric where T : struct { diff --git a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj index dfb0a8b517e..96c5b788b3e 100644 --- a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj +++ b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj @@ -3,6 +3,8 @@ net452;netstandard2.0 OpenTelemetry .NET API OpenTelemetry + + $(NoWarn),CS0618 diff --git a/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj b/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj index 3594e71662f..6f95eae17a9 100644 --- a/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj +++ b/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj @@ -3,6 +3,7 @@ net452;net46;netstandard2.0 Prometheus exporter for OpenTelemetry .NET $(PackageTags);Prometheus + $(NoWarn),CS0618 diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index fa8db9e703e..5bc3778c4a9 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -7,6 +7,12 @@ `AddEnvironmentVariableDetector`, `AddAttributes`, `AddService`, and `AddTelemetrySdk`. ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) +* Metrics API/SDK support is in an experimental state and is not recommended for + production use. All metric APIs have been marked with the `Obsolete` + attribute. See + [#1501](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501) + for more information. + ([#1611](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1611)) ## 1.0.0-rc1.1 diff --git a/src/OpenTelemetry/Metrics/Aggregators/Aggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/Aggregator.cs index 43d91734116..3b98c407bb2 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/Aggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/Aggregator.cs @@ -24,6 +24,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// Aggregator base class. /// /// The type. + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class Aggregator where T : struct { diff --git a/src/OpenTelemetry/Metrics/Aggregators/DoubleCounterSumAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/DoubleCounterSumAggregator.cs index e00f74eeb9f..3b5e934da3b 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/DoubleCounterSumAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/DoubleCounterSumAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Basic aggregator which calculates a Sum from individual measurements. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class DoubleCounterSumAggregator : Aggregator { private double sum; diff --git a/src/OpenTelemetry/Metrics/Aggregators/DoubleLastValueAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/DoubleLastValueAggregator.cs index 5b9d54f4a67..87d49b6b7e2 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/DoubleLastValueAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/DoubleLastValueAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Simple aggregator that only keeps the last value. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class DoubleLastValueAggregator : Aggregator { private double value; diff --git a/src/OpenTelemetry/Metrics/Aggregators/DoubleMeasureMinMaxSumCountAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/DoubleMeasureMinMaxSumCountAggregator.cs index bf31691749f..e85af0c8d71 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/DoubleMeasureMinMaxSumCountAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/DoubleMeasureMinMaxSumCountAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Aggregator which calculates summary (Min,Max,Sum,Count) from measures. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class DoubleMeasureMinMaxSumCountAggregator : Aggregator { private DoubleSummary summary = new DoubleSummary(); diff --git a/src/OpenTelemetry/Metrics/Aggregators/Int64CounterSumAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/Int64CounterSumAggregator.cs index cccdeab4b79..9577c49283e 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/Int64CounterSumAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/Int64CounterSumAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Basic aggregator which calculates a Sum from individual measurements. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Int64CounterSumAggregator : Aggregator { private long sum; diff --git a/src/OpenTelemetry/Metrics/Aggregators/Int64LastValueAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/Int64LastValueAggregator.cs index 8061be8a469..617cba7edf1 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/Int64LastValueAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/Int64LastValueAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Simple aggregator that only keeps the last value. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Int64LastValueAggregator : Aggregator { private long value; diff --git a/src/OpenTelemetry/Metrics/Aggregators/Int64MeasureMinMaxSumCountAggregator.cs b/src/OpenTelemetry/Metrics/Aggregators/Int64MeasureMinMaxSumCountAggregator.cs index 4570c99d407..bdc8285bc15 100644 --- a/src/OpenTelemetry/Metrics/Aggregators/Int64MeasureMinMaxSumCountAggregator.cs +++ b/src/OpenTelemetry/Metrics/Aggregators/Int64MeasureMinMaxSumCountAggregator.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Metrics.Aggregators /// /// Aggregator which calculates summary (Min,Max,Sum,Count) from measures. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Int64MeasureMinMaxSumCountAggregator : Aggregator { private LongSummary summary = new LongSummary(); diff --git a/src/OpenTelemetry/Metrics/BoundCounterMetricSdkBase.cs b/src/OpenTelemetry/Metrics/BoundCounterMetricSdkBase.cs index 04b8bbe51af..91e76457ca7 100644 --- a/src/OpenTelemetry/Metrics/BoundCounterMetricSdkBase.cs +++ b/src/OpenTelemetry/Metrics/BoundCounterMetricSdkBase.cs @@ -14,10 +14,12 @@ // limitations under the License. // +using System; using OpenTelemetry.Metrics.Aggregators; namespace OpenTelemetry.Metrics { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class BoundCounterMetricSdkBase : BoundCounterMetric where T : struct { diff --git a/src/OpenTelemetry/Metrics/Export/AggregationType.cs b/src/OpenTelemetry/Metrics/Export/AggregationType.cs index f66bb83f0ea..7683188468f 100644 --- a/src/OpenTelemetry/Metrics/Export/AggregationType.cs +++ b/src/OpenTelemetry/Metrics/Export/AggregationType.cs @@ -14,8 +14,11 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics.Export { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public enum AggregationType { /// diff --git a/src/OpenTelemetry/Metrics/Export/DoubleSumData.cs b/src/OpenTelemetry/Metrics/Export/DoubleSumData.cs index f7e0df55e4b..68404e15e5b 100644 --- a/src/OpenTelemetry/Metrics/Export/DoubleSumData.cs +++ b/src/OpenTelemetry/Metrics/Export/DoubleSumData.cs @@ -14,8 +14,11 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics.Export { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class DoubleSumData : MetricData { public double Sum { get; set; } diff --git a/src/OpenTelemetry/Metrics/Export/DoubleSummaryData.cs b/src/OpenTelemetry/Metrics/Export/DoubleSummaryData.cs index 0c4f7c7e853..ace9111f17c 100644 --- a/src/OpenTelemetry/Metrics/Export/DoubleSummaryData.cs +++ b/src/OpenTelemetry/Metrics/Export/DoubleSummaryData.cs @@ -14,8 +14,11 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics.Export { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class DoubleSummaryData : MetricData { public long Count { get; set; } diff --git a/src/OpenTelemetry/Metrics/Export/Int64SumData.cs b/src/OpenTelemetry/Metrics/Export/Int64SumData.cs index aa03511e80a..cd2672d9308 100644 --- a/src/OpenTelemetry/Metrics/Export/Int64SumData.cs +++ b/src/OpenTelemetry/Metrics/Export/Int64SumData.cs @@ -14,8 +14,11 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics.Export { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Int64SumData : MetricData { public long Sum { get; set; } diff --git a/src/OpenTelemetry/Metrics/Export/Int64SummaryData.cs b/src/OpenTelemetry/Metrics/Export/Int64SummaryData.cs index 7475ffc7d94..c444f9cd67c 100644 --- a/src/OpenTelemetry/Metrics/Export/Int64SummaryData.cs +++ b/src/OpenTelemetry/Metrics/Export/Int64SummaryData.cs @@ -14,8 +14,11 @@ // limitations under the License. // +using System; + namespace OpenTelemetry.Metrics.Export { + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Int64SummaryData : MetricData { public long Count { get; set; } diff --git a/src/OpenTelemetry/Metrics/Export/Metric.cs b/src/OpenTelemetry/Metrics/Export/Metric.cs index 0c4f0fa0850..f18effbbb35 100644 --- a/src/OpenTelemetry/Metrics/Export/Metric.cs +++ b/src/OpenTelemetry/Metrics/Export/Metric.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics.Export @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics.Export /// /// This class would evolve to become the export record. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class Metric { public Metric( diff --git a/src/OpenTelemetry/Metrics/Export/MetricData.cs b/src/OpenTelemetry/Metrics/Export/MetricData.cs index 2c4f55d78ba..4ea58e912e0 100644 --- a/src/OpenTelemetry/Metrics/Export/MetricData.cs +++ b/src/OpenTelemetry/Metrics/Export/MetricData.cs @@ -22,6 +22,7 @@ namespace OpenTelemetry.Metrics.Export /// /// MetricData base class. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class MetricData { public DateTime StartTimestamp { get; set; } diff --git a/src/OpenTelemetry/Metrics/Export/MetricExporter.cs b/src/OpenTelemetry/Metrics/Export/MetricExporter.cs index 0487d388ec4..4d774f7ad6c 100644 --- a/src/OpenTelemetry/Metrics/Export/MetricExporter.cs +++ b/src/OpenTelemetry/Metrics/Export/MetricExporter.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,6 +24,7 @@ namespace OpenTelemetry.Metrics.Export /// /// MetricExporter base class. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class MetricExporter { /// diff --git a/src/OpenTelemetry/Metrics/Export/MetricProcessor.cs b/src/OpenTelemetry/Metrics/Export/MetricProcessor.cs index 497a8278aba..ffe7d6aa870 100644 --- a/src/OpenTelemetry/Metrics/Export/MetricProcessor.cs +++ b/src/OpenTelemetry/Metrics/Export/MetricProcessor.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; namespace OpenTelemetry.Metrics.Export @@ -21,6 +22,7 @@ namespace OpenTelemetry.Metrics.Export /// /// MetricProcessor base class. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public abstract class MetricProcessor { /// diff --git a/src/OpenTelemetry/Metrics/Export/UngroupedBatcher.cs b/src/OpenTelemetry/Metrics/Export/UngroupedBatcher.cs index eb3780103a2..1996431d229 100644 --- a/src/OpenTelemetry/Metrics/Export/UngroupedBatcher.cs +++ b/src/OpenTelemetry/Metrics/Export/UngroupedBatcher.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using OpenTelemetry.Internal; @@ -22,6 +23,7 @@ namespace OpenTelemetry.Metrics.Export /// /// Batcher which retains all dimensions/labels. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class UngroupedBatcher : MetricProcessor { private List metrics; diff --git a/src/OpenTelemetry/Metrics/MeterProviderBuilder.cs b/src/OpenTelemetry/Metrics/MeterProviderBuilder.cs index 32ceeb8971a..4d2b1904f5f 100644 --- a/src/OpenTelemetry/Metrics/MeterProviderBuilder.cs +++ b/src/OpenTelemetry/Metrics/MeterProviderBuilder.cs @@ -25,6 +25,7 @@ namespace OpenTelemetry.Metrics /// /// Build MeterProvider with Exporter, Processor and PushInterval. /// + [Obsolete("Metrics API/SDK is not recommended for production. See https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501 for more information on metrics support.")] public class MeterProviderBuilder { private static readonly TimeSpan DefaultPushInterval = TimeSpan.FromSeconds(60); diff --git a/src/OpenTelemetry/OpenTelemetry.csproj b/src/OpenTelemetry/OpenTelemetry.csproj index 36ceb4b2b5a..8f8ae046559 100644 --- a/src/OpenTelemetry/OpenTelemetry.csproj +++ b/src/OpenTelemetry/OpenTelemetry.csproj @@ -5,7 +5,7 @@ - $(NoWarn),1591 + $(NoWarn),1591,CS0618 diff --git a/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj b/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj index 19b25ee652c..09e4ef3531e 100644 --- a/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj +++ b/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj @@ -5,6 +5,7 @@ netcoreapp2.1;netcoreapp3.1;net5.0 $(TargetFrameworks);net452;net46 false + $(NoWarn),CS0618 diff --git a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj index 8c77f77b1ae..fd0acda5810 100644 --- a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj +++ b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj @@ -3,6 +3,7 @@ Unit test project for OpenTelemetry netcoreapp2.1;netcoreapp3.1;net5.0 $(TargetFrameworks);net46;net452 + $(NoWarn),CS0618