use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class RelevantEventsTest method testTlabNotEnabled.
@Test
void testTlabNotEnabled() {
Config config = mock(Config.class);
when(config.getBoolean(Configuration.CONFIG_KEY_TLAB_ENABLED, Configuration.DEFAULT_MEMORY_ENABLED)).thenReturn(false);
RelevantEvents relevantEvents = RelevantEvents.create(config);
assertTrue(relevantEvents.isRelevant(threadDump));
assertFalse(relevantEvents.isRelevant(tlab));
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationLoggerTest method testLog.
@Test
void testLog() {
Config config = mock(Config.class);
when(config.getBoolean(CONFIG_KEY_ENABLE_PROFILER, false)).thenReturn(true);
when(config.getString(CONFIG_KEY_PROFILER_DIRECTORY)).thenReturn("somedir");
when(config.getString(CONFIG_KEY_RECORDING_DURATION)).thenReturn("33m");
when(config.getBoolean(CONFIG_KEY_KEEP_FILES, false)).thenReturn(true);
when(config.getString(CONFIG_KEY_OTEL_OTLP_URL, null)).thenReturn("http://otel.example.com");
when(config.getString(CONFIG_KEY_INGEST_URL, "http://otel.example.com")).thenReturn("http://example.com");
when(config.getBoolean(CONFIG_KEY_MEMORY_ENABLED, DEFAULT_MEMORY_ENABLED)).thenReturn(false);
when(config.getBoolean(CONFIG_KEY_TLAB_ENABLED, false)).thenReturn(true);
when(config.getDuration(CONFIG_KEY_CALL_STACK_INTERVAL, DEFAULT_CALL_STACK_INTERVAL)).thenReturn(Duration.ofSeconds(21));
when(config.getBoolean(CONFIG_KEY_INCLUDE_INTERNAL_STACKS, DEFAULT_INCLUDE_INTERNAL_STACKS)).thenReturn(true);
when(config.getBoolean(CONFIG_KEY_TRACING_STACKS_ONLY, DEFAULT_TRACING_STACKS_ONLY)).thenReturn(true);
when(config.getDuration(CONFIG_KEY_DEPRECATED_THREADDUMP_PERIOD, null)).thenReturn(Duration.ofMillis(500));
ConfigurationLogger configurationLogger = new ConfigurationLogger();
configurationLogger.log(config);
log.assertContains("-----------------------");
log.assertContains("Profiler configuration:");
log.assertContains(" splunk.profiler.enabled : true");
log.assertContains(" splunk.profiler.directory : somedir");
log.assertContains(" splunk.profiler.recording.duration : 33m");
log.assertContains(" splunk.profiler.keep-files : true");
log.assertContains(" splunk.profiler.logs-endpoint : http://example.com");
log.assertContains(" otel.exporter.otlp.endpoint : http://otel.example.com");
log.assertContains(" splunk.profiler.memory.enabled : false");
log.assertContains(" splunk.profiler.tlab.enabled : true");
log.assertContains(" splunk.profiler.call.stack.interval : PT21S");
log.assertContains("splunk.profiler.include.internal.stacks : true");
log.assertContains(" splunk.profiler.tracing.stacks.only : true");
log.assertContains(" splunk.profiler.period.threaddump : PT0.5S");
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class TestMicrometerInstaller method beforeAgent.
@Override
public void beforeAgent(Config config, AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk) {
Tags globalMetricsTags = config.getMap("splunk.testing.metrics.global-tags", emptyMap()).entrySet().stream().map(e -> Tag.of(e.getKey(), e.getValue())).reduce(Tags.empty(), Tags::and, Tags::concat);
SimpleMeterRegistry registry = new SimpleMeterRegistry();
registry.config().meterFilter(MeterFilter.commonTags(globalMetricsTags));
Metrics.addRegistry(registry);
}
use of io.opentelemetry.instrumentation.api.config.Config in project opentelemetry-java-instrumentation by open-telemetry.
the class UserExcludedClassesConfigurerTest method shouldIgnoreClassesAndPackages.
@Test
void shouldIgnoreClassesAndPackages() {
// given
Config config = Config.builder().readProperties(singletonMap(EXCLUDED_CLASSES_CONFIG, "com.example.IgnoredClass,com.example.ignored.*,com.another_ignore")).build();
// when
underTest.configure(config, builder);
// then
verify(builder).ignoreClass("com.example.IgnoredClass");
verify(builder).ignoreClass("com.example.ignored.");
verify(builder).ignoreClass("com.another_ignore");
}
use of io.opentelemetry.instrumentation.api.config.Config in project splunk-otel-java by signalfx.
the class ConfigurationTest method getConfigUrl_endpointNotDefined.
@Test
void getConfigUrl_endpointNotDefined() {
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(otelEndpoint);
String result = Configuration.getConfigUrl(config);
assertEquals(result, otelEndpoint);
}
Aggregations