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

# Prometheus metrics

> Send Prometheus scrape or remote-write metrics to Squasher through your OpenTelemetry Collector.

Squasher accepts metrics through OTLP/HTTP. It does not expose a Prometheus
remote-write endpoint. Run an OpenTelemetry Collector that you control to
translate Prometheus metrics to OTLP before they reach Squasher.

This path uses open-source software on your infrastructure. It does not require
another hosted observability service.

<Note>
  The [Prometheus Alertmanager connector](/integrations/prometheus-alertmanager) receives alerts. It
  does not ingest Prometheus metric series.
</Note>

## Recommended path: scrape targets

Use the Collector's Prometheus receiver when the Collector can reach each
target's metrics endpoint. The receiver supports standard Prometheus scrape
configuration, service discovery, and relabeling.

```yaml otel-collector-config.yaml theme={null}
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: checkout-api
          scrape_interval: 30s
          static_configs:
            - targets: ["checkout-api:9464"]

processors:
  batch: {}
  resource/environment:
    attributes:
      - key: deployment.environment.name
        value: production
        action: upsert

exporters:
  otlphttp/squasher:
    endpoint: https://ingest.squasher.ai
    headers:
      x-squasher-key: "${env:SQUASHER_API_KEY}"

service:
  pipelines:
    metrics:
      receivers: [prometheus]
      processors: [resource/environment, batch]
      exporters: [otlphttp/squasher]
```

Keep API keys in environment variables or your secret manager. Do not put a
real key in the Collector configuration.

The Prometheus receiver maps the scrape job to `service.name`. Add or update
resource attributes when your scrape job does not identify the service and
environment clearly.

## Existing Prometheus remote write

If an existing Prometheus server must push data, use the Collector Contrib
Prometheus Remote Write receiver. It is not in the core Collector distribution.
Run `otelcol-contrib` or build a custom Collector distribution that includes
`prometheusremotewritereceiver`.

The receiver is alpha and accepts Remote Write 2.0 only. Its wire compatibility
depends on both the Prometheus and Collector Contrib versions. Collector Contrib
v0.141.0 and earlier supports Prometheus 3.7.x and earlier. Collector Contrib
v0.142.0 and later supports Prometheus 3.8.0 and later. Check the receiver's
current compatibility table before you upgrade either component.

```yaml otel-collector-config.yaml theme={null}
receivers:
  prometheusremotewrite:
    endpoint: 0.0.0.0:9090

processors:
  batch: {}

exporters:
  otlphttp/squasher:
    endpoint: https://ingest.squasher.ai
    headers:
      x-squasher-key: "${env:SQUASHER_API_KEY}"

service:
  pipelines:
    metrics:
      receivers: [prometheusremotewrite]
      processors: [batch]
      exporters: [otlphttp/squasher]
```

Point Prometheus at the receiver and select the Remote Write 2.0 message:

```yaml prometheus.yml theme={null}
remote_write:
  - url: http://otel-collector:9090/api/v1/write
    protobuf_message: io.prometheus.write.v2.Request
```

The receiver also requires the Prometheus metadata WAL records feature. If
your Prometheus and Collector versions do not support the same Remote Write
2.0 revision, use the scrape receiver instead.

<Warning>
  The Remote Write receiver does not support Prometheus summaries or classic histograms. Use native
  histograms, change the metric type, or use the scrape receiver when you must ingest these metrics.
</Warning>

## Control volume

Use Prometheus `metric_relabel_configs` to remove series that you do not query.
Drop high-cardinality labels before export. Start with one job, inspect its
series in Squasher, and then add the remaining jobs.

For traces, use [customer-side tail sampling](/integrations/tail-sampling).
Tail sampling does not apply to metrics.

## Verify

1. Validate the Collector configuration with your Collector binary.
2. Start the Collector with `SQUASHER_API_KEY` set.
3. Confirm that the Collector reports accepted metric points and no export failures.
4. Open **Metrics** in Squasher and find a known metric from `checkout-api`.
5. Confirm its service, environment, unit, and labels before widening the rollout.

## References

* [OpenTelemetry Prometheus receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver)
* [OpenTelemetry Prometheus Remote Write receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusremotewritereceiver)

## Agent handoff

```text theme={null}
Connect Prometheus metrics to Squasher project <project_id> through a customer-run OpenTelemetry Collector. Prefer the Prometheus scrape receiver. Keep the Squasher key in SQUASHER_API_KEY, preserve service.name and deployment.environment.name, test one scrape job, and ask before changing shared Prometheus or Collector configuration.
```
