elastic apm client部署

1.
1.1 通过javaagent手动设置

nohup java \

-javaagent:/home/user/elastic-apm-agent-1.16.0.jar\

-Delastic.apm.service_name=dstatus\

-Delastic.apm.server_urls=http://10.88.0.**:8200\

-Delastic.apm.application_packages=com.**.rt.dstatus\

-jar dstatus-0.0.1-SNAPSHOT.jar &

1.2 可以通过进程号自动挂载

java -jar apm-agent-attach-1.17.0-standalone.jar --pid 124542 --config 'service_name=**;server_urls=http://10.88.0.**:8200'

2. API编程模式

2.1 pom.xml增加依赖


            co.elastic.apm
            apm-agent-attach
            1.16.0
 

 2.2 编辑resource目录下的elasticapm.properties

service_name=pg-manage
server_urls=http://10.88.0.**:8200
application_packages=cn.com.***.pg.manager

2.3 编写application.java

package com.***.camera;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import co.elastic.apm.attach.ElasticApmAttacher;
@SpringBootApplication
public class CameraApplication
{
  public static void main(String[] args)
  {
      ElasticApmAttacher.attach();
      SpringApplication.run(CameraApplication.class, args);
  }
 

你可能感兴趣的:(ElasticSearch)