client_rust icon indicating copy to clipboard operation
client_rust copied to clipboard

Add encode implementations for SocketAddr and IpAddr

Open rnijveld opened this issue 3 years ago • 4 comments

Something I encounter quite often is having metrics based on connection information, so I frequently find myself wanting to use either a SocketAddr or IpAddr in a label.

rnijveld avatar Sep 08 '22 07:09 rnijveld

Friendly ping @rnijveld.

mxinden avatar Oct 02 '22 09:10 mxinden

@mxinden Sorry about the slow response, life got in the way a little. I definitely agree with not wanting to use this for high cardinality situations. Although of course such cases could happen just as easily with other label types, I do agree that IP addresses might more quickly result in a cardinality explosion when not used correctly. I've added a little warning text to each of the implementations, I hope that resolves your concerns, let me know if there's anything else I can do!

rnijveld avatar Oct 14 '22 21:10 rnijveld

It is effectively never appropriate to use an address as a label, for reasons of cardinality already discussed.

08d2 avatar Jan 10 '23 04:01 08d2

I don't think "never" is correct. One use-case I can come up with is exposing ones listening address as an info metric. See e.g. https://github.com/kubernetes/kube-state-metrics/issues/498 as an example on how far one can push cardinality in Prometheus with info metrics.

mxinden avatar Jan 10 '23 08:01 mxinden