Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #55 from glutamatt/evalpromflagkey
Browse files Browse the repository at this point in the history
Add FlagKey as prometheus label in eval counter
  • Loading branch information
zhouzhuojie authored Nov 22, 2021
2 parents f038191 + f9c2f02 commit 8e62c17
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func setupPrometheus() {
Global.Prometheus.EvalCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "flagr_eval_results",
Help: "A counter of eval results",
}, []string{"EntityType", "FlagID", "VariantID", "VariantKey"})
}, []string{"EntityType", "FlagID", "FlagKey", "VariantID", "VariantKey"})
Global.Prometheus.RequestCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "flagr_requests_total",
Help: "The total http requests received",
Expand Down
1 change: 1 addition & 0 deletions pkg/handler/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ var logEvalResultToPrometheus = func(r *models.EvalResult) {
config.Global.Prometheus.EvalCounter.WithLabelValues(
util.SafeStringWithDefault(r.EvalContext.EntityType, "null"),
util.SafeStringWithDefault(r.FlagID, "null"),
util.SafeStringWithDefault(r.FlagKey, "null"),
util.SafeStringWithDefault(r.VariantID, "null"),
util.SafeStringWithDefault(r.VariantKey, "null"),
).Inc()
Expand Down

0 comments on commit 8e62c17

Please sign in to comment.