I'm attaching APM agent in my Spring Boot application like this:
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
ElasticApmAttacher.attach();
SpringApplication.run(MyApplication.class, args);
}
}
}
I created elasticapm.properties file in my resource folder and everything works fine.
However I'd like to se the environment property in the file programatically because I run the application with different Spring profile and I want APM add the right environment to logs.
I tried to pass a Map<String,String> to attach() method but it seems in this way values set in my property file is not read.
You are initializing the agent using the Programatic API, which has some limitations when combined with other ways to provide configuration.
As explained in our configuration page in documentation, configuration sources for (5) are mutually exclusive, and in your case you are trying to mix items in (b) and (c).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.