Add the spanmetrics connector to the OTel Collector config under the connectors section; configure it with histogram settings (explicit or exponential bucket boundaries) for latency, and set namespace to prefix generated metric names.
Wire the connector in the pipelines section: the traces pipeline must include spanmetrics in its exporters list, and a metrics pipeline must list spanmetrics in its receivers list; the connector sits at the junction between these two pipelines.
Configure dimensions in the spanmetrics connector to extract span attributes as metric labels (e.g., http.method, http.status_code, rpc.service); keep the cardinality of chosen dimensions low to avoid metric explosion.
Set metrics_flush_interval to control how often accumulated span metrics are flushed to the metrics pipeline; shorter intervals produce more up-to-date metrics but increase cardinality management overhead.
Forward the generated metrics (calls_total, duration, and optionally errors_total) to a Prometheus-compatible exporter or remote_write endpoint; configure the Prometheus exporter with a scrape endpoint or use prometheusremotewrite exporter.
Build Grafana or Datadog dashboards using the generated metrics to display request rate (calls_total rate), error rate (errors_total / calls_total), and latency percentiles (from the histogram) as the RED dashboard columns.
Known gotchas
The spanmetrics connector generates metrics only for spans that pass through the traces pipeline it is connected to; if tail sampling drops certain traces before spanmetrics processes them, the generated metrics will undercount those requests.
Exponential histograms produce fewer metric series than explicit bucket histograms but require a backend that supports native histograms (Prometheus with --enable-feature=native-histograms or compatible remote storage); using exponential histograms with a backend that only supports standard histograms will result in conversion or dropped data.
Changing dimension configuration after initial deployment causes existing metric series to become orphaned (old label sets stop receiving data) while new series start; dashboards or alerts referencing old label combinations will show gaps or stale values.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp