uswitch / vault-creds

Sidecar container for requesting dynamic Vault database secrets
Apache License 2.0
84 stars 14 forks source link

Add metrics for vault #32

Closed waiariki-koia closed 3 years ago

waiariki-koia commented 3 years ago

Have added implementation to push metrics to the push gateway.

Added times of successes and errors. Added error count Added time until credentials expire

Joseph-Irving commented 3 years ago

what happens if someone doesn't set the prom gateway address or doesn't want to?

waiariki-koia commented 3 years ago

If the gateway address is not defined, it becomes an empty string by default. There is a check in the Push() method to see if the address is set or not. If the address is no set no metrics get pushed

Joseph-Irving commented 3 years ago

looks good, do you want to add something to the readme to document the metrics and why we've opted for the push gateway model here

waiariki-koia commented 3 years ago

Yeah will do.

Also wondered if it's useful/if its even possible to add more labels to make querying easier.

At the moment we only have pod name, namespace and cluster, the normal kube labels we get come from the gateway as its the one getting scraped.

I'm not sure how we would be able to get something like deployment name or other grouping type things though

Joseph-Irving commented 3 years ago

I think that seems like enough info to begin with, if we feel we need more we could add it later

waiariki-koia commented 3 years ago

https://thanos.usw.cloud/graph?g0.range_input=30m&g0.max_source_resolution=0s&g0.expr=vault_creds_credential_expiry_time_seconds&g0.tab=0 to see metrics being removed