zoukankan      html  css  js  c++  java
  • 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 都要使用编译后的包。 具体编译操作见我们的 编译环境搭建。

  • 相关阅读:
    oracle 体系结构
    Oracle存储过程语法
    oracle 触发器
    oracle 存储过程
    oracle 高水位线详解
    oracle索引总结
    Oracle的表空间、数据文件、用户
    Oracle实例和数据库区别
    [whu1564]后缀数组
    [hdu4552]最长公共前缀
  • 原文地址:https://www.cnblogs.com/operationhome/p/14016382.html
Copyright © 2011-2022 走看看