We are going to use Elastic stack for microservices. Our micro services are spring boot based.
I am writing a spring starter project to automatically attach APM server so that every micro service need not write code to attach apm servers but they just need to include elastic-apm-starter to the microservice.
I am planning to user "attach(Map<String, String> configuration)" method from ElasticApmAttacher. I am implementing a APMConfiguration bean to load properties from application.properties and a provide method which returns configuration as Map<String, String>
@Configuration
@ConfigurationProperties(prefix = "elastic.apm")
public class ElasticAPMConfiguration {
public Map<String, String> getConfiguration() {
//...
}
}
Main idea for doing this is, i want to push the configuration from external configuration management tool.
As per you code, we are loading this properties and passing it to elastic APM once.
How does the elastic apm agent'ss dynamic configuration changes made available for Elastic APM?
For example, as per documentation, elastic.apm.active is a dynamic property. If i change elastic.apm.active in my application.properties how to push this change to APM agent?
The way to apply changes to dynamic configurations is by updating it's value in one of the configuration sources. Since the elasticapm.properties file is irrelevant in your case, you would need to set a new value to the system property (or environment variable). If you can register a listener that will get notified when new configuration options are available, it can programmatically set new values to the system properties, thus apply the new config.
Please note that we recently added the ability to centrally apply agent configuration through Kibana (still in beta). Currently, this feature only includes the transaction sample rate, but we are working on expanding it. The active configuration is a prime candidate for that, but it will not be included in 7.5 because we first want to make sure we apply the same semantics to it across our agents. Hopefully, it will be supported as well some time in the near future.
@Eyal_Koren Thanks for the suggestions. Approach you proposed seems a good option. Howevere we are looking for native support for elastic itself. Hopefully we will get this in near future.
Also is there any plan to provide a starter project? Probably we can also open source the starter project for elastic APM agent which we are developing.
There are no current such plans.
If you are interested in open-sourcing it, that would be awesome!! The apm-contrib repo seems like a proper home for such project.
Just make sure it is generic enough to be reused for as many use cases as possible, and it is documented properly.
Thanks!
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.