Documentation
¶
Overview ¶
Command segment-tail-sampler is the reference post-trace sampler plugin from docs/design/archive/0.11.0/post-trace-pipeline.md §6.1. It is a worked example of the pkg/pipeline/sdk contract and illustrates the three things a real plugin must do:
- Parse the operator-supplied config. SamplerPlugin.config is a google.protobuf.Struct; the engine serializes it to canonical JSON and hands it to NewSampler as bytes, which this plugin unmarshals into its own typed config.
- Declare a projection (Project) so the engine materializes only the columns the verdict reads — here a handful of tag columns, plus the span-id column only when a span-count rule is configured.
- Extract tags and spans from the vectorized batch in Decide — decoding tag values by their ValueType and reading the span-id column.
Build it as a Go plugin (it is deliberately under an _example directory so `go build ./...` and the linters skip it):
go build -buildmode=plugin -trimpath \ -o segment-tail-sampler.so \ ./pkg/pipeline/sdk/_example/segment-tail-sampler
It must be built with the same Go toolchain and the same pinned pkg/pipeline/sdk as the running data node (see §2.5).