# Uncloud Prometheus, part II Had some fun playing with my [fork of Uncloud](https://github.com/miekg/uncloudplus/). And making metrics work. > Metrics are now part of Uncloud proper - _uncloudplus_ can now drop it. In prometheus we use `dns_sd_configs` to pick up new things automatically: ```yaml - job_name: uncloud dns_sd_configs: - names: ["m.internal"] type: A port: 51090 - job_name: caddy dns_sd_configs: - names: ["caddy.internal"] type: A port: 2019 ``` For caddy metrics, we hack around a little... in the `x-caddy` file we deploy for Caddy add: ```caddyfile metrics { per_host } ``` But this serves metrics on localhost inside the container. So we need to export this, we can't add this snippet: ```caddyfile http://:2019 { handle { metrics } } ``` Because this is something that does not belong in the global block. So, we add another service that only adds this: ```yaml services: caddy-metrics: image: registry.science.ru.nl/cncz/sys/image/debug:v0.1.14 x-caddy: | http://:2019 { handle { metrics } } ``` And deploy this do-nothing-but-update-caddy service. And voila, we have metrics _finally_. You can scrape this with a Promethues snippet like: ```yaml scrape_configs: - job_name: prometheus static_configs: - targets: - localhost:9090 - job_name: uncloud dns_sd_configs: - names: ["m.internal"] type: A port: 51004 - job_name: caddy dns_sd_configs: - names: ["caddy.internal"] type: A port: 2019 ``` Note the `m.internal` namespace needs [this PR](https://github.com/psviderski/uncloud/pull/359).