The Developer Publishing Hub
One platform to write, cross-post to Dev.to, Medium, WordPress, Hashnode, and Bluesky, and protect your SEO with canonical links. Zero paywalls and full content ownership.
Markdown supported · ⌘↵ to post
Keeping every error and slow trace covers most services, but model calls tend to fail quietly. I had an agent trace come back green end to end while the agent had done nothing, and a run like that is fast and error-free. So for LLM calls I wouldn't push the routine sample rate anywhere near zero.
Putting the Collector in the middle as the cost-control point is a sound design, and the tail_sampling example shows why. One caveat is that tail sampling only works if every span of a trace reaches the same Collector instance, so once you run more than one replica you need a load-balancing exporter layer keyed on trace ID in front of it. Also, decision_wait of 10s with long-running traces can drop late spans from the decision, and the memory cost scales with traces held in flight, so num_traces and the memory_limiter deserve explicit tuning. A related question is how to keep the RED metrics accurate after sampling, since computing request counts from sampled traces undercounts unless the spanmetrics connector runs before the sampler. Would you generate those metrics ahead of the sampling stage in this reference stack?
One thing I’d emphasize is that observability cost should be measured against the cost of diagnosing an incident, not just the volume of telemetry collected. Aggressive sampling can save money, but if it removes the context needed to reconstruct a failed request, the savings can quickly disappear.
At IT Path Solutions, we see this as an important part of building production-ready systems: correlate logs, metrics, and traces around critical workflows, while keeping high-cardinality identifiers out of metric labels. I’d also make sure sampling preserves error and slow traces across service boundaries. The goal isn't to collect everything; it's to retain enough context to explain what went wrong when it matters.
jacob foster
Great breakdown of observability for small teams. I especially agree with starting with metrics before adding logs and traces. Open-source tools can save licensing costs, but without proper retention policies, sampling, and cardinality control, infrastructure costs can still grow quickly. A lean setup with the right alerts is often much more valuable than collecting everything from day one.