Kibana version:
6.6.1
Elasticsearch version:
6.6.1
APM Server version:
6.6.1
APM Agent language and version:
java-agent-1.4.0
Issue
I have a few grails@2.2.4 applications, a few grails@3.3.1 applications, and a couple of pure springBoot@1.5.6 applications. I'm trying to setup elastic as a platform for both APM and metric collection/monitoring for all of them.
I initially tested Elastic APM with the javaagent loaded via VMOptions, and was successful in it. I then tested the programmatic API to self-attach the agent in runtime, and was also successful with it[1].
Issue [1]: For grails@2.2.4, there's no equivalent of src/main/resources/elasticapm.properties
that I could find (I didn't debug the agent to see where it was looking for, maybe I'm wrong). Thus, I reverted back to using VMOptions for configuration while still loading the agent via the programmatic API in runtime. Even though configuration wasn't ideal, it worked fine.
Now, I went through the thin API of ElasticApmAttacher
and there doesn't seem to be a way to do a local attach
(not a remote one) and provide configuration during the call to ElasticApmAttacher.attach()
. It'd be incredibly easier and more powerfull in terms of customization and proper environment/service/version detection (none of the other configuration methods come close) if we could, for example:
ElasticApmAttacher.attach([
service_name: "bacon-service",
service_version: ReadFromSomewhereElse.getVersion(),
environment: GrailsSomething.getCurrentEnvironment(),
transaction_sample_rate: Redis.getIt(),
log_level: "WARN",
server_urls: ReadFromConsul.forExample()
])
I suppose I could hack into the ElasticApmAttacher#attach(java.lang.String, java.lang.String)
method and try to attach to the current VM as if it were a remote one (so that I could pass the agentArgs
along), but that doesn't seem idiomatic or proper.
Is there already a way to achieve this? Am I missing something? Would this be interesting in general?
Also, one last question, why exactly is the programmatic API to self-attach marked as experimental? Are there any limitations? It seems to work perfectly on java7 zulu for me.