diff --git a/docs/trace/customizing-the-sdk/README.md b/docs/trace/customizing-the-sdk/README.md index ecdafaac88f..30bd03473e8 100644 --- a/docs/trace/customizing-the-sdk/README.md +++ b/docs/trace/customizing-the-sdk/README.md @@ -224,9 +224,6 @@ For exporting purposes, the SDK provides the following built-in processors: | `OTEL_BSP_MAX_QUEUE_SIZE` | `MaxQueueSize` | | `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` | `MaxExportBatchSizeEnvVarKey` | - `FormatException` is thrown in case of an invalid value for any of the - supported environment variables. - * [SimpleExportProcessor<T>](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#simple-processor) : This is an exporting processor which passes telemetry to the configured exporter immediately without any batching. diff --git a/src/OpenTelemetry.Exporter.Console/README.md b/src/OpenTelemetry.Exporter.Console/README.md index f7c0427bb3a..f02bb0efd40 100644 --- a/src/OpenTelemetry.Exporter.Console/README.md +++ b/src/OpenTelemetry.Exporter.Console/README.md @@ -45,9 +45,6 @@ values of the `PeriodicExportingMetricReaderOptions` | `OTEL_METRIC_EXPORT_INTERVAL` | `ExportIntervalMilliseconds` | | `OTEL_METRIC_EXPORT_TIMEOUT` | `ExportTimeoutMilliseconds` | -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## References * [OpenTelemetry Project](https://opentelemetry.io/) diff --git a/src/OpenTelemetry.Exporter.InMemory/README.md b/src/OpenTelemetry.Exporter.InMemory/README.md index 30ef04f1c52..da3eb63ff13 100644 --- a/src/OpenTelemetry.Exporter.InMemory/README.md +++ b/src/OpenTelemetry.Exporter.InMemory/README.md @@ -32,9 +32,6 @@ values of the `PeriodicExportingMetricReaderOptions` | `OTEL_METRIC_EXPORT_INTERVAL` | `ExportIntervalMilliseconds` | | `OTEL_METRIC_EXPORT_TIMEOUT` | `ExportTimeoutMilliseconds` | -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## References * [OpenTelemetry Project](https://opentelemetry.io/) diff --git a/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterOptions.cs b/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterOptions.cs index fc7ee9a13d9..33de53ab745 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterOptions.cs @@ -29,10 +29,6 @@ namespace OpenTelemetry.Exporter /// OTEL_EXPORTER_JAEGER_AGENT_HOST, OTEL_EXPORTER_JAEGER_AGENT_PORT /// environment variables are parsed during object construction. /// - /// - /// The constructor throws if it fails to parse - /// any of the supported environment variables. - /// public class JaegerExporterOptions { internal const int DefaultMaxPayloadSizeInBytes = 4096; diff --git a/src/OpenTelemetry.Exporter.Jaeger/README.md b/src/OpenTelemetry.Exporter.Jaeger/README.md index 22fd4a382e4..411e3d40283 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/README.md +++ b/src/OpenTelemetry.Exporter.Jaeger/README.md @@ -79,9 +79,6 @@ values of the `JaegerExporterOptions` | `OTEL_EXPORTER_JAEGER_ENDPOINT` | `Endpoint` | | `OTEL_EXPORTER_JAEGER_PROTOCOL` | `Protocol` (`udp/thrift.compact` or `http/thrift.binary`) | -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## Configure HttpClient The `HttpClientFactory` option is provided on `JaegerExporterOptions` for users diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol.Grpc/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol.Grpc/README.md index 5631411a919..f26f22a5dae 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol.Grpc/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol.Grpc/README.md @@ -63,9 +63,6 @@ values of the `PeriodicExportingMetricReaderOptions` | `OTEL_METRIC_EXPORT_INTERVAL` | `ExportIntervalMilliseconds` | | `OTEL_METRIC_EXPORT_TIMEOUT` | `ExportTimeoutMilliseconds` | -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## References * [OpenTelemetry diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs index 35abee387ba..289c0fec8b3 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs @@ -32,10 +32,6 @@ namespace OpenTelemetry.Exporter /// OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_PROTOCOL /// environment variables are parsed during object construction. /// - /// - /// The constructor throws if it fails to parse - /// any of the supported environment variables. - /// public class OtlpExporterOptions { internal const string EndpointEnvVarName = "OTEL_EXPORTER_OTLP_ENDPOINT"; diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index 4386b891217..369b6e1574e 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -90,9 +90,6 @@ values of the span limits * `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` * `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## OTLP Logs This package currently only supports exporting traces and metrics. Support for diff --git a/src/OpenTelemetry.Exporter.Zipkin/README.md b/src/OpenTelemetry.Exporter.Zipkin/README.md index 9b4b7c185ef..20d794c051d 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/README.md +++ b/src/OpenTelemetry.Exporter.Zipkin/README.md @@ -72,9 +72,6 @@ values of the `ZipkinExporterOptions`. | --------------------------------| -------------------------------- | | `OTEL_EXPORTER_ZIPKIN_ENDPOINT` | `Endpoint` | -`FormatException` is thrown in case of an invalid value for any of the -supported environment variables. - ## Configure HttpClient The `HttpClientFactory` option is provided on `ZipkinExporterOptions` for users diff --git a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs index fcc5300ee91..e7051137925 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs @@ -29,10 +29,6 @@ namespace OpenTelemetry.Exporter /// OTEL_EXPORTER_ZIPKIN_ENDPOINT /// environment variables are parsed during object construction. /// - /// - /// The constructor throws if it fails to parse - /// any of the supported environment variables. - /// public sealed class ZipkinExporterOptions { internal const int DefaultMaxPayloadSizeInBytes = 4096; diff --git a/src/OpenTelemetry/Trace/BatchExportActivityProcessorOptions.cs b/src/OpenTelemetry/Trace/BatchExportActivityProcessorOptions.cs index 49c879b9993..2091ac99a7c 100644 --- a/src/OpenTelemetry/Trace/BatchExportActivityProcessorOptions.cs +++ b/src/OpenTelemetry/Trace/BatchExportActivityProcessorOptions.cs @@ -27,10 +27,6 @@ namespace OpenTelemetry.Trace /// OTEL_BSP_MAX_QUEUE_SIZE, OTEL_BSP_MAX_EXPORT_BATCH_SIZE, OTEL_BSP_EXPORT_TIMEOUT, OTEL_BSP_SCHEDULE_DELAY /// environment variables are parsed during object construction. /// - /// - /// The constructor throws if it fails to parse - /// any of the supported environment variables. - /// public class BatchExportActivityProcessorOptions : BatchExportProcessorOptions { internal const string MaxQueueSizeEnvVarKey = "OTEL_BSP_MAX_QUEUE_SIZE"; diff --git a/test/OpenTelemetry.Exporter.Jaeger.Tests/JaegerExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.Jaeger.Tests/JaegerExporterOptionsTests.cs index 545db2aec23..e8c2f7c48ce 100644 --- a/test/OpenTelemetry.Exporter.Jaeger.Tests/JaegerExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.Jaeger.Tests/JaegerExporterOptionsTests.cs @@ -64,14 +64,16 @@ public void JaegerExporterOptions_EnvironmentVariableOverride() Assert.Equal(new Uri("http://custom-endpoint:12345"), options.Endpoint); } - [Theory(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3690")] - [InlineData(JaegerExporterOptions.OTelAgentPortEnvVarKey)] - [InlineData(JaegerExporterOptions.OTelProtocolEnvVarKey)] - public void JaegerExporterOptions_InvalidEnvironmentVariableOverride(string envVar) + [Fact] + public void JaegerExporterOptions_InvalidEnvironmentVariableOverride() { - Environment.SetEnvironmentVariable(envVar, "invalid"); + Environment.SetEnvironmentVariable(JaegerExporterOptions.OTelAgentPortEnvVarKey, "invalid"); + Environment.SetEnvironmentVariable(JaegerExporterOptions.OTelProtocolEnvVarKey, "invalid"); + + var options = new JaegerExporterOptions(); - Assert.Throws(() => new JaegerExporterOptions()); + Assert.Equal("localhost", options.AgentHost); + Assert.Equal(default(JaegerExportProtocol), options.Protocol); } [Fact] diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterOptionsTests.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterOptionsTests.cs index e34f8771743..a985d48ece5 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterOptionsTests.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterOptionsTests.cs @@ -95,28 +95,18 @@ public void OtlpExporterOptions_UsingIConfiguration() Assert.Equal(OtlpExportProtocol.HttpProtobuf, options.Protocol); } - [Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3690")] - public void OtlpExporterOptions_InvalidEndpointVariableOverride() + [Fact] + public void OtlpExporterOptions_InvalidEnvironmentVariableOverride() { Environment.SetEnvironmentVariable(OtlpExporterOptions.EndpointEnvVarName, "invalid"); - - Assert.Throws(() => new OtlpExporterOptions()); - } - - [Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3690")] - public void OtlpExporterOptions_InvalidTimeoutVariableOverride() - { Environment.SetEnvironmentVariable(OtlpExporterOptions.TimeoutEnvVarName, "invalid"); - - Assert.Throws(() => new OtlpExporterOptions()); - } - - [Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3690")] - public void OtlpExporterOptions_InvalidProtocolVariableOverride() - { Environment.SetEnvironmentVariable(OtlpExporterOptions.ProtocolEnvVarName, "invalid"); - Assert.Throws(() => new OtlpExporterOptions()); + var options = new OtlpExporterOptions(); + + Assert.Equal(new Uri("http://localhost:4317"), options.Endpoint); + Assert.Equal(10000, options.TimeoutMilliseconds); + Assert.Equal(default, options.Protocol); } [Fact] diff --git a/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs b/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs index 5e8c18ff7ee..6c4b422ee61 100644 --- a/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs +++ b/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs @@ -196,7 +196,9 @@ public void ErrorGettingUriFromEnvVarSetsDefaultEndpointValue() { Environment.SetEnvironmentVariable(ZipkinExporterOptions.ZipkinEndpointEnvVar, "InvalidUri"); - Assert.Throws(() => new ZipkinExporterOptions()); + var options = new ZipkinExporterOptions(); + + Assert.Equal(new Uri(ZipkinExporterOptions.DefaultZipkinEndpoint), options.Endpoint); } finally { diff --git a/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorOptionsTest.cs b/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorOptionsTest.cs index 97d58932334..cca1feb6e94 100644 --- a/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorOptionsTest.cs +++ b/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorOptionsTest.cs @@ -82,12 +82,20 @@ public void BatchExportProcessorOptions_UsingIConfiguration() Assert.Equal(4, options.ScheduledDelayMilliseconds); } - [Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3690")] - public void BatchExportProcessorOptions_InvalidPortEnvironmentVariableOverride() + [Fact] + public void BatchExportProcessorOptions_InvalidEnvironmentVariableOverride() { Environment.SetEnvironmentVariable(BatchExportActivityProcessorOptions.ExporterTimeoutEnvVarKey, "invalid"); + Environment.SetEnvironmentVariable(BatchExportActivityProcessorOptions.MaxExportBatchSizeEnvVarKey, "invalid"); + Environment.SetEnvironmentVariable(BatchExportActivityProcessorOptions.MaxQueueSizeEnvVarKey, "invalid"); + Environment.SetEnvironmentVariable(BatchExportActivityProcessorOptions.ScheduledDelayEnvVarKey, "invalid"); + + var options = new BatchExportActivityProcessorOptions(); - Assert.Throws(() => new BatchExportActivityProcessorOptions()); + Assert.Equal(30000, options.ExporterTimeoutMilliseconds); + Assert.Equal(512, options.MaxExportBatchSize); + Assert.Equal(2048, options.MaxQueueSize); + Assert.Equal(5000, options.ScheduledDelayMilliseconds); } [Fact]