{"post":{"slug":"opentelemetry-setup-guide-2026","title":"OpenTelemetry Setup: Instrumenting Without Regret","excerpt":"OpenTelemetry decouples instrumentation from your observability vendor. Here is a setup order that works, what to instrument first, and the cardinality trap.","category":"code","date":"August 11, 2026","author":"ByteLedger Team","content":"<span class=\"dropcap\">T</span>he practical argument for OpenTelemetry is not that it produces better telemetry than a vendor agent. It is that the instrumentation lives in your code under a neutral standard, so changing observability vendors becomes a configuration change rather than a re-instrumentation project. Anyone who has migrated between monitoring vendors understands why that matters.\n\nGetting there is straightforward if you do it in the right order and avoid one expensive mistake.\n\n## What changed in 2026\n\n- **Automatic instrumentation coverage broadened.** Language agents and libraries covered more frameworks out of the box, reducing how much manual work adoption requires.\n- **Semantic conventions stabilized further.** Standard attribute names across HTTP, databases, messaging, and generative AI meant dashboards ported between backends more cleanly.\n- **Collector deployment became the default recommendation.** Exporting directly from applications gave way to routing through a collector for sampling, redaction, and vendor flexibility.\n- **Cost incidents made cardinality a first-class concern.** Enough teams generated surprise bills from unbounded attribute values that guidance shifted toward explicit cardinality review.\n\n## The order that works\n\n| Step | Effort | Value |\n| --- | --- | --- |\n| 1. Enable automatic instrumentation | Low | Immediate trace coverage of HTTP and database calls |\n| 2. Deploy a collector | Low | Central control over sampling, redaction, and routing |\n| 3. Propagate context across services | Low | Traces span service boundaries instead of fragmenting |\n| 4. Add correlation identifiers to logs | Low | Logs join to traces |\n| 5. Add manual spans at real gaps | Medium | Detail where automatic coverage is thin |\n| 6. Tune sampling | Medium | Cost control without losing the interesting traces |\n| 7. Custom metrics | Medium | Business-level signals |\n\nAutomatic instrumentation first, always. It delivers most of the value for a fraction of the effort, and it shows you where the gaps actually are — which is a much better guide to where manual spans belong than guessing beforehand.\n\nContext propagation deserves attention because it is where multi-service tracing succeeds or fails. If service A does not pass trace context to service B, you get two disconnected traces instead of one, and the whole point evaporates. Automatic instrumentation usually handles this for standard HTTP clients; custom transports and message queues frequently need explicit work.\n\n## The cardinality trap\n\nCardinality is the number of distinct combinations of attribute values. On traces it is mostly harmless — each span is stored individually. On metrics it is multiplicative, because each unique combination creates a separate time series.\n\nAdding a user identifier as a metric attribute creates one time series per user. Adding a request identifier creates one per request. Bills from this are not slightly higher; they are orders of magnitude higher, and the failure is silent until the invoice arrives.\n\nThe rule is simple: metric attributes must be bounded and low-cardinality — status code, region, service name, endpoint pattern rather than the actual URL with identifiers in it. High-cardinality detail belongs on spans and log events, where the storage model handles it.\n\nTail sampling in the collector is the other cost lever worth setting up. Rather than sampling randomly at the source, tail sampling decides after seeing the complete trace — so you can keep all errors and slow requests while sampling the fast successful majority heavily. That preserves exactly the traces you would want during an incident, and it interacts well with the structured events described in [structured logging guide](/blog/structured-logging-guide-2026).\n\n## Common mistakes\n\n- **High-cardinality metric attributes.** The most expensive mistake in the whole ecosystem.\n- **Exporting directly from applications.** Works, and leaves you with no central place to sample or redact.\n- **Skipping context propagation.** Produces fragmented traces that answer nothing.\n- **Hand-instrumenting before enabling automatic coverage.** Duplicated effort and inconsistent attribute naming.\n- **Head sampling only.** Random sampling at source discards errors at the same rate as successes.\n\n## FAQ\n\n**Does OpenTelemetry replace my monitoring vendor?**\nNo. It is the instrumentation and transport layer. You still send the data to a backend, and the point is that you can change which one.\n\n**What is the performance overhead?**\nTypically small — a few percent for automatic instrumentation in most languages. Verify under load rather than assuming, particularly in very high-throughput services.\n\n**Should I use it for logs too?**\nLog support has matured and works well when you want a single pipeline. Many teams keep existing log shipping and use OpenTelemetry for traces and metrics initially.\n\n**Can I run it alongside an existing vendor agent?**\nUsually, though duplicate instrumentation causes confusing double-counted spans. Plan a migration rather than a permanent overlap.\n\n## Where to go next\n\nFor the log side, read [structured logging guide](/blog/structured-logging-guide-2026). For tracing across a federated API, [GraphQL federation](/blog/graphql-federation-2026), and for AI-specific tracing, [AI agent observability](/blog/ai-agent-observability-2026).","hue":260,"metaTitle":"OpenTelemetry Setup Guide for 2026","metaDescription":"How to adopt OpenTelemetry in the right order — automatic instrumentation, running a collector, sampling strategy, and avoiding the cardinality cost trap.","keywords":["opentelemetry setup guide","otel collector configuration","distributed tracing setup","auto instrumentation","span attributes cardinality","tail sampling tracing","observability vendor portability","traces metrics logs","telemetry pipeline 2026"],"tldr":["**The point is vendor portability** — instrument once, change backends without re-instrumenting your code.","**Start with automatic instrumentation** — it covers HTTP, database, and framework spans for very little effort.","**Run a collector rather than exporting directly** — it gives you one place to sample, redact, and reroute.","**High-cardinality attributes are the cost bomb** — a unique identifier on a metric can multiply your bill enormously.","**Skip:** hand-instrumenting everything up front. Add manual spans where automatic coverage leaves a gap you actually hit."],"readTime":"4 min read","wordCount":805},"related":[{"slug":"observability-vs-monitoring-2026","title":"Observability vs monitoring in 2026: what you actually need to run production","excerpt":"Monitoring tells you something broke; observability tells you why. In 2026 the distinction has real tooling and cost consequences every engineering team faces.","category":"code","date":"April 7, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":319},{"slug":"how-to-monitor-a-service-2026","title":"How to monitor a service in 2026: metrics, logs, traces, and alerts that work","excerpt":"A service without observability is a black box you only look inside after something breaks. Here is the 2026 guide to metrics, logs, traces, and alerts.","category":"code","date":"April 1, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":319},{"slug":"best-observability-tools-2026","title":"Best observability tools in 2026: see what your system is doing","excerpt":"A practical comparison of observability tools in 2026 - Datadog, Grafana, OpenTelemetry, and more - covering logs, metrics, traces, and cost control.","category":"code","date":"May 27, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":212}],"sameCategory":[{"slug":"bazel-build-explained-2026","title":"Bazel Explained: What Hermetic Builds Actually Cost","excerpt":"Bazel delivers reproducible, precisely cached builds and demands that you describe everything. Here is what you get, what it costs, and who should say no.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":145},{"slug":"graphql-federation-2026","title":"GraphQL Federation: One Graph, Many Teams","excerpt":"Federation composes independently-owned subgraphs into a single API. Here is what it solves, the operational cost it adds, and when a simpler gateway is enough.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":300},{"slug":"hermetic-builds-explained-2026","title":"Hermetic Builds Explained: Same Inputs, Same Output","excerpt":"A hermetic build depends only on declared inputs. Here is what that property gives you, the common leaks that break it, and how to move toward it incrementally.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":130},{"slug":"monorepo-tooling-compared-2026","title":"Monorepo Tooling Compared: What You Actually Need","excerpt":"Monorepo tools solve task orchestration and caching, not repository layout. Here is what each tier provides and how to tell when you have outgrown the simple option.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":150}],"newer":{"slug":"multimodal-rag-explained-2026","title":"Multimodal RAG Explained: Retrieval Over Images and PDFs","excerpt":"Most real documents are not plain text. Here is how multimodal retrieval handles charts, scans, and tables, and where text-only pipelines silently lose information.","category":"ai","date":"August 11, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":209},"older":{"slug":"query-rewriting-for-rag-2026","title":"Query Rewriting for RAG: Fixing the Question First","excerpt":"Users do not phrase questions the way documents phrase answers. Rewriting the query before searching closes that gap and costs one cheap model call.","category":"ai","date":"August 11, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":202}}