Documentation
¶
Overview ¶
Command zipkin-trace-sampler is the first-party post-trace sampler for the Zipkin schema (group sw_zipkinTrace, BanyanDB trace "zipkin_span"). It implements the Scenario 6.2 keep logic from docs/design/post-trace-pipeline.md on the real Zipkin columns:
- trace duration from the envelope of the "timestamp_millis"/"duration" tags (duration is µs),
- keepTagRules matched against the flattened "query" array, whose entries include both bare keys and "key=value" such as "http.status_code=500",
- and a deterministic healthySampleRate hash of the trace id.
The Zipkin schema has no is_error column. keepErrors instead detects Zipkin's conventional "error" span tag, which OAP flattens into "query" as both a bare key and "error=<message>". That is a tag convention, not an authoritative field: instrumentations that only signal failure through http.status_code 5xx or otel.status_code need an explicit rule, e.g. 'http.status_code=~5\d\d'.
Config JSON (from SamplerPlugin.config):
{
"durationThresholdMs": 1000,
"keepErrors": true,
"healthySampleRate": 0.05,
"keepTagRules": [
{ "tagKey": "query", "regex": "http\\.status_code=5\\d\\d" }
]
}
Build it as a Go plugin with `make build-plugins`; it must use the same Go toolchain and pinned pkg/pipeline/sdk as the data node (see plugins/README.md).