Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 11 additions & 37 deletions content/en/docs/languages/_includes/exporters/prometheus-setup.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
## Prometheus

To send your metric data to [Prometheus](https://prometheus.io/), you can either
[enable Prometheus' OTLP Receiver](https://prometheus.io/docs/guides/opentelemetry/#enable-the-otlp-receiver)
and use the [OTLP exporter](#otlp) or you can use the Prometheus exporter, a
`MetricReader` that starts an HTTP server that collects metrics and serialize to
Prometheus text format on request.
To send your metric data to [Prometheus](https://prometheus.io/), you can
either:

### Backend Setup {#prometheus-setup}
- [Enable Prometheus' OTLP Receiver](https://prometheus.io/docs/guides/opentelemetry/#enable-the-otlp-receiver)
and use the [OTLP exporter](#otlp) (best practice), or
- Use the Prometheus exporter, a `MetricReader` that starts an HTTP server that
collects metrics and serializes to Prometheus text format on request.

> [!NOTE]
>
> If you have Prometheus or a Prometheus-compatible backend already set up, you
> can skip this section and setup the [Prometheus](#prometheus-dependencies) or
> [OTLP](#otlp-dependencies) exporter dependencies for your application.
### Backend setup {#prometheus-setup}

You can run [Prometheus](https://prometheus.io) in a docker container,
accessible on port `9090` by following these instructions:
To run a Prometheus server backend and begin scraping metrics, see the
[Prometheus getting started guide](https://prometheus.io/docs/prometheus/latest/getting_started/).

Create a file called `prometheus.yml` with the following content:

```yaml
scrape_configs:
- job_name: dice-service
scrape_interval: 5s
static_configs:
- targets: [host.docker.internal:9464]
```

Run Prometheus in a docker container with the UI accessible on port `9090`:

```shell
docker run --rm -v ${PWD}/prometheus.yml:/prometheus/prometheus.yml -p 9090:9090 prom/prometheus --web.enable-otlp-receiver
```

> [!NOTE]
>
> When using Prometheus' OTLP Receiver, make sure that you set the OTLP endpoint
> for metrics in your application to `http://localhost:9090/api/v1/otlp`.
>
> Not all docker environments support `host.docker.internal`. In some cases you
> may need to replace `host.docker.internal` with `localhost` or the IP address
> of your machine.
To enable the OTLP Receiver, see the
[Prometheus guide for enabling the OTLP Receiver](https://prometheus.io/docs/guides/opentelemetry/#enable-the-otlp-receiver).
4 changes: 4 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -22903,6 +22903,10 @@
"StatusCode": 200,
"LastSeen": "2026-03-10T09:54:55.343309116Z"
},
"https://prometheus.io/docs/prometheus/latest/getting_started/": {
"StatusCode": 200,
"LastSeen": "2026-04-20T20:35:35.466392978Z"
},
"https://prometheus.io/docs/prometheus/latest/http_sd/": {
"StatusCode": 200,
"LastSeen": "2026-03-23T14:15:26.26619547Z"
Expand Down
Loading