Skip to content

Commit

Permalink
sprintf other metrics as well
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Sep 26, 2022
1 parent 740fec9 commit 81e27be
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions internal/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func NewCtrlFuncMetrics() *CtrlFuncMetrics {
"`%s` describes whether there were unrecoverable errors (`%s`) or not (`%s`). "+
"`%s` is populated in case of `%s=\"%s\"` and describes the reason of failure "+
"(one of `%s`, `%s`, `%s`).",
ProtocolKey, ProtocolDBLess, ProtocolDeck, SuccessKey, SuccessFalse, SuccessTrue,
FailureReasonKey, SuccessKey, SuccessFalse, FailureReasonConflict, FailureReasonNetwork, FailureReasonOther,
ProtocolKey, ProtocolDBLess, ProtocolDeck, SuccessKey, SuccessFalse, SuccessTrue, FailureReasonKey, SuccessKey,
SuccessFalse, FailureReasonConflict, FailureReasonNetwork, FailureReasonOther,
),
},
[]string{SuccessKey, ProtocolKey, FailureReasonKey},
Expand All @@ -80,21 +80,24 @@ func NewCtrlFuncMetrics() *CtrlFuncMetrics {
controllerMetrics.TranslationCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: MetricNameTranslationCount,
Help: "Count of translations from Kubernetes state to Kong state. `" +
SuccessKey + "` describes whether there were unrecoverable errors (`" +
SuccessFalse + "`) or not (`" + SuccessTrue + "`).",
Help: fmt.Sprintf(
"Count of translations from Kubernetes state to Kong state. `%s` "+
"describes whether there were unrecoverable errors (`%s`) or not (`%s`).",
SuccessKey, SuccessFalse, SuccessTrue,
),
},
[]string{SuccessKey},
)

controllerMetrics.ConfigPushDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: MetricNameConfigPushDuration,
Help: "How long it took to push the configuration to Kong, in milliseconds. `" +
ProtocolKey + "` describes the configuration protocol (" + ProtocolDBLess + " or " +
ProtocolDeck + ") in use. `" +
SuccessKey + "` describes whether there were unrecoverable errors (`" +
SuccessFalse + "`) or not (`" + SuccessTrue + "`).",
Help: fmt.Sprintf(
"How long it took to push the configuration to Kong, in milliseconds. "+
"`%s` describes the configuration protocol (%s or %s) in use. "+
"`%s` describes whether there were unrecoverable errors (`%s`) or not (`%s`).",
ProtocolKey, ProtocolDBLess, ProtocolDeck, SuccessKey, SuccessFalse, SuccessTrue,
),
Buckets: prometheus.ExponentialBuckets(100, 1.33, 30),
},
[]string{SuccessKey, ProtocolKey},
Expand Down

0 comments on commit 81e27be

Please sign in to comment.