use of io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties in project opentelemetry-java by open-telemetry.
the class OtlpGrpcConfigTest method configureTlsInvalidCertificatePath.
@Test
void configureTlsInvalidCertificatePath() {
Map<String, String> props = new HashMap<>();
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
ConfigProperties properties = DefaultConfigProperties.createForTest(props);
assertThatThrownBy(() -> SpanExporterConfiguration.configureExporter("otlp", properties, NamedSpiManager.createEmpty(), MeterProvider.noop())).isInstanceOf(ConfigurationException.class).hasMessageContaining("Invalid OTLP certificate path:");
assertThatThrownBy(() -> MetricExporterConfiguration.configureOtlpMetrics(properties)).isInstanceOf(ConfigurationException.class).hasMessageContaining("Invalid OTLP certificate path:");
assertThatThrownBy(() -> LogExporterConfiguration.configureOtlpLogs(properties, MeterProvider.noop())).isInstanceOf(ConfigurationException.class).hasMessageContaining("Invalid OTLP certificate path:");
}
use of io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanExporters_spiExporter.
@Test
void configureSpanExporters_spiExporter() {
ConfigProperties config = DefaultConfigProperties.createForTest(ImmutableMap.of("test.option", "true", "otel.traces.exporter", "testExporter"));
Map<String, SpanExporter> exportersByName = SpanExporterConfiguration.configureSpanExporters(config, SpanExporterConfiguration.class.getClassLoader(), MeterProvider.noop(), (a, unused) -> a);
assertThat(exportersByName).hasSize(1).containsKey("testExporter").extracting(map -> map.get("testExporter")).isInstanceOf(TestConfigurableSpanExporterProvider.TestSpanExporter.class).extracting("config").isSameAs(config);
}
use of io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanExporters_multipleWithNone.
@Test
void configureSpanExporters_multipleWithNone() {
ConfigProperties config = DefaultConfigProperties.createForTest(ImmutableMap.of("otel.traces.exporter", "otlp,none"));
assertThatThrownBy(() -> SpanExporterConfiguration.configureSpanExporters(config, SpanExporterConfiguration.class.getClassLoader(), MeterProvider.noop(), (a, unused) -> a)).isInstanceOf(ConfigurationException.class).hasMessageContaining("otel.traces.exporter contains none along with other exporters");
}
use of io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanProcessors_multipleExportersWithLogging.
@Test
void configureSpanProcessors_multipleExportersWithLogging() {
SpanExporter loggingExporter = LoggingSpanExporter.create();
SpanExporter zipkinExporter = ZipkinSpanExporter.builder().build();
ConfigProperties properties = DefaultConfigProperties.createForTest(Collections.singletonMap("otel.traces.exporter", "logging,zipkin"));
assertThat(TracerProviderConfiguration.configureSpanProcessors(properties, ImmutableMap.of("logging", loggingExporter, "zipkin", zipkinExporter), MeterProvider.noop())).hasSize(2).hasAtLeastOneElementOfType(SimpleSpanProcessor.class).hasAtLeastOneElementOfType(BatchSpanProcessor.class);
}
use of io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanExporters_duplicates.
@Test
void configureSpanExporters_duplicates() {
ConfigProperties config = DefaultConfigProperties.createForTest(ImmutableMap.of("otel.traces.exporter", "otlp,otlp,logging"));
assertThatThrownBy(() -> SpanExporterConfiguration.configureSpanExporters(config, SpanExporterConfiguration.class.getClassLoader(), MeterProvider.noop(), (a, unused) -> a)).isInstanceOf(ConfigurationException.class).hasMessageContaining("otel.traces.exporter contains duplicates: [otlp]");
}
Aggregations