﻿---
title: Ingest Prometheus metrics with managed inputs
description: Ingest Prometheus metrics into Elasticsearch using the Prometheus Remote Write protocol through the Elastic Cloud Managed Prometheus Remote Write endpoint.
url: https://www.elastic.co/elastic/docs-builder/docs/3663/reference/opentelemetry/managed-inputs/prometheus-remote-write
products:
  - Elastic Cloud Serverless
  - Elastic Observability
applies_to:
  - Serverless Observability projects: Generally available
  - Serverless Security projects: Generally available
---

# Ingest Prometheus metrics with managed inputs
The Managed Prometheus Remote Write endpoint ingests metrics sent in the [Prometheus Remote Write v1](https://prometheus.io/docs/specs/remote_write_spec/) (PRW) protocol. It accepts PRW traffic natively, so you don't need to convert metrics to OTLP, and it's a dedicated [managed input](https://www.elastic.co/elastic/docs-builder/docs/3663/reference/opentelemetry/managed-inputs) separate from the [Managed OTLP Endpoint](https://www.elastic.co/elastic/docs-builder/docs/3663/reference/opentelemetry/managed-inputs/managed-otlp-endpoint). Metrics land in Elasticsearch time series data streams (TSDS), the same result as sending PRW directly to Elasticsearch.

## When to use the Managed Prometheus Remote Write endpoint

For Elastic Cloud Serverless projects, the Managed Prometheus Remote Write endpoint is the recommended way to ingest Prometheus metrics. Compared to sending metrics directly to the [Elasticsearch Prometheus Remote Write endpoint](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/3663/manage-data/data-store/data-streams/tsds-ingest-prometheus-remote-write), it provides:
- A single ingest endpoint and API key shared with the other [managed inputs](https://www.elastic.co/elastic/docs-builder/docs/3663/reference/opentelemetry/managed-inputs).
- Durable buffering, back-pressure, and retry on `429 Too Many Requests`.
- The same Prometheus-to-TSDS mapping as the Elasticsearch PRW endpoint, so the resulting data is identical.

<warning>
  On Elastic Cloud Serverless, use the Managed Prometheus Remote Write endpoint rather than sending metrics directly to the [Elasticsearch Prometheus Remote Write endpoint](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/3663/manage-data/data-store/data-streams/tsds-ingest-prometheus-remote-write).Direct ingest bypasses managed inputs and has no buffering or processing before data reaches Elasticsearch. It also authenticates differently: the direct Elasticsearch endpoint uses Elasticsearch credentials or an API key with index privileges, while the Managed Prometheus Remote Write endpoint uses a managed inputs API key with the `event:write` privilege for the `apm` application. Use the direct Elasticsearch endpoint only for self-managed deployments, where managed inputs aren't available. Elastic Cloud Hosted support for the Managed Prometheus Remote Write endpoint is planned.
</warning>


## Prerequisites

- An Elastic Cloud Serverless Observability or Security project.
- A managed inputs API key with the `event:write` privilege for the `apm` application. Refer to [Authentication](/elastic/docs-builder/docs/3663/reference/opentelemetry/managed-inputs/managed-otlp-endpoint#authentication) for the required key format and generation steps.


## Send Prometheus metrics through managed inputs

Follow these steps to configure Prometheus to send metrics to the Managed Prometheus Remote Write endpoint.
<stepper>
  <step title="Configure Prometheus">
    Add a `remote_write` entry to your Prometheus configuration:
    ```yaml
    remote_write:
      - url: <prometheus-endpoint>
        authorization:
          type: ApiKey
          credentials: <api-key>
    ```
    To find `<prometheus-endpoint>`:
    1. Log in to the Elastic Cloud Console.
    2. Find your project and select **Manage**.
    3. In the **Application endpoints, cluster and component IDs** section, select **Prometheus**.
    4. Copy the **Prometheus** endpoint value, which looks similar to `https://<project>.ingest.<region>.<csp>.elastic.cloud/api/v1/write`
  </step>

  <step title="Route metrics to custom data streams (optional)">
    By default, all PRW metrics land in `metrics-generic.prometheus-default`.To route to a custom data stream, attach the `data_stream_dataset` and `data_stream_namespace` labels to your time series:

    | Label                   | Sets                                        | Example      |
    |-------------------------|---------------------------------------------|--------------|
    | `data_stream_dataset`   | Dataset component of the data stream name   | `myapp`      |
    | `data_stream_namespace` | Namespace component of the data stream name | `production` |
    A time series with `data_stream_dataset: myapp` and `data_stream_namespace: production` routes to `metrics-myapp.prometheus-production`.In Prometheus, use `write_relabel_configs` to add these labels to every time series sent to a `remote_write` target:
    ```yaml
    remote_write:
      - url: <prometheus-endpoint>
        authorization:
          type: ApiKey
          credentials: <api-key>
        write_relabel_configs:
          - target_label: data_stream_dataset
            replacement: myapp
          - target_label: data_stream_namespace
            replacement: production
    ```
  </step>
</stepper>


## How Prometheus data appears in Elasticsearch

Prometheus labels are mapped as TSDS dimensions in Elasticsearch, and metric types are inferred from field naming conventions:
- Fields ending in `_sum`, `_count`, `_total`, or `_bucket` are mapped as counters.
- All other fields are mapped as gauges.

For details on the full mapping behavior, refer to the [Elasticsearch Prometheus remote write endpoint](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/3663/manage-data/data-store/data-streams/tsds-ingest-prometheus-remote-write) documentation.

## Limitations

- URL-path routing (for example, `/_prometheus/metrics/{dataset}/api/v1/write`) to custom data streams is not supported through managed inputs. Use [label-based routing](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/3663/manage-data/data-store/data-streams/tsds-ingest-prometheus-remote-write#route-by-labels) instead.
- Available on Elastic Cloud Serverless only.
- Samples with non-finite values (NaN, Infinity) are silently dropped by Elasticsearch, and staleness markers are not supported.