参考:官网集成说明
-javaagent:D:/codesoft/elastic-apm-agent-1.18.0.jar -Delastic.apm.service_name=maniy-application -Delastic.apm.server_urls=http://localhost:8200 -Delastic.apm.application_packages=com.maniy -Delastic.apm.secret_token=
co.elastic.apm
apm-agent-attach
1.33.0
import co.elastic.apm.attach.ElasticApmAttacher;
import org.springframework.boot.SpringApplication;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
ElasticApmAttacher.attach();
SpringApplication.run(MyApplication.class, args);
}
}
#在配置文件elasticapm.properties中添加如下配置
service_name=maniy-service
application_packages=com.maniy
server_urls=http://127.0.0.1:8200
或者在application.yml中
#elastic APM 应用监控
elastic:
apm:
server_name: ${spring.application.name}
application_packages: com.maniy
# 支持使用路径
use_path_as_transaction_name: true
server_urls: http://127.0.0.1:8200