Observability · OpenTelemetry

Ship federated GraphQL telemetry to any OpenTelemetry backend

The Cosmo Router uses the OpenTelemetry Go SDK to emit traces and metrics for every GraphQL operation. Export over HTTP or gRPC, run multiple exporters side-by-side, and keep one router configuration for every backend.

Native OTEL Go SDK. Zero-code instrumentation. No custom instrumentation library.

One router, many OTEL backends

Cosmo RouterOTEL Go SDK · traces + metrics
OTLP / HTTP or gRPCCosmo CloudGraphQL analyticsDatadog / JaegerExisting APMPrometheusMetricsConfigure multiple exporters in the router config.

Available onFreeProEnterprise

The problem

GraphQL observability is hard to build and harder to maintain

Federated GraphQL needs traces and metrics that carry operation, subgraph, and client context. Generic HTTP telemetry does not.

Custom GraphQL instrumentation is its own product to maintain

Teams need traces and metrics for federated GraphQL, but rolling their own spans and label schemes ends in drift, gaps, and bespoke exporters in every service.

One backend is rarely the whole story

Production observability often spans GraphQL-specific analytics in one platform and company-wide dashboards in another. Configuring two exporters per service multiplies surface area.

High-cardinality labels break the monitoring stack

Without exclusion patterns or a cardinality limit, GraphQL operation labels can overwhelm metrics backends. Teams strip the dimensions that made the data useful in the first place.

Our solution

OpenTelemetry, built into the router

The router emits OTLP traces and metrics through the OpenTelemetry Go SDK. Configure exporters in router YAML. Enrich signals with attributes from headers or expressions. Control cardinality with built-in limits and regex exclusions.

What happens on every request

  1. The Cosmo Router uses the OpenTelemetry Go SDK to instrument every GraphQL operation.

  2. Traces capture parsing, validation, planning, and execution across each subgraph; metrics follow the R.E.D. method.

  3. Data is exported over OTLP (HTTP or gRPC) to any OTEL-compatible backend.

  4. Multiple exporters can run side-by-side, so the same telemetry can land in Cosmo Cloud, Datadog, Jaeger, and more at once.

  5. W3C Trace Context propagates by default; Jaeger, B3, and Baggage propagation are available as options.

  6. Static resource attributes and dynamic attributes from request headers or expressions enrich every signal.

One router, one config, every OTEL-compatible backend.

OpenTelemetry

Before & After

Before CosmoWith Cosmo
Custom instrumentation and exporters in every serviceNative OTEL Go SDK in the router, zero application code changes
One backend per service or duplicated exporter configMultiple OTLP exporters in one router config, side-by-side
GraphQL operation labels overwhelm metrics backendsBuilt-in cardinality limit (2000) and regex exclusions
Generic HTTP telemetry without federated GraphQL contextSpans for parse, plan, and subgraph execution with GraphQL-aware dimensions

Cardinality controls

How metric cardinality is kept in check

Two layers protect your metrics backend from runaway label growth:

  • 2000 combinations per metric. A built-in default cardinality limit. Once reached, further datapoints are stored without attributes.
  • Regex exclusions. Remove specific labels or whole metrics by pattern.

Configure once in the router; cardinality stays bounded for every exporter downstream.

How OpenTelemetry works in Cosmo Router

01
Zero-code OTEL spans for federated traffic.

Instrument

The router auto-instruments every GraphQL operation with the OpenTelemetry Go SDK. Spans cover parsing, validation, planning, and subgraph execution. No application code changes.

02
One router, many backends, no per-app exporter.

Export

Configure HTTP or gRPC exporters in the router config. Multiple exporters run side-by-side, so the same data can land in Cosmo Cloud, Datadog, Jaeger, and other OTEL-compatible backends at once.

03
Custom attributes from headers and expressions.

Enrich

Static resource attributes identify the service; dynamic attributes pull from request headers or expressions. Add environment, region, or client version without touching application code.

04
2000-combination cap; excess stored without labels.

Control

A default cardinality limit of 2000 unique combinations per metric bounds label growth. Once the limit is reached, further datapoints are stored without attributes. Regex exclusions remove specific labels or metrics you do not want to ship.

Examples

OTLP export to Cosmo Cloud

A single telemetry block configures traces and metrics. Add exporters explicitly, or omit them to use the Cosmo Cloud default.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Full exporter and attribute reference in the OpenTelemetry documentation.

Telemetry controls

Transport, propagation, and export tuning

Configure protocol, trace propagation, attributes, and export intervals per pipeline, all in router YAML.

Transport

OTLP over HTTP or gRPC. Pick the transport per exporter. Use HTTP for backends behind standard reverse proxies and gRPC for high-throughput pipelines.

Propagation

W3C Trace Context propagates by default. Jaeger, B3, and Baggage are available as options for compatibility with existing tracing stacks.

Attributes

Static resource attributes identify the service. Dynamic attributes pull from request headers or expressions. Custom attributes require Cosmo Router 0.92.0 or later.

Export interval

Metrics export at a default interval of 15 seconds. Configurable per pipeline if you need to push or pull data more or less aggressively.

Ship OTEL from the router, not every service

One telemetry block, multiple exporters, GraphQL-aware spans, configured once in router YAML.

FAQ

OpenTelemetry on Cosmo Router

Deep dive in the OpenTelemetry documentation.