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

# Prometheus

> Run an OpenTelemetry Collector with a prometheus receiver and otlphttp exporter to forward Prometheus metrics to Sazabi as searchable log records.

[All Prometheus integration capabilities](https://docs.sazabi.com/catalogs/integrations/prometheus)

## About

Forward Prometheus metrics into Sazabi as searchable log records. Because Prometheus does not speak OTLP natively, the OpenTelemetry Collector acts as an intermediary: it scrapes your Prometheus server using the `prometheus` receiver and forwards the scraped data to Sazabi over OTLP/HTTP.

Each scraped data point becomes a log record with structured fields including the metric name, type, and value. Labels are preserved as record attributes. Histograms and summaries include count, sum, min, and max.

## Prerequisites

* OpenTelemetry Collector **Contrib** distribution. The standard Core distribution does not include the `prometheus` receiver.
* A running Prometheus server (default: `localhost:9090`).
* Your Sazabi intake URL, shown above — open the log source and copy the **Intake URL** from its setup screen (the public key is embedded in the URL).

## Set up in the dashboard

**Step 1**

### Configure the Collector

Create or update your Collector configuration to add the `prometheus` receiver and the `otlphttp/sazabi` exporter:

```yaml title="otelcol-contrib.yaml" theme={"system"}
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: sazabi
          scrape_interval: 30s
          static_configs:
            - targets: ["localhost:9090"]

exporters:
  otlphttp/sazabi:
    metrics_endpoint: https://<your intake host>/v1/metrics
    headers:
      Authorization: "Bearer <SAZABI_PUBLIC_KEY>"

service:
  pipelines:
    metrics:
      receivers: [prometheus]
      exporters: [otlphttp/sazabi]
```

Replace `<your intake host>` with the hostname from your intake URL shown above (the `metrics_endpoint` key takes the full metrics URL, including the `/v1/metrics` path). This Collector config also sets a `Bearer` header; supply your project public key from [**Settings > Public keys**](https://app.sazabi.com/settings/api) for `<SAZABI_PUBLIC_KEY>` — this matches the in-product setup snippet. The key is also embedded in your intake URL hostname, so the header is redundant when you use the full keyed URL, but harmless.

Update `targets` to point at your actual Prometheus server if it is not running on `localhost:9090`. Adjust `scrape_interval` to match your Prometheus scrape configuration.

**Step 2**

### Restart or redeploy the Collector

After saving the configuration, restart the Collector process or roll the deployment so it picks up the new pipeline.

**Step 3**

### Hand off the change

If this configuration is version-controlled, commit it on a new branch, push it, and open a pull request. Otherwise apply it directly to your OpenTelemetry Collector. Keep the intake URL and any keys in environment variables or a secret store, and commit only configuration that references them.

## Set up with the CLI

You can also register the Prometheus log source with the [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) (installed and authenticated — see [CLI reference](https://docs.sazabi.com/reference/cli/log-sources.md)).

Registering the source mints the same intake URL the dashboard shows above (the public key is embedded in its hostname):

```bash theme={"system"}
sazabi log-sources create prometheus --mode manual
```

The command prints the intake URL for the new source — copy the whole URL and point your sender at it using the configuration shown above. Run `sazabi log-sources get <log-source-id>` at any time to reprint the endpoint, or `sazabi log-sources list` to see every log source in the project.

## Verify

After the Collector restarts, wait for at least one scrape cycle (30 seconds with the default interval above). Open the [Intake page](https://docs.sazabi.com/guides/instrument/intake.md) in the Sazabi dashboard and confirm records from the **Prometheus** source appear. Start a thread and search for one of your metrics by name to confirm individual data points are queryable.

## Troubleshooting

**No records after restarting** — Check Collector logs for TLS, DNS, or authentication errors on `otlphttp/sazabi`. Confirm the `Authorization: Bearer` header uses your project public key (from [**Settings > Public keys**](https://app.sazabi.com/settings/api)), not a Sazabi secret key.

**Scrape errors** — If the Collector cannot reach the Prometheus server, check that `targets` points to the correct host and port and that no firewall blocks the connection.

**Metrics rejected or missing** — Confirm the `metrics_endpoint` key uses the full metrics URL ending in `/v1/metrics`, as shown above.

**Collector Core vs Contrib** — The `prometheus` receiver is only available in the Contrib distribution. If you see `unknown receiver type: prometheus`, switch to the Contrib binary or Docker image.

## Further reading

> [card] [Intake](https://docs.sazabi.com/guides/instrument/intake.md)
>
> See per-source ingestion volume and health.

> [card] [OpenTelemetry Metrics](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/opentelemetry-metrics.md)
>
> Send OTLP metrics directly from your application.

> [card] [Log sources](https://docs.sazabi.com/catalogs/log-sources.md)
>
> Browse the full log source catalog.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.