go-vela / community

Community Information for Vela (Target's official Pipeline Automation Framework)
https://go-vela.github.io/docs/
Apache License 2.0
23 stars 3 forks source link

server(tracing): add a ratio head-sampler #1007

Open plyr4 opened 2 months ago

plyr4 commented 2 months ago

Description

we need a ratio-based sampler that works in conjunction with the rate limit sampler.

we should build it in a way that supports adding any number of samplers with a way to ensure they are prioritized consistently.

we should also figure out a way to use the per-task sampler config to control the ratio sampler. meaning, we should be able to rate-limit and ratio-sample both shared/globally AND for each task name following the pattern introduced in go-vela/server#1184

{
    "/metrics": {
        "active": true,
+        "ratio": 0.2, <- record 20% of total traces for this task
+        "persecond": 5 <- record 5 traces per second for this task
    }
}