Skip to content
Permalink
Browse files

Add transformation_operations_total to transformer metrics.

  • Loading branch information...
immutableT committed Nov 6, 2018
1 parent 4b7c607 commit 1067d76d575792f0b584fd3344d464d0eca7c1db
Showing with 24 additions and 4 deletions.
  1. +24 −4 staging/src/k8s.io/apiserver/pkg/storage/value/metrics.go
@@ -53,12 +53,23 @@ var (
},
[]string{"transformation_type"},
)
transformerFailuresTotal = prometheus.NewCounterVec(

transformerOperationsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "transformation_operations_total",
Help: "Total number of transformations.",
},
[]string{"transformation_type", "status"},
)

deprecatedTransformerFailuresTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "transformation_failures_total",
Help: "Total number of failed transformation operations.",
Help: "(Deprecated) Total number of failed transformation operations.",
},
[]string{"transformation_type"},
)
@@ -106,23 +117,32 @@ func RegisterMetrics() {
registerMetrics.Do(func() {
prometheus.MustRegister(transformerLatencies)
prometheus.MustRegister(deprecatedTransformerLatencies)
prometheus.MustRegister(transformerFailuresTotal)

prometheus.MustRegister(transformerOperationsTotal)
prometheus.MustRegister(deprecatedTransformerFailuresTotal)

prometheus.MustRegister(envelopeTransformationCacheMissTotal)

prometheus.MustRegister(dataKeyGenerationLatencies)
prometheus.MustRegister(deprecatedDataKeyGenerationLatencies)

prometheus.MustRegister(dataKeyGenerationFailuresTotal)
})
}

// RecordTransformation records latencies and count of TransformFromStorage and TransformToStorage operations.
// Note that transformation_failures_total metric is deprecated, use transformation_operations_total instead.
func RecordTransformation(transformationType string, start time.Time, err error) {
if err != nil {
transformerFailuresTotal.WithLabelValues(transformationType).Inc()
transformerOperationsTotal.WithLabelValues(transformationType, "failure").Inc()
deprecatedTransformerFailuresTotal.WithLabelValues(transformationType).Inc()
return
}

transformerLatencies.WithLabelValues(transformationType).Observe(sinceInSeconds(start))
deprecatedTransformerLatencies.WithLabelValues(transformationType).Observe(sinceInMicroseconds(start))

transformerOperationsTotal.WithLabelValues(transformationType, "success").Inc()
}

// RecordCacheMiss records a miss on Key Encryption Key(KEK) - call to KMS was required to decrypt KEK.

0 comments on commit 1067d76

Please sign in to comment.
You can’t perform that action at this time.