It is probably a bug. Json is not used in Prometheus, we use yaml.

Le mar. 19 juil. 2022, 21:12, Olivier Cazade <ocaz...@redhat.com> a écrit :

> Hello,
>
> I am having some issue marshaling and unmarshalling a HTTPClientConfig
> struct to JSON.
>
> https://github.com/prometheus/common/blob/49b36038aead362ce78f09337dc5872000bd048a/config/http_config.go#L239
>
> The problem is about the ProxyURL field. When there are no ProxyURL
> configured,it gets marshaled to "proxy_url":null, and then it gets
> unmarshaled to an empty string.
>
> Contrary to a null pointer, an empty string will be handled by the http
> package like a valid Proxy. resulting in some connection error.
> https://pkg.go.dev/net/http#Transport
>
> I first thought that it was some kind of bug, but then looking at the
> tests, this looks like an intended feature:
>
> https://github.com/prometheus/common/blob/49b36038aead362ce78f09337dc5872000bd048a/config/http_config_test.go#L1435
>
> This is why I am confused here, is it a bug, or is there some kind of
> trick that I am missing?
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to prometheus-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-developers/ace6dd1e-2f5f-47b7-bea0-00f182859210n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-developers/ace6dd1e-2f5f-47b7-bea0-00f182859210n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CAFJ6V0oM58hwTxB4oFZjrJibR%2BYrKjtt0gzR0Rn5%2B74TOXDR5w%40mail.gmail.com.

Reply via email to