Skip to content

Commit b98cdeb

Browse files
jyn514Joshua Nelson
authored andcommitted
Add prometheus service
This allows viewing metrics locally.
1 parent 20cc7c9 commit b98cdeb

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ services:
99
- s3
1010
ports:
1111
- "3000:3000"
12+
# for metrics
13+
expose: ["3000"]
1214
volumes:
1315
- "/var/run/docker.sock:/var/run/docker.sock"
1416
- ".rustwide-docker:/opt/docsrs/rustwide"
@@ -46,6 +48,12 @@ services:
4648
environment:
4749
MINIO_ACCESS_KEY: cratesfyi
4850
MINIO_SECRET_KEY: secret_key
51+
prometheus:
52+
build:
53+
context: ./docker
54+
dockerfile: ./Dockerfile-prometheus
55+
ports:
56+
- "9090:9090"
4957
volumes:
5058
postgres-data: {}
5159
minio-data: {}

docker/Dockerfile-prometheus

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM prom/prometheus
2+
COPY prometheus.yml /etc/prometheus/

docker/prometheus.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
global:
2+
scrape_interval: 15s # By default, scrape targets every 15 seconds.
3+
4+
# Attach these labels to any time series or alerts when communicating with
5+
# external systems (federation, remote storage, Alertmanager).
6+
external_labels:
7+
monitor: 'docs.rs-monitor'
8+
9+
scrape_configs:
10+
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
11+
- job_name: 'docs.rs'
12+
metrics_path: '/about/metrics'
13+
static_configs:
14+
- targets: ['web:3000']

0 commit comments

Comments
 (0)