未验证 提交 7ba623d0 编写于 作者: C chase 提交者: GitHub

add WithMaxSendQueueSize function to configuration the send span queue buffer length (#61)

上级 03a0d515
......@@ -78,6 +78,13 @@ func WithCheckInterval(interval time.Duration) GRPCReporterOption {
}
}
// WithMaxSendQueueSize setup send span queue buffer length
func WithMaxSendQueueSize(maxSendQueueSize int) GRPCReporterOption {
return func(r *gRPCReporter) {
r.sendCh = make(chan *agentv3.SegmentObject, maxSendQueueSize)
}
}
// WithInstanceProps setup service instance properties eg: org=SkyAPM
func WithInstanceProps(props map[string]string) GRPCReporterOption {
return func(r *gRPCReporter) {
......
......@@ -143,6 +143,15 @@ func TestGRPCReporterOption(t *testing.T) {
}
},
},
{
name: "with max send queue size",
option: WithMaxSendQueueSize(50000),
verifyFunc: func(t *testing.T, reporter *gRPCReporter) {
if cap(reporter.sendCh) != 50000 {
t.Error("error are not set WithMaxSendQueueSize")
}
},
},
{
name: "with serviceInstance props",
option: WithInstanceProps(instanceProps),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册