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

# Prometheus

> Configuring the Prometheus backend (Self-Hosted)

### Getting Started

<img src="https://d15jtxgb40qetw.cloudfront.net/prometheus.svg" alt="prometheus" className="not-prose h-20" />

<Note>
  These instructions are for the **self hosted** Prometheus instance. If you need a managed service, please follow the instructions on the [Grafana Cloud Prometheus](../backends/grafanacloudprometheus) page.
</Note>

**Enabling Remote Write in Prometheus**<br />
Currently, Odigos supports Prometheus via the Remote Write API. In order to enable remote write in Prometheus, set [the following feature flag](https://prometheus.io/docs/prometheus/latest/feature_flags/#remote-write-receiver).

#### Using Authentication

To enable authentication for Prometheus remote write, check the `Use Authentication` checkbox. Odigos supports two authentication methods:

* **Bearer Token Authentication**: Use the `Bearer Token` field to provide a bearer token for authentication. This method is used if basic auth username is not provided.
* **Basic Authentication**: Use the `Basic Auth Username` and `Basic Auth Password` fields if your Prometheus remote write endpoint requires [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). Basic auth takes precedence if username is provided.

### Configuring Destination Fields

<Accordion title="Supported Signals:">
  ❌ Traces
  ✅ Metrics
  ❌ Logs
  ❌ Profiles
</Accordion>

* **PROMETHEUS\_REMOTEWRITE\_URL** `string` : Remote Write URL.
  * This field is required
* **PROMETHEUS\_RESOURCE\_ATTRIBUTES\_LABELS** `string[]` : Resource Attributes Labels (Deprecated). deprecated. will be removed soon.
  * This field is optional
* **PROMETHEUS\_USE\_AUTHENTICATION** `boolean` : Use Authentication.
  * This field is optional and defaults to `False`
* **PROMETHEUS\_BEARER\_TOKEN** `string` : Bearer Token. use this bearer token if your prometheus remote write endpoint requires authentication
  * This field is optional
  * Example: `your-bearer-token`
* **PROMETHEUS\_BASIC\_AUTH\_USERNAME** `string` : Basic Auth Username. username for basic authentication (if your prometheus remote write endpoint requires basic auth)
  * This field is optional
  * Example: `username`
* **PROMETHEUS\_BASIC\_AUTH\_PASSWORD** `string` : Basic Auth Password. password for basic authentication (if your prometheus remote write endpoint requires basic auth)
  * This field is optional
  * Example: `password`

### Adding Destination to Odigos

There are two primary methods for configuring destinations in Odigos:

##### **Using the UI**

<Steps>
  <Step>
    Use the [Odigos CLI](https://docs.odigos.io/cli/odigos_ui) to access the UI

    ```bash theme={null}
    odigos ui
    ```
  </Step>

  <Step>
    Click on `Add Destination`, select `Prometheus` and follow the on-screen instructions
  </Step>
</Steps>

##### **Using Kubernetes manifests**

<Steps>
  <Step>
    Save the YAML below to a file (e.g. `prometheus.yaml`)

    ```yaml theme={null}
    apiVersion: odigos.io/v1alpha1
    kind: Destination
    metadata:
      name: prometheus-example
      namespace: odigos-system
    spec:
      data:
        PROMETHEUS_REMOTEWRITE_URL: <Remote Write URL>
        # Note: The commented fields below are optional.
        # PROMETHEUS_RESOURCE_ATTRIBUTES_LABELS: <Resource Attributes Labels (Deprecated)>
        # PROMETHEUS_USE_AUTHENTICATION: <Use Authentication>
        # PROMETHEUS_BASIC_AUTH_USERNAME: <Basic Auth Username>
      destinationName: prometheus
      # Uncomment the 'secretRef' below if you are using the optional Secret.
      # secretRef:
      #   name: prometheus-secret
      signals:
      - METRICS
      type: prometheus

    ---

    # The following Secret is optional. Uncomment the entire block if you need to use it.
    # apiVersion: v1
    # data:
    #   PROMETHEUS_BASIC_AUTH_PASSWORD: <Base64 Basic Auth Password>
    #   PROMETHEUS_BEARER_TOKEN: <Base64 Bearer Token>
    # kind: Secret
    # metadata:
    #   name: prometheus-secret
    #   namespace: odigos-system
    # type: Opaque
    ```
  </Step>

  <Step>
    Apply the YAML using `kubectl`

    ```bash theme={null}
    kubectl apply -f prometheus.yaml
    ```
  </Step>
</Steps>
