> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirador.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Metrics over OTLP

> Export OpenTelemetry metrics to Mirador for live dashboards and analysis

Mirador ingests OTLP metrics through the same gateway and authentication used for traces and logs. Metrics appear in the live catalog and can be composed into dashboards with stat, timeseries, histogram, bar, pie, and table widgets.

## Supported metric types

| OTLP metric type         | Ingestion                                       | Common use                                        |
| ------------------------ | ----------------------------------------------- | ------------------------------------------------- |
| **Gauge**                | Supported                                       | Current temperature, queue depth, active sessions |
| **Sum**                  | Supported with cumulative and delta temporality | Counters, request totals, bytes processed         |
| **Histogram**            | Supported                                       | Latency and payload distributions                 |
| **ExponentialHistogram** | Supported                                       | High-dynamic-range distributions                  |
| **Summary**              | Accepted and stored                             | Precomputed count, sum, and quantiles             |

Mirador derives counter rate and increase at query time, including handling monotonic counter resets. Histogram and exponential-histogram widgets support count, average, min, max, and quantile views.

## Export metrics

Configure a standard OTLP/HTTP metric exporter:

```bash theme={null}
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://otel.mirador.org/v1/metrics
export OTEL_EXPORTER_OTLP_METRICS_HEADERS=Authorization=mir_srv_xxx
```

Or configure the Node.js metrics SDK directly:

```typescript theme={null}
import { resourceFromAttributes } from '@opentelemetry/resources';
import {
  MeterProvider,
  PeriodicExportingMetricReader,
} from '@opentelemetry/sdk-metrics';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';

const exporter = new OTLPMetricExporter({
  url: 'https://otel.mirador.org/v1/metrics',
  headers: {
    Authorization: `Bearer ${process.env.MIRADOR_API_KEY}`,
  },
});

const meterProvider = new MeterProvider({
  resource: resourceFromAttributes({
    'service.name': 'checkout-api',
  }),
  readers: [
    new PeriodicExportingMetricReader({ exporter }),
  ],
});

const meter = meterProvider.getMeter('checkout');
const payments = meter.createCounter('payments.completed', {
  description: 'Completed payments',
  unit: '{payment}',
});

payments.add(1, {
  'payment.provider': 'stripe',
  'deployment.environment.name': 'production',
});
```

## Attributes and series

Mirador preserves resource and datapoint attributes. Attribute values are converted to strings; arrays and key-value lists are JSON encoded.

Use stable, bounded attributes for filtering and grouping:

* Good: `service.name`, `http.request.method`, `http.route`, `cloud.region`, `chain.name`
* Avoid: request IDs, transaction hashes, UUIDs, timestamps, and wallet addresses

Every distinct attribute set creates a separate time series. High-cardinality or constantly changing values increase storage and make dashboards harder to interpret.

## Partial success

An export can accept valid datapoints while rejecting malformed or oversized ones. Mirador reports the rejected count in the standard OTLP `ExportMetricsPartialSuccess` response.

Datapoints can be rejected when they have no metric name, carry the `NO_RECORDED_VALUE` flag, contain malformed histogram buckets, or exceed ingestion limits. Publish failures return a retryable OTLP error so normal SDK retry behavior applies.

## Build a dashboard

After the first export:

1. Open your project in Mirador.
2. Go to **Metrics → Dashboards**.
3. Create a dashboard and select **Add widget**.
4. Choose a metric, aggregation, visualization, filters, and optional group-by attribute.

Dashboard ranges update live, and timeseries widgets can be zoomed into an absolute time window for comparison with related logs and traces.

## Next steps

<CardGroup cols={2}>
  <Card title="OpenTelemetry overview" icon="circle-nodes" href="/opentelemetry/overview">
    Configure endpoints, authentication, and a Collector
  </Card>

  <Card title="Logs over OTLP" icon="rectangle-list" href="/opentelemetry/logs">
    Send structured logs alongside your metrics
  </Card>
</CardGroup>
