From b92bd74174705cec1f6e4e9a39dc9dd53d8fa430 Mon Sep 17 00:00:00 2001 From: Francois LP Date: Wed, 8 Nov 2023 20:47:48 +0100 Subject: [PATCH 1/2] docs: add docker-compose to run prometheus for the experimental example Signed-off-by: Francois LP --- experimental/examples/prometheus/README.md | 23 ++++++++++++++----- .../examples/prometheus/docker-compose.yaml | 12 ++++++++++ .../examples/prometheus/prometheus.docker.yml | 9 ++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 experimental/examples/prometheus/docker-compose.yaml create mode 100644 experimental/examples/prometheus/prometheus.docker.yml diff --git a/experimental/examples/prometheus/README.md b/experimental/examples/prometheus/README.md index 53ec356b61e..cb5793d710f 100644 --- a/experimental/examples/prometheus/README.md +++ b/experimental/examples/prometheus/README.md @@ -11,17 +11,29 @@ 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 + +## 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 @@ -34,7 +46,6 @@ scrape_configs: # scheme defaults to 'http'. static_configs: - targets: ['localhost:9464'] - ``` - Start Prometheus @@ -44,7 +55,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 diff --git a/experimental/examples/prometheus/docker-compose.yaml b/experimental/examples/prometheus/docker-compose.yaml new file mode 100644 index 00000000000..5647d893f95 --- /dev/null +++ b/experimental/examples/prometheus/docker-compose.yaml @@ -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 diff --git a/experimental/examples/prometheus/prometheus.docker.yml b/experimental/examples/prometheus/prometheus.docker.yml new file mode 100644 index 00000000000..2fb80075838 --- /dev/null +++ b/experimental/examples/prometheus/prometheus.docker.yml @@ -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'] From 92fff028017af7ffe700ff378a8144afcea18ad3 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 9 Nov 2023 17:06:47 +0100 Subject: [PATCH 2/2] Update experimental/examples/prometheus/README.md --- experimental/examples/prometheus/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/experimental/examples/prometheus/README.md b/experimental/examples/prometheus/README.md index cb5793d710f..398427baecd 100644 --- a/experimental/examples/prometheus/README.md +++ b/experimental/examples/prometheus/README.md @@ -33,7 +33,6 @@ docker compose up Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) - - Replace the `prometheus.yml` provided by the Prometheus installation with the following: ```yaml