jvm参数方式:
-javaagent:D:/codesoft/elastic-apm-agent-1.18.0.jar -Delastic.apm.service_name=my-application -Delastic.apm.server_urls=http://localhost:8200 -Delastic.apm.application_packages=com.xf -Delastic.apm.secret_token=
code方式:
<dependency> <groupId>co.elastic.apm</groupId> <artifactId>apm-agent-attach</artifactId> <version>1.18.0</version> </dependency>
public static void main(String[] args) {
ElasticApmAttacher.attach(); SpringApplication.run(MagspaceApplication.class, args); }
#在配置文件elasticapm.properties中添加如下配置 service_name=my-cool-service application_packages=com.xf server_urls=http://127.0.0.1:8200