Documentation
¶
Overview ¶
Command sw-trace-sampler is the first-party post-trace sampler for the SkyWalking-native segment schema (group sw_trace, BanyanDB trace "segment"). It implements the Scenario 6.1 keep logic from docs/design/post-trace-pipeline.md on the real segment columns:
- trace duration from the envelope of the segment "start_time"/"latency" tags (ms),
- keepErrors from the first-class is_error tag,
- keepTagRules matched against the flattened searchable-tag array "tags" (entries "key=value", e.g. "db.type=PostgreSQL"),
- and a deterministic healthySampleRate hash of the trace id.
Config JSON (from SamplerPlugin.config):
{
"durationThresholdMs": 500,
"keepErrors": true,
"healthySampleRate": 0.1,
"keepTagRules": [
{ "tagKey": "db.type", "equals": "PostgreSQL" },
{ "tagKey": "mq.queue", "equals": "queue-songs-ping" }
]
}
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).