iGoogle-ink commented on issue #1062: URL: https://github.com/apache/rocketmq-client-go/issues/1062#issuecomment-1600885954
> > > 也许通过traceConfig 设置不同的groupName 可以解决这个问题 @iGoogle-ink > > > > > > 试过,不行,trace用的是 default的,默认写死的一个 group > > 你能发下相关的代码在哪里吗,我看的是根据传入的groupName 设置的 @iGoogle-ink 当设置多个 client 时,每个 client 都设置 tracer 时,机会出现这样的问题,因为 tracer 的 client 初始化的InstanceName参数是固定的 "INNER_TRACE_CLIENT_DEFAULT",外界无法配置。如下图:  但是,我看代码 internal.GetOrNewRocketMQClient() 函数中,actual, loaded := clientMap.LoadOrStore(client.ClientID(), client) 这段代码,client.ClientID() 获取规则里,并没有用到您说的 GroupName,所以即使在初始化 tracer 时设置了 GroupName 也没用,两个 tracer 会冲突报错,返回空 client,于是返回的 dispacher 就是个空指针了panic。  如果修改 clientid 变动较大,我可以考虑修改 consumer.WithTrace() 方法的入参 primitive.TraceConfig 结构体,增加 InstanceName 项,并且在初始化方法内,cliOp.InstanceName = "INNER_TRACE_CLIENT_DEFAULT" 改为 if traceCfg.InstanceName != "", cliOp.InstanceName = traceCfg.InstanceName -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
