Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docker-compose to run prometheus for the experimental example #4268

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
22 changes: 16 additions & 6 deletions experimental/examples/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@ This is a simple example that demonstrates basic metrics collection and exports
npm install
```

Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/)

## Run the Application

- Run the server

```sh
# from this directory
npm run start
```

If you are using the default configurations, the metrics should be available at <http://localhost:9464/metrics>

## Run Prometheus

### With docker

```sh
# from this directory
docker compose up
```

### With binary

Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/)

- Replace the `prometheus.yml` provided by the Prometheus installation with the following:

```yaml
Expand All @@ -34,7 +45,6 @@ scrape_configs:
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9464']

```
- Start Prometheus
Expand All @@ -44,7 +54,7 @@ scrape_configs:
prometheus --config.file=prometheus.yml
```

### Prometheus UI
## Prometheus UI

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

Expand Down
12 changes: 12 additions & 0 deletions experimental/examples/prometheus/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.7'

services:
prometheus:
image: prom/prometheus:v2.47.2
extra_hosts:
- host.docker.internal:host-gateway
volumes:
- "./prometheus.docker.yml:/etc/prometheus/prometheus.yml"
ports:
- 9090:9090
restart: always
9 changes: 9 additions & 0 deletions experimental/examples/prometheus/prometheus.docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
global:
scrape_interval: 15s # Default is every 1 minute.

scrape_configs:
- job_name: 'opentelemetry'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['host.docker.internal:9464']
Loading