miekg / caddy-prometheus

Prometheus metrics middleware for caddy
Apache License 2.0
65 stars 26 forks source link

Correctly set "family" label (fixes #38) #39

Closed calmh closed 6 years ago

calmh commented 6 years ago

The (*http.Request).RemoteAddr field contains the remote address with port, so the plain ParseIP call always failed. This adds a helper function that strips the port, yet also works if given an address without port.