docs/examples/metrics-backends/grafana-cloud.mdx
<Tooltip tip="This page covers msb-metrics, which reads host-local shared memory and is local-only. It does not apply to microsandbox cloud sandboxes."><span className="msb-badge-local">Local-only <Icon icon="circle-info" size={11} /></span></Tooltip>
<Note> This example ships data emitted by [`msb-metrics`](/observability/msb-metrics). See the msb-metrics page for the flag reference, metric names, and deployment constraints. </Note>Grafana Cloud exposes a region-specific OTLP gateway at
otlp-gateway-prod-<region>.grafana.net. msb-metrics ships directly
to it using HTTP/Protobuf and Basic auth.
- **Endpoint URL** (looks like
`https://otlp-gateway-prod-us-east-2.grafana.net/otlp`)
- **Instance ID** (a numeric instance identifier)
- **API token** with scope `metrics:write` (create one if you
don't already have it)
<CodeGroup>
```sh macOS & Linux
GC_ID=... # numeric instance id
GC_TOKEN=... # API token with metrics:write
AUTH="Basic $(printf '%s:%s' "$GC_ID" "$GC_TOKEN" | base64 | tr -d '\n')"
```
```powershell Windows
$env:GC_ID = '...' # numeric instance id
$env:GC_TOKEN = '...' # API token with metrics:write
$credentials = "$env:GC_ID`:$env:GC_TOKEN"
$auth = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($credentials))
```
</CodeGroup>
```powershell Windows
msb-metrics otel `
--endpoint=https://otlp-gateway-prod-us-east-2.grafana.net/otlp/v1/metrics `
--protocol=http `
--header="Authorization=$auth"
```
</CodeGroup>
Substitute your region in the URL. If Grafana shows you the base
OTLP URL ending in `/otlp`, append `/v1/metrics` for this HTTP
metrics-only exporter.
For long-running deployments, point msb-metrics at a local
Grafana Alloy
instance instead of the OTLP gateway directly. Alloy handles
batching, retries, credential rotation, and buffering through Grafana
Cloud hiccups without touching msb-metrics.