Pinpoint agent 手册

本文基于 Pinpoint 2.1.0 版本, 本文 的agent 是已经更改过的源码后编译的,具体改动的部分就是: agentID 长度 和 name 的限制。

  1. 更改后: agentID 和Name 支持 48位字符,默认只支持 24位

场景: 我们的场景是部署在容器中

实现: 我们通过在所有的容器所在的宿主机进行存放 agent 包,然后 容器进行挂载目录,挂载完目录后通过更改 启动命令来进行加载。

一、配置文件修改

配置文件 pinpoint-root.config

配置中profiler.collector.ipprofiler.transport.grpc.collector.ip 文件所有使用到这个配置的,都需要更改为我们的 collector 的IP。

采样率更改 profiler.sampling.rate

# 1 out of n transactions will be sampled where n is the rate. (1: 100%, 20: 5%)
profiler.sampling.rate=10

设置为 10 表示采样 10%(1/10)

二、启动命令设置

涉及到以下几个配置

  • -javaagent:$AGENT_PATH/pinpoint-bootstrap-$VERSION.jar

Additionally, Pinpoint Agent requires 2 command-line arguments in order to identify itself in the distributed system:

  • -Dpinpoint.agentId - uniquely identifies the application instance in which the agent is running on
  • -Dpinpoint.applicationName - groups a number of identical application instances as a single service
  • -Dpinpoint.container in addition to the 2 required command-line arguments above when launching the agent.

示例:

注意同一个应用的多个实例,遵循,applicationName 要一致, agentId 要区分。

将下面的命令配置到 JAVA_OPTS 或者直接加到启动命令。

-javaagent:/opt/pinpoint/pinpoint-agent/pinpoint-bootstrap.jar  -Dpinpoint.agentId=${SERVICE_NAME}  -Dpinpoint.applicationName=${CONTAINER_NAME%_*}  -Dpinpoint.container=${SERVICE_NAME}

需要注意的是我上面的配置不是通用了,因为我是获取了环境变量的值然后进行切割 , ${SERVICE_NAME} {CONTAINER_NAME%_*}

原文地址:https://www.cnblogs.com/operationhome/p/14016534.html