• Pinpoint 更改agentid 和 agent name 长度限制(Pinpoint系列二)


    本文基于 Pinpoint 2.1.0 版本

    本文的内容为了更改 ID 和 Name 长度限制,因为有使用容器或者是服务名称确实比较长,所以根据业务场景,我们需要更改源码来实现这个。

    具体更改,参考 https://github.com/pinpoint-apm/pinpoint/pull/6015/commits/29ab391de758336900256ef0ce24d806e3a1eab5。

    更改的位置

    bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/IdValidator.java

       private final BootLogger logger = BootLogger.getLogger(IdValidator.class.getName());
    
        private final Properties property;
        # private static final int MAX_ID_LENGTH = 24;   
        private static final int MAX_ID_LENGTH = 48;
    
        public IdValidator() {
            this(System.getProperties());
    

    commons-server/src/main/java/com/navercorp/pinpoint/common/server/util/RowKeyUtils.java

           if (fixedBytes == null) {
                throw new NullPointerException("fixedBytes must not null");
            }
           # if (fixedBytes.length > maxFixedLength) {
            if (fixedBytes.length > 48) {
                throw new IndexOutOfBoundsException("fixedBytes.length too big. length:" + fixedBytes.length);
            }
            byte[] rowKey = new byte[maxFixedLength + LONG_BYTE_LENGTH];
    

    commons/src/main/java/com/navercorp/pinpoint/common/PinpointConstants.java

    public final class PinpointConstants {
    
       # public static final int APPLICATION_NAME_MAX_LEN = 24;
        public static final int APPLICATION_NAME_MAX_LEN = 48;
    
       # public static final int AGENT_NAME_MAX_LEN = 24;
        public static final int AGENT_NAME_MAX_LEN = 48;
    
    }
    

    上面所有注释的位置,都是源代码,下面的是我更改后的。我这边更改过后的长度为 48。更改完之后,我们重新编译打包即可。

    注意

    agent collectorweb 都要使用编译后的包。 具体编译操作见我们的 编译环境搭建。

  • 相关阅读:
    python base64加密文本内容(1)
    python 翻译爬虫
    json为txt文本加密
    python json
    repr()函数
    linux 基本命令
    测试管理工具--禅道
    测试基础理论
    测试用例--场景法
    测试用例--测试大纲(提纲)法
  • 原文地址:https://www.cnblogs.com/operationhome/p/14016382.html
Copyright © 2020-2023  润新知