Secrets: Add decrypter to decrypt duration metric (#112942)

This commit is contained in:
Matheus Macabu
2025-10-24 15:23:54 +02:00
committed by GitHub
parent c1e308f61e
commit 2c6c564c18
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ func (s *decryptStorage) Decrypt(ctx context.Context, namespace xkube.Namespace,
logging.FromContext(ctx).Info("Secrets Audit Log", args...)
s.metrics.DecryptDuration.WithLabelValues(decryptResultLabel).Observe(time.Since(start).Seconds())
s.metrics.DecryptDuration.WithLabelValues(decryptResultLabel, cmp.Or(decrypterIdentity, "unknown")).Observe(time.Since(start).Seconds())
// Do not leak error details to caller, return only the wrapped domain errors.
if decryptErr != nil {
@@ -12,8 +12,9 @@ const (
namespace = "grafana_secrets_manager"
subsystem = "storage"
// labels
successLabel = "success"
resultLabel = "result"
successLabel = "success"
resultLabel = "result"
decrypterLabel = "decrypter"
)
// StorageMetrics is a struct that contains all the metrics for all operations of secrets storage.
@@ -132,7 +133,7 @@ func newStorageMetrics() *StorageMetrics {
Name: "decrypt_duration_seconds",
Help: "Duration of decrypt operations",
Buckets: prometheus.DefBuckets,
}, []string{resultLabel}),
}, []string{resultLabel, decrypterLabel}),
}
}