Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging doesn't print IPAddr struct #546

Closed
lukedirtwalker opened this issue Nov 6, 2019 · 0 comments · Fixed by #548
Closed

Logging doesn't print IPAddr struct #546

lukedirtwalker opened this issue Nov 6, 2019 · 0 comments · Fixed by #548

Comments

@lukedirtwalker
Copy link

Host operating system: output of uname -a

Ubuntu 16.04, blackbox_exporter dockerized.

blackbox_exporter version: output of blackbox_exporter -version

Docker: prom/blackbox-exporter:v0.15.1

What is the blackbox.yml module config.

What is the prometheus.yml scrape config.

What logging output did you get from adding &debug=true to the probe URL?

What did you do that produced an error?

ICMP probing.

What did you expect to see?

Log would print resolved target address.

What did you see instead?

Log prints "unsupported value type"

ts=2019-11-06T10:22:13.054591129Z caller=main.go:304 module=icmp4 target=127.0.0.1level=info msg="Beginning probe" probe=icmp timeout_seconds=119.5
ts=2019-11-06T10:22:13.054773791Z caller=icmp.go:82 module=icmp4 target=127.0.0.1 level=info msg="Resolving target address" ip_protocol=ip4
ts=2019-11-06T10:22:13.054811229Z caller=icmp.go:82 module=icmp4 target=127.0.0.1 level=info msg="Resolved target address" ip="unsupported value type"

Code analysis

The unsupported value type string comes from logfmt lib.
Tracking down where it came from I think it is here:

https://github.com/go-logfmt/logfmt/blob/11fd56866eade1ecd7cd56144e08d5d50669fd48/encode.go#L156-L157

the log call happens here:

level.Info(logger).Log("msg", "Resolved target address", "ip", ip)

the problem here is that ip is of type net.IPAddr which doesn't implement Stringer in the value type, but only for the pointer type (see also https://play.golang.org/p/P5ZNyRm5QXV )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant