Fork me on GitHub

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 都要使用编译后的包。 具体编译操作见我们的 编译环境搭建。

posted @   自由早晚乱余生  阅读(1947)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
点击右上角即可分享
微信分享提示