use of org.stagemonitor.configuration.source.SystemPropertyConfigurationSource in project apm-agent-java by elastic.
the class ElasticApmTracerBuilder method getDefaultConfigurationRegistry.
private ConfigurationRegistry getDefaultConfigurationRegistry() {
try {
final ConfigurationRegistry configurationRegistry = ConfigurationRegistry.builder().addConfigSource(new PrefixingConfigurationSourceWrapper(new SystemPropertyConfigurationSource(), "elastic.apm.")).addConfigSource(new PrefixingConfigurationSourceWrapper(new EnvironmentVariableConfigurationSource(), "ELASTIC_APM_")).addConfigSource(new PropertyFileConfigurationSource("elasticapm.properties")).optionProviders(ServiceLoader.load(ConfigurationOptionProvider.class, ElasticApmTracer.class.getClassLoader())).failOnMissingRequiredValues(true).build();
configurationRegistry.scheduleReloadAtRate(30, TimeUnit.SECONDS);
return configurationRegistry;
} catch (IllegalStateException e) {
logger.warn(e.getMessage());
return ConfigurationRegistry.builder().addConfigSource(new SimpleSource("Noop Configuration").add(CoreConfiguration.ACTIVE, "false").add(CoreConfiguration.INSTRUMENT, "false").add(CoreConfiguration.SERVICE_NAME, "none").add(CoreConfiguration.SAMPLE_RATE, "0")).optionProviders(ServiceLoader.load(ConfigurationOptionProvider.class, ElasticApmTracer.class.getClassLoader())).build();
}
}
Aggregations