From c13437407ab06ea5b3a7790a8070c633d9a4f8a4 Mon Sep 17 00:00:00 2001 From: Michael Maxwell Date: Thu, 14 Apr 2022 16:12:33 -0700 Subject: [PATCH] Geneva Exporter to use `OpenTelemetry 1.2.0-rc5` (#308) --- src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md | 7 +++++-- .../GenevaMetricExporter.cs | 1 - .../GenevaMetricExporterExtensions.cs | 3 ++- .../OpenTelemetry.Exporter.Geneva.csproj | 2 +- .../Exporter/MetricExporterBenchmarks.cs | 16 ++++++++-------- .../GenevaMetricExporterTests.cs | 6 +++--- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md index 132346cb0c0..15558c10189 100644 --- a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md @@ -2,13 +2,16 @@ ## Unreleased -LogExporter modified to stop calling `ToString()` +* LogExporter modified to stop calling `ToString()` on `LogRecord.State` to obtain Log body. It now obtains body from `LogRecord.FormattedMessage` or special casing "{OriginalFormat}" only. [295](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/295) -Fixed a bug which causes LogExporter to not +* Fixed a bug which causes LogExporter to not serialize if the `LogRecord.State` had a single KeyValuePair. [295](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/295) + +* Update OTel SDK version to `1.2.0-rc5`. +[308](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/308) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporter.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporter.cs index 836e3b7bbff..b45a257b8fb 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporter.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporter.cs @@ -23,7 +23,6 @@ namespace OpenTelemetry.Exporter.Geneva { - [AggregationTemporality(AggregationTemporality.Delta)] public class GenevaMetricExporter : BaseExporter { private const int BufferSize = 65360; // the maximum ETW payload (inclusive) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterExtensions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterExtensions.cs index 69612ae9d5d..f1177023208 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterExtensions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterExtensions.cs @@ -31,7 +31,8 @@ public static MeterProviderBuilder AddGenevaMetricExporter(this MeterProviderBui var options = new GenevaMetricExporterOptions(); configure?.Invoke(options); - return builder.AddReader(new PeriodicExportingMetricReader(new GenevaMetricExporter(options), options.MetricExportIntervalMilliseconds)); + return builder.AddReader(new PeriodicExportingMetricReader(new GenevaMetricExporter(options), options.MetricExportIntervalMilliseconds) + { TemporalityPreference = MetricReaderTemporalityPreference.Delta }); } } } diff --git a/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj b/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj index b33663ebbfc..0f95e77d926 100644 --- a/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj +++ b/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj @@ -12,7 +12,7 @@ - + diff --git a/test/OpenTelemetry.Exporter.Geneva.Benchmark/Exporter/MetricExporterBenchmarks.cs b/test/OpenTelemetry.Exporter.Geneva.Benchmark/Exporter/MetricExporterBenchmarks.cs index 4f9a27d7714..5e1f72534fa 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Benchmark/Exporter/MetricExporterBenchmarks.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Benchmark/Exporter/MetricExporterBenchmarks.cs @@ -167,7 +167,7 @@ private MetricPoint GenerateCounterMetricItemWith3Dimensions(out MetricData metr var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -201,7 +201,7 @@ private MetricPoint GenerateCounterMetricItemWith4Dimensions(out MetricData metr var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -239,7 +239,7 @@ private Batch GenerateCounterBatchWith3Dimensions() var batchGeneratorExporter = new BatchGenerator(); var batchGeneratorReader = new BaseExportingMetricReader(batchGeneratorExporter) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; this.meterProviderForCounterBatchWith3Dimensions = Sdk.CreateMeterProviderBuilder() @@ -265,7 +265,7 @@ private Batch GenerateCounterBatchWith4Dimensions() var batchGeneratorExporter = new BatchGenerator(); var batchGeneratorReader = new BaseExportingMetricReader(batchGeneratorExporter) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; this.meterProviderForCounterBatchWith4Dimensions = Sdk.CreateMeterProviderBuilder() @@ -295,7 +295,7 @@ private MetricPoint GenerateHistogramMetricItemWith3Dimensions(out MetricData su var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -332,7 +332,7 @@ private MetricPoint GenerateHistogramMetricItemWith4Dimensions(out MetricData su var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -373,7 +373,7 @@ private Batch GenerateHistogramBatchWith3Dimensions() var batchGeneratorExporter = new BatchGenerator(); var batchGeneratorReader = new BaseExportingMetricReader(batchGeneratorExporter) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; this.meterProviderForHistogramBatchWith3Dimensions = Sdk.CreateMeterProviderBuilder() @@ -402,7 +402,7 @@ private Batch GenerateHistogramBatchWith4Dimensions() var batchGeneratorExporter = new BatchGenerator(); var batchGeneratorReader = new BaseExportingMetricReader(batchGeneratorExporter) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; this.meterProviderForHistogramBatchWith4Dimensions = Sdk.CreateMeterProviderBuilder() diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs index d58e12b3a27..66b965863a5 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs @@ -112,7 +112,7 @@ public void SuccessfulSerialization(bool testMaxLimits) var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -275,7 +275,7 @@ public void SuccessfulSerializationWithViews() var exportedItems = new List(); using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; using var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -479,7 +479,7 @@ public void SuccessfulExportOnLinux() using var inMemoryReader = new BaseExportingMetricReader(new InMemoryExporter(exportedItems)) { - Temporality = AggregationTemporality.Delta, + TemporalityPreference = MetricReaderTemporalityPreference.Delta, }; // Set up two different providers as only one Metric Processor is allowed.