spiffe / spire

The SPIFFE Runtime Environment
https://spiffe.io
Apache License 2.0
1.81k stars 478 forks source link

Enable the use of ServiceName and EnableServiceLabel for telemetry #5652

Open graceajibade opened 3 days ago

graceajibade commented 3 days ago

From the telemetry doc, there are some labels that accompany metrics, we would find it useful in our deployment to be able to set a custom label to distinguish different sets of spire-servers from each other.

To this end, we could enable the use of ServiceName and EnableServiceLabel (which is from go-metric config) in metrics.go, which would give the ability to optionally pass a ServiceName and enable that ServiceName to be turned to a label. Looking at go-metric's implementation, it looks like it always uses "service" as the label. It would be nice if we could get it to be some kind of custom label, for example support for global labels could be introduced in metrics.go.

I would be happy to implement this if it gets accepted.

sorindumitru commented 2 days ago

Some more details, this is to help with having multiple trust domains publish metrics to the same destination/namespace. Having the trust domain as a label makes it easier to use, rather than including it in the metric namespace.

I don't think anything else apart from the trust domain id/name is needed.