-
Couldn't load subscription status.
- Fork 104
Description
First of all, thank you for this project!
I have a use case where I need to attach additional info on metrics exposed by ssl-exporter. So far I'm doing a workaround by doing leveraging the relabeling feature of prometheus on the name of the secret, this works but is kind of ugly and I think it would be a real added value of having a way to directly generate prometheus metrics label based on secret labels. See the example below:
Example of secret read by ssl-exporter:
apiVersion: v1
kind: Secret
metadata:
name: my-secret-tls
labels:
ssl-exporter.env: DEV
ssl-exporter.app: myapp
ssl-exporter.otherlabel: myotherlabelvalue
type: kubernetes.io/tls
stringData:
tls.crt: |
-----BEGIN CERTIFICATE-----
(...)
-----END CERTIFICATE-----
tls.key: ""I excpect above k8s secret to generate following prometheus metric:
ssl_kubernetes_cert_not_after{env="DEV", app="myapp", otherlabel="myotherlabelvalue", job="...", cn="...", (...)}
Notice how secret labels are transformed into prometheus metrics labels.
I guess the implementation would be done somewhere here:
ssl_exporter/prober/metrics.go
Line 285 in 6037c98
| func collectKubernetesSecretMetrics(secrets []v1.Secret, registry *prometheus.Registry) error { |
What do you think?