From 97ac56243fc79be2ac707c1ac09db3ada5973469 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 12:41:15 -0700 Subject: [PATCH 01/13] initial commit --- .../GenevaMetricExporterOptions.cs | 19 ++++++++++++++++++- .../GenevaMetricExporterOptionsTests.cs | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs index 5d406e0f3c..239aecf09e 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs @@ -24,6 +24,7 @@ namespace OpenTelemetry.Exporter.Geneva; public class GenevaMetricExporterOptions { private IReadOnlyDictionary _prepopulatedMetricDimensions; + private int _metricExporterIntervalMilliseconds = 20000; /// /// Gets or sets the ConnectionString which contains semicolon separated list of key-value pairs. @@ -34,7 +35,23 @@ public class GenevaMetricExporterOptions /// /// Gets or sets the metric export interval in milliseconds. The default value is 20000. /// - public int MetricExportIntervalMilliseconds { get; set; } = 20000; + public int MetricExportIntervalMilliseconds + { + get + { + return this._metricExporterIntervalMilliseconds; + } + + set + { + if (value > 60000) + { + throw new ArgumentException($"MetricExportIntervalMilliseconds: {value} exceeds 60 seconds, which is the maximum allowed limit."); + } + + this._metricExporterIntervalMilliseconds = value; + } + } /// /// Gets or sets the pre-populated dimensions for all the metrics exported by the exporter. diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 6d615b6dff..70bc502e03 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -68,6 +68,21 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); + } + + [Fact] + public void InvalidMetricExportInterval() + { + var invalidMetricExportIntervalMillisecondsException = Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 60001, + }; + }); + + var expectedErrorMessage = $"MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; + Assert.Equal(expectedErrorMessage, invalidMetricExportIntervalMillisecondsException.Message); } } } From 5f21c81232c4fe7fd33462aabc74816c6a39640e Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 13:01:56 -0700 Subject: [PATCH 02/13] encoding --- .../GenevaMetricExporterOptionsTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 70bc502e03..8488b234ae 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -68,8 +68,8 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); - } - + } + [Fact] public void InvalidMetricExportInterval() { @@ -79,8 +79,8 @@ public void InvalidMetricExportInterval() { MetricExportIntervalMilliseconds = 60001, }; - }); - + }); + var expectedErrorMessage = $"MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; Assert.Equal(expectedErrorMessage, invalidMetricExportIntervalMillisecondsException.Message); } From a25a94589f5f8dc14481d0ababbe6c009c43da06 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 14:26:04 -0700 Subject: [PATCH 03/13] CI From a0ce75a96ac0f0c0ad0401ee0fa18ffa08644ca3 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 15:03:11 -0700 Subject: [PATCH 04/13] added range check --- .../GenevaMetricExporterOptionsTests.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 8488b234ae..774b21947c 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -73,6 +73,17 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal [Fact] public void InvalidMetricExportInterval() { + var negativeInputMetricExportIntervalMillisecondsException = Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = -1000, + }; + }); + + var negativeInputExpectedErrorMessage = "MetricExportIntervalMilliseconds: -1000 should be a greater than 0 integer."; + Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); + var invalidMetricExportIntervalMillisecondsException = Assert.Throws(() => { var exporterOptions = new GenevaMetricExporterOptions @@ -81,7 +92,7 @@ public void InvalidMetricExportInterval() }; }); - var expectedErrorMessage = $"MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; + var expectedErrorMessage = "MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; Assert.Equal(expectedErrorMessage, invalidMetricExportIntervalMillisecondsException.Message); } } From 2a3dbfe69f804491dafe274edbe02ce2434d2160 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 15:04:57 -0700 Subject: [PATCH 05/13] LF --- .../GenevaMetricExporterOptionsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 774b21947c..0e33713cc4 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -82,8 +82,8 @@ public void InvalidMetricExportInterval() }); var negativeInputExpectedErrorMessage = "MetricExportIntervalMilliseconds: -1000 should be a greater than 0 integer."; - Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); - + Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); + var invalidMetricExportIntervalMillisecondsException = Assert.Throws(() => { var exporterOptions = new GenevaMetricExporterOptions From df009d731383953654a2925633b9ee12e45d3ba7 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 21 Jul 2022 15:09:40 -0700 Subject: [PATCH 06/13] draft --- .../GenevaMetricExporterOptions.cs | 24 ++++++++++++++++- .../GenevaMetricExporterOptionsTests.cs | 26 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs index 5d406e0f3c..3a9dee9713 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs @@ -24,6 +24,7 @@ namespace OpenTelemetry.Exporter.Geneva; public class GenevaMetricExporterOptions { private IReadOnlyDictionary _prepopulatedMetricDimensions; + private int _metricExporterIntervalMilliseconds = 20000; /// /// Gets or sets the ConnectionString which contains semicolon separated list of key-value pairs. @@ -34,7 +35,28 @@ public class GenevaMetricExporterOptions /// /// Gets or sets the metric export interval in milliseconds. The default value is 20000. /// - public int MetricExportIntervalMilliseconds { get; set; } = 20000; + public int MetricExportIntervalMilliseconds + { + get + { + return this._metricExporterIntervalMilliseconds; + } + + set + { + if (value < 0) + { + throw new ArgumentException($"MetricExportIntervalMilliseconds: {value} should be a greater than 0 integer."); + } + + if (value > 60000) + { + throw new ArgumentException($"MetricExportIntervalMilliseconds: {value} exceeds 60 seconds, which is the maximum allowed limit."); + } + + this._metricExporterIntervalMilliseconds = value; + } + } /// /// Gets or sets the pre-populated dimensions for all the metrics exported by the exporter. diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 6d615b6dff..0e33713cc4 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -69,5 +69,31 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); } + + [Fact] + public void InvalidMetricExportInterval() + { + var negativeInputMetricExportIntervalMillisecondsException = Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = -1000, + }; + }); + + var negativeInputExpectedErrorMessage = "MetricExportIntervalMilliseconds: -1000 should be a greater than 0 integer."; + Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); + + var invalidMetricExportIntervalMillisecondsException = Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 60001, + }; + }); + + var expectedErrorMessage = "MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; + Assert.Equal(expectedErrorMessage, invalidMetricExportIntervalMillisecondsException.Message); + } } } From 7c5a486415cf252b5077f4355de048acb3b2497f Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Mon, 25 Jul 2022 16:00:48 -0700 Subject: [PATCH 07/13] addressed comment and updated range --- .../GenevaMetricExporterOptions.cs | 10 +------- .../GenevaMetricExporterOptionsTests.cs | 25 +++++++------------ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs index 3a9dee9713..8009f98879 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporterOptions.cs @@ -44,15 +44,7 @@ public int MetricExportIntervalMilliseconds set { - if (value < 0) - { - throw new ArgumentException($"MetricExportIntervalMilliseconds: {value} should be a greater than 0 integer."); - } - - if (value > 60000) - { - throw new ArgumentException($"MetricExportIntervalMilliseconds: {value} exceeds 60 seconds, which is the maximum allowed limit."); - } + Guard.ThrowIfOutOfRange(value, min: 1000); this._metricExporterIntervalMilliseconds = value; } diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 0e33713cc4..ce2e8b3d21 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -73,27 +73,20 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal [Fact] public void InvalidMetricExportInterval() { - var negativeInputMetricExportIntervalMillisecondsException = Assert.Throws(() => + var negativeInputMetricExportIntervalMillisecondsException = Assert.Throws(() => { var exporterOptions = new GenevaMetricExporterOptions { - MetricExportIntervalMilliseconds = -1000, + MetricExportIntervalMilliseconds = 500, }; - }); - - var negativeInputExpectedErrorMessage = "MetricExportIntervalMilliseconds: -1000 should be a greater than 0 integer."; + }); + +#if NET6_0 || NETCOREAPP3_1_OR_GREATER + var negativeInputExpectedErrorMessage = "Must be in the range: [1000, 2147483647] (Parameter 'value')\r\nActual value was 500."; +#else + var negativeInputExpectedErrorMessage = "Must be in the range: [1000, 2147483647]\r\nParameter name: value\r\nActual value was 500."; +#endif Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); - - var invalidMetricExportIntervalMillisecondsException = Assert.Throws(() => - { - var exporterOptions = new GenevaMetricExporterOptions - { - MetricExportIntervalMilliseconds = 60001, - }; - }); - - var expectedErrorMessage = "MetricExportIntervalMilliseconds: 60001 exceeds 60 seconds, which is the maximum allowed limit."; - Assert.Equal(expectedErrorMessage, invalidMetricExportIntervalMillisecondsException.Message); } } } From c5452e4ba289243526af2ae91702bd8c25ea2c10 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Mon, 25 Jul 2022 16:03:11 -0700 Subject: [PATCH 08/13] ditto --- .../GenevaMetricExporterOptionsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index ce2e8b3d21..ffc3b574e0 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -79,8 +79,8 @@ public void InvalidMetricExportInterval() { MetricExportIntervalMilliseconds = 500, }; - }); - + }); + #if NET6_0 || NETCOREAPP3_1_OR_GREATER var negativeInputExpectedErrorMessage = "Must be in the range: [1000, 2147483647] (Parameter 'value')\r\nActual value was 500."; #else From fa5d9af56a5790d70c3ef9f18e98f65f4fbdd6c0 Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Mon, 25 Jul 2022 16:17:41 -0700 Subject: [PATCH 09/13] comment --- .../GenevaMetricExporterOptionsTests.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index ffc3b574e0..6d615b6dff 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -69,24 +69,5 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); } - - [Fact] - public void InvalidMetricExportInterval() - { - var negativeInputMetricExportIntervalMillisecondsException = Assert.Throws(() => - { - var exporterOptions = new GenevaMetricExporterOptions - { - MetricExportIntervalMilliseconds = 500, - }; - }); - -#if NET6_0 || NETCOREAPP3_1_OR_GREATER - var negativeInputExpectedErrorMessage = "Must be in the range: [1000, 2147483647] (Parameter 'value')\r\nActual value was 500."; -#else - var negativeInputExpectedErrorMessage = "Must be in the range: [1000, 2147483647]\r\nParameter name: value\r\nActual value was 500."; -#endif - Assert.Equal(negativeInputExpectedErrorMessage, negativeInputMetricExportIntervalMillisecondsException.Message); - } } } From 0c6ca59fdaf8532a86a6b6271c0bcf47e89ab09c Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Tue, 26 Jul 2022 17:42:52 -0700 Subject: [PATCH 10/13] comment --- opentelemetry-dotnet-contrib.sln | 7 ------ .../GenevaMetricExporterOptionsTests.cs | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 6380291c2b..2bb827c621 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -200,8 +200,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Pe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Instana", "src\OpenTelemetry.Exporter.Instana\OpenTelemetry.Exporter.Instana.csproj", "{BD3C6377-6F8D-47D6-9710-1681ED4E6772}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Instana.Tests", "test\OpenTelemetry.Exporter.Instana.Tests\OpenTelemetry.Exporter.Instana.Tests.csproj", "{77E7DDB9-32CF-450E-B596-E893149D07DD}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis", "src\OpenTelemetry.Instrumentation.StackExchangeRedis\OpenTelemetry.Instrumentation.StackExchangeRedis.csproj", "{14BAEC26-CCD1-44B5-94D7-F219057B0B4D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests", "test\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj", "{2AD0F8EB-B7C8-4E87-8090-25BE190A0BD4}" @@ -434,10 +432,6 @@ Global {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Release|Any CPU.Build.0 = Release|Any CPU - {77E7DDB9-32CF-450E-B596-E893149D07DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {77E7DDB9-32CF-450E-B596-E893149D07DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {77E7DDB9-32CF-450E-B596-E893149D07DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {77E7DDB9-32CF-450E-B596-E893149D07DD}.Release|Any CPU.Build.0 = Release|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -543,7 +537,6 @@ Global {ED774FC3-C1C0-44CD-BA41-686C04BEB3E5} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {17E3936A-265A-4C9F-9DD5-4568F80E6D91} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {BD3C6377-6F8D-47D6-9710-1681ED4E6772} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} - {77E7DDB9-32CF-450E-B596-E893149D07DD} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {14BAEC26-CCD1-44B5-94D7-F219057B0B4D} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {2AD0F8EB-B7C8-4E87-8090-25BE190A0BD4} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {D8F9AEAC-6ACA-484E-81A5-9CEBEDBC3422} = {B75EE478-97F7-4E9F-9A5A-DB3D0988EDEA} diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 6d615b6dff..2593eafe44 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -69,5 +69,27 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); } + + [Fact] + public void MetricExportIntervalValidationTest() + { + Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 500, + }; + }); + + var exception = Record.Exception(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 1000, + }; + }); + + Assert.Null(exception); + } } } From e65e54388e666d1636c7e7581d466afbea9ed5d0 Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Tue, 26 Jul 2022 17:45:04 -0700 Subject: [PATCH 11/13] test --- .../GenevaMetricExporterOptionsTests.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 6d615b6dff..2593eafe44 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -69,5 +69,27 @@ [new string('a', GenevaMetricExporter.MaxDimensionNameSize + 1)] = "DimensionVal expectedErrorMessage = $"Value provided for the dimension: DimensionKey exceeds the maximum allowed limit of {GenevaMetricExporter.MaxDimensionValueSize} characters for dimension value."; Assert.Equal(expectedErrorMessage, invalidDimensionValueException.Message); } + + [Fact] + public void MetricExportIntervalValidationTest() + { + Assert.Throws(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 500, + }; + }); + + var exception = Record.Exception(() => + { + var exporterOptions = new GenevaMetricExporterOptions + { + MetricExportIntervalMilliseconds = 1000, + }; + }); + + Assert.Null(exception); + } } } From b1e85c7930677c9b6296b454a1197500cbda7033 Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Tue, 26 Jul 2022 17:49:24 -0700 Subject: [PATCH 12/13] revert sln --- opentelemetry-dotnet-contrib.sln | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 2bb827c621..6380291c2b 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -200,6 +200,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Pe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Instana", "src\OpenTelemetry.Exporter.Instana\OpenTelemetry.Exporter.Instana.csproj", "{BD3C6377-6F8D-47D6-9710-1681ED4E6772}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Instana.Tests", "test\OpenTelemetry.Exporter.Instana.Tests\OpenTelemetry.Exporter.Instana.Tests.csproj", "{77E7DDB9-32CF-450E-B596-E893149D07DD}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis", "src\OpenTelemetry.Instrumentation.StackExchangeRedis\OpenTelemetry.Instrumentation.StackExchangeRedis.csproj", "{14BAEC26-CCD1-44B5-94D7-F219057B0B4D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests", "test\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj", "{2AD0F8EB-B7C8-4E87-8090-25BE190A0BD4}" @@ -432,6 +434,10 @@ Global {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD3C6377-6F8D-47D6-9710-1681ED4E6772}.Release|Any CPU.Build.0 = Release|Any CPU + {77E7DDB9-32CF-450E-B596-E893149D07DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77E7DDB9-32CF-450E-B596-E893149D07DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77E7DDB9-32CF-450E-B596-E893149D07DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77E7DDB9-32CF-450E-B596-E893149D07DD}.Release|Any CPU.Build.0 = Release|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU {14BAEC26-CCD1-44B5-94D7-F219057B0B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -537,6 +543,7 @@ Global {ED774FC3-C1C0-44CD-BA41-686C04BEB3E5} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {17E3936A-265A-4C9F-9DD5-4568F80E6D91} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {BD3C6377-6F8D-47D6-9710-1681ED4E6772} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} + {77E7DDB9-32CF-450E-B596-E893149D07DD} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {14BAEC26-CCD1-44B5-94D7-F219057B0B4D} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {2AD0F8EB-B7C8-4E87-8090-25BE190A0BD4} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {D8F9AEAC-6ACA-484E-81A5-9CEBEDBC3422} = {B75EE478-97F7-4E9F-9A5A-DB3D0988EDEA} From 85b9356e527f57519559673140e440bb3cb5960a Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Tue, 26 Jul 2022 19:41:05 -0700 Subject: [PATCH 13/13] Update test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs Co-authored-by: Reiley Yang --- .../GenevaMetricExporterOptionsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs index 2593eafe44..9b0fb22a50 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterOptionsTests.cs @@ -77,7 +77,7 @@ public void MetricExportIntervalValidationTest() { var exporterOptions = new GenevaMetricExporterOptions { - MetricExportIntervalMilliseconds = 500, + MetricExportIntervalMilliseconds = 999, }; });