Spring Cloud 整合 SkyWalking

Java Agent server probe

Probe for collecting and transmitting data to an imputation.
Help is given with reference to the official website Setup the Java Agent , we need to use the official probe for us to achieve the purpose of monitoring, according to the actual situation we need to achieve three deployment

  • IDEA deployment probe
  • Java startup mode deployment probe (we are Spring Boot application, you need to use java -jarway to start the application)
  • Docker start deploy probes (needs to be done to build continuous integration effect once run anywhere, this section temporarily to provide solutions to the real part of the back and then realize)

Probe files in apache-skywalking-apm-incubating/agentdirectory

Source directory

 

IDEA deployment probe

The case continues before the project, create a named hello-spring-cloud-external-skywalkingdirectory, and agentcopy the entire directory to come

image

VM operating parameters to modify the project, click on the menu bar Run-> EditConfigurations..., where our nacos-providerproject as an example, modify the parameters as follows

 

-javaagent:D:\Workspace\Others\hello-spring-cloud-alibaba\hello-spring-cloud-external-skywalking\agent\skywalking-agent.jar
-Dskywalking.agent.service_name=nacos-provider
-Dskywalking.collector.backend_service=localhost:11800

image

  • -javaagent: Specifies the path to the probe
  • -Dskywalking.agent.service_name: Used to override the agent/config/agent.configservice name in the configuration file
  • -Dskywalking.collector.backend_service: For rewriting the agent/config/agent.configservice address in the configuration file

Java command-line startup mode

 

java -javaagent:/path/to/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=nacos-provider -Dskywalking.collector.backend_service=localhost:11800 -jar yourApp.jar

Test monitoring

Start nacos-providerproject can be found by looking at the log, we have been successfully loaded probe
注: 如果无法访问到,请重启skywalking容器

image

Written before access interface http: // localhost: 8081 / echo / hi and refresh SkyWalking Web UI, you will find the Service and Endpoint has successfully detected

image

image

So far, it represents SkyWalking link track configuration is successful

SkyWalking Trace monitoring

SkyWalking dependency analysis by business call monitoring, it provides us with a service call topological relationships between services, as well as Trace records for each of Endpoint.

Call link monitoring

Click on Tracethe menu, enter the tracking page

image

Click Trace IDto expand for more information

image

image

The figure shows a normal response, a total response time of 185msa total of Span a (basic unit of work representing a complete request, a response, i.e., request and response)

Span /echo/{message}follows:

  • Duration: 185 ms response time
  • component: the component type is SpringMVC
  • url: Request address
  • http.method: Request Type

Service Performance Monitoring

Click on Servicethe menu, enter the service performance monitoring page

image

Select the desired monitoring service

image

  • Avg SLA: service availability (mainly calculated by requesting success and failures)
  • CPM: call per minute
  • Avg Response Time: Average Response Time

Click More Server Details...can also view details

image

image

The figure above shows the service within a certain range of time-related data, including:

  • Service Availability SLA metrics
  • The average number of responses per minute
  • The average response time
  • Service process PID
  • IP physical machine where the service, Host, OS
  • Run-time CPU usage
  • Runtime heap memory usage
  • Non-heap memory usage is running
  • GC case

Annex A: Detailed Profile

/config/agent.config

# 当前的应用编码,最终会显示在webui上。
# 建议一个应用的多个实例,使用有相同的application_code。请使用英文
agent.application_code=Your_ApplicationName

# 每三秒采样的Trace数量
# 默认为负数,代表在保证不超过内存Buffer区的前提下,采集所有的Trace
# agent.sample_n_per_3_secs=-1

# 设置需要忽略的请求地址
# 默认配置如下
# agent.ignore_suffix=.jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg

# 探针调试开关,如果设置为true,探针会将所有操作字节码的类输出到/debugging目录下
# skywalking团队可能在调试,需要此文件
# agent.is_open_debugging_class = true

# 对应Collector的config/application.yml配置文件中 agent_server/jetty/port 配置内容
# 例如:
# 单节点配置:SERVERS="127.0.0.1:8080" 
# 集群配置:SERVERS="10.2.45.126:8080,10.2.45.127:7600" 
collector.servers=127.0.0.1:10800

# 日志文件名称前缀
logging.file_name=skywalking-agent.log

# 日志文件最大大小
# 如果超过此大小,则会生成新文件。
# 默认为300M
logging.max_file_size=314572800

# 日志级别,默认为DEBUG。
logging.level=DEBUG

 

Published 35 original articles · won praise 1 · views 10000 +

Guess you like

Origin blog.csdn.net/u010494101/article/details/104693859