docs/recipes/metrics-backends/prometheus.mdx
Prometheus has a native OTLP receiver since v2.47 (stable since v2.51),
so msb-metrics can ship to it without an intermediate collector. Point
the OTLP endpoint at Prometheus's /api/v1/otlp/v1/metrics path and the
microsandbox.* series land directly in the local TSDB.
```sh
prometheus \
--config.file=prometheus.yml \
--web.enable-otlp-receiver
```
The receiver listens at `/api/v1/otlp/v1/metrics` on the same port
as the rest of the HTTP API (default `:9090`).
```sh
msb-metrics otel \
--endpoint=http://localhost:9090/api/v1/otlp/v1/metrics \
--protocol=http
```
Pass the full receiver path. `msb-metrics` uses HTTP endpoints
exactly as provided.
```sh
curl -s 'http://localhost:9090/api/v1/query?query=microsandbox_memory_usage_bytes' | jq
```
Open the Prometheus UI at `http://localhost:9090/graph` and run
queries like `microsandbox_cpu_utilization_ratio` or
`rate(microsandbox_disk_bytes_written[1m])`.
Prometheus's OTLP receiver translates OTel metric names per the OpenTelemetry semantic conventions for Prometheus compatibility:
microsandbox.cpu.utilization →
microsandbox_cpu_utilization_ratio (suffix derives from the unit
1/ratio)_bytes suffix: microsandbox.memory.usage →
microsandbox_memory_usage_bytes_total suffix
expected by Prometheus: microsandbox.collector.exports.success →
microsandbox_collector_exports_success_totalFor production, put a stable layer between msb-metrics and Prometheus:
either a local otel-collector
that handles batching and retries, or
Grafana Alloy. Direct
shipping is fine for single-host setups and development; the buffer in
msb-metrics is bounded by --max-buffered and is not a substitute
for a real metrics relay.