pambrose/prometheus-proxy

Service Discovery wrongly generated

Closed this issue · 3 comments

Hello

I have a problem setting up service discovery.

My generated file is as follow:

cat /opt/prometheus/targets.json
[
    {
        "targets": [
            "http://prometheus-proxy:8080/sandbox_ops_cadvisor_metrics"
        ]
    }
]

And in my prometheus logs I have an error like this:

prometheus_1        | ts=2022-11-23T10:45:59.899Z caller=scrape.go:477 level=error component="scrape manager" scrape_pool=tmp msg="Creating target failed" err="instance 7 in group /etc/prometheus/targets.json:0: \"http://prometheus-proxy:8080/sandbox_ops_cadvisor_metrics\" is not a valid hostname"

Looking at the documentation, I found that the discovery file should be as follow:

[
    {
        "targets": [
            "prometheus-proxy:8080"
        ],
        "labels": {
            "__metrics_path__": "sandbox_ops_cadvisor_metrics"
        }
    }
]

Can you confirm that the problem is from your generated service discovery file ?

Regards.

@vincedom was kind enough to fix this issue. I posted a new 1.14.2 release. Please give it a try and see if your issue is resolved.

Hi @pambrose

It's working perfectly for me.

Regards,

Glad to hear it. Thanks to @vincedom for the PR.