In this sandbox, a simple web service running on the myservice
host is scraped by a Prometheus instance. Prometheus discovers that host via file-based service discovery.
To start the sandbox:
# In the foreground
make run # docker-compose up --build
# In detached mode
make run-detached # docker-compose up --build --detach
This will start up two services:
Service | Description |
---|---|
prometheus |
A Prometheus instance configured to use the targets.json file for file-based service discovery (see the dummy job configuration) |
myservice1 and myservice2 |
A basic web service that exposes a /metrics endpoint for Prometheus metrics and one custom metric: myservice_processed_ops_total . Two instances of this service are run. |
To kill the sandbox, run
make kill
(alias fordocker-compose kill
).
Once the sandbox is up and running, you can verify that the myservice_processed_ops_total
metric is being scraped—and thus that the myservice1
and myservice2
services have been properly discovered by Prometheus—you can see the current value in the expression browser.