use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationTest method getConfigUrlNull.
@Test
void getConfigUrlNull() {
Config config = mock(Config.class);
when(config.getString(Configuration.CONFIG_KEY_OTEL_OTLP_URL, null)).thenReturn(null);
when(config.getString(Configuration.CONFIG_KEY_INGEST_URL, null)).thenReturn(null);
String result = Configuration.getConfigUrl(config);
assertNull(result);
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationTest method getConfigUrl_endpointDefined.
@Test
void getConfigUrl_endpointDefined() {
Config config = mock(Config.class);
when(config.getString(Configuration.CONFIG_KEY_OTEL_OTLP_URL, null)).thenReturn(otelEndpoint);
when(config.getString(Configuration.CONFIG_KEY_INGEST_URL, otelEndpoint)).thenReturn(logsEndpoint);
String result = Configuration.getConfigUrl(config);
assertEquals(result, logsEndpoint);
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationTest method getTLABEnabled_inheritedFalse.
@Test
void getTLABEnabled_inheritedFalse() {
Config config = mock(Config.class);
when(config.getBoolean(Configuration.CONFIG_KEY_MEMORY_ENABLED, Configuration.DEFAULT_MEMORY_ENABLED)).thenReturn(false);
when(config.getBoolean(Configuration.CONFIG_KEY_TLAB_ENABLED, false)).thenReturn(false);
boolean result = Configuration.getTLABEnabled(config);
assertFalse(result);
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationLoggerTest method testLogInheritDefaultValues.
@Test
void testLogInheritDefaultValues() {
Config config = mock(Config.class);
String inheritedUrl = "http://otel.example.com";
when(config.getString(CONFIG_KEY_OTEL_OTLP_URL, null)).thenReturn(inheritedUrl);
when(config.getString(CONFIG_KEY_INGEST_URL, inheritedUrl)).thenReturn(inheritedUrl);
when(config.getBoolean(CONFIG_KEY_MEMORY_ENABLED, DEFAULT_MEMORY_ENABLED)).thenReturn(true);
when(config.getBoolean(CONFIG_KEY_TLAB_ENABLED, true)).thenReturn(false);
ConfigurationLogger configurationLogger = new ConfigurationLogger();
configurationLogger.log(config);
log.assertContains(" splunk.profiler.logs-endpoint : http://otel.example.com");
log.assertContains(" otel.exporter.otlp.endpoint : http://otel.example.com");
log.assertContains(" splunk.profiler.memory.enabled : true");
log.assertContains(" splunk.profiler.tlab.enabled : false");
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class TLABProcessorTest method testProfilingDisabled.
@Test
void testProfilingDisabled() {
RecordedEvent event = mock(RecordedEvent.class, new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
throw new IllegalStateException("RecordedEvent methods should not be called when TLAB profiling is not enabled");
}
});
Config config = mock(Config.class);
when(config.getBoolean(CONFIG_KEY_TLAB_ENABLED, DEFAULT_MEMORY_ENABLED)).thenReturn(false);
TLABProcessor processor = TLABProcessor.builder(config).build();
processor.accept(event);
}
Aggregations