Configuring Prometheus to parse metrics
As mentioned earlier, Prometheus operates using a pull
-based model. This means that the data is exposed through an HTTP endpoint and Prometheus should parse it, provided it has been configured properly to access it.
In order for Prometheus to parse from an endpoint, a job configuration needs to be applied. Job configurations for Prometheus are in YAML format.
In our scenario, we would like to parse metrics with an interval of one minute, from the Task Manager.
The configuration should look like this:
scrape_configs: - job_name: 'task-manager' scrape_interval: 1m metrics_path: '/metrics' static_configs: - targets: ['host.docker.internal:8080']
Provided the Task Manager application is running and the YAML file is ready, we can create the Compose YAML file:
services: ...