Skip to content

Commit 40fde0f

Browse files
docs: add docker-compose to run prometheus for the experimental example (#4268)
Co-authored-by: Marc Pichler <[email protected]>
1 parent f2b447d commit 40fde0f

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

experimental/examples/prometheus/README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,28 @@ This is a simple example that demonstrates basic metrics collection and exports
1111
npm install
1212
```
1313

14-
Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/)
15-
1614
## Run the Application
1715

18-
- Run the server
19-
2016
```sh
2117
# from this directory
2218
npm run start
2319
```
2420

21+
If you are using the default configurations, the metrics should be available at <http://localhost:9464/metrics>
22+
23+
## Run Prometheus
24+
25+
### With docker
26+
27+
```sh
28+
# from this directory
29+
docker compose up
30+
```
31+
32+
### With binary
33+
34+
Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/)
35+
2536
- Replace the `prometheus.yml` provided by the Prometheus installation with the following:
2637

2738
```yaml
@@ -34,7 +45,6 @@ scrape_configs:
3445
# scheme defaults to 'http'.
3546
static_configs:
3647
- targets: ['localhost:9464']
37-
3848
```
3949
4050
- Start Prometheus
@@ -44,7 +54,7 @@ scrape_configs:
4454
prometheus --config.file=prometheus.yml
4555
```
4656

47-
### Prometheus UI
57+
## Prometheus UI
4858

4959
If you are using the default configurations, the prometheus client will be available at <http://localhost:9090>
5060

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.7'
2+
3+
services:
4+
prometheus:
5+
image: prom/prometheus:v2.47.2
6+
extra_hosts:
7+
- host.docker.internal:host-gateway
8+
volumes:
9+
- "./prometheus.docker.yml:/etc/prometheus/prometheus.yml"
10+
ports:
11+
- 9090:9090
12+
restart: always
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
global:
2+
scrape_interval: 15s # Default is every 1 minute.
3+
4+
scrape_configs:
5+
- job_name: 'opentelemetry'
6+
# metrics_path defaults to '/metrics'
7+
# scheme defaults to 'http'.
8+
static_configs:
9+
- targets: ['host.docker.internal:9464']

0 commit comments

Comments
 (0)