Skip to main content
The package exposes one knob for trace sampling: samplingRate. It maps directly to OpenTelemetry’s TraceIdRatioBasedSampler.

How it works

TraceIdRatioBasedSampler(rate) keeps a deterministic fraction of traces by hashing the trace id. Same trace → same decision across services, which keeps distributed traces consistent.

Setting it

ConfigValidator rejects anything outside [0, 1]:

What gets sampled

If you need to reduce safety-check load, you have to gate the wrapper itself (e.g. only wrap a few high-risk tools).

Local dev

samplingRate: 1.0 — see everything.

Staging

samplingRate: 1.0 — keep volume comparable to prod’s signal-to-noise.

Production

samplingRate: 0.10.25 — adjust by tool volume and storage budget.

Tail sampling instead?

samplingRate is head-based — the decision is made when the trace starts. If you want to keep all errored traces while dropping most successes, you’ll want tail sampling, which lives in an OpenTelemetry Collector, not the SDK. Point exporterEndpoint at a collector with the tail_sampling processor configured.
otel-collector.yaml
Then run @sedata-ai/mcp with samplingRate: 1.0 so the collector receives everything and makes the call.

Disabling tracing entirely

If you want metrics-only:
This skips the trace exporter and sampler — no span allocations at all.

Next

Telemetry pipeline

Where samplers fit in the broader export path.

Production deployment

Pre-flight checklist for prod.