SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
447 stars 122 forks source link

How to get the size and capacity send queue ? #79

Closed eyjian closed 2 years ago

eyjian commented 3 years ago

场景: 动态调整上报采样率,在低上报时全采样,随着队列大小增加降低采样率。对于GRPCReporter可如下实现,LogReporter没有对应的实现。

` // GetSendQueueSize return the size of send queue and the capacity of send queue func GetSendQueueSize(reporter interface{}) (int, int) {

r, ok := (reporter).(gRPCReporter)
if !ok {
    return -1, -1
} else {
    return len(r.sendCh), cap(r.sendCh)
}

} `

arugal commented 3 years ago

Hi @eyjian, 看起来不错,可以增加一种新的 Sampler 实现,你有兴趣实现吗?