Skip to content

Commit

Permalink
Add a metric for the request with mismatching config
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Oct 29, 2020
1 parent ad1fb2c commit 37f2e33
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ type Handler struct {
expBackoff backoff.Backoff
peerStates map[string]*retryState

forwardRequests *prometheus.CounterVec
replications *prometheus.CounterVec
replicationFactor prometheus.Gauge
forwardRequests *prometheus.CounterVec
forwardRequestConfigurationMismatch prometheus.Counter
replications *prometheus.CounterVec
replicationFactor prometheus.Gauge
}

func NewHandler(logger log.Logger, o *Options) *Handler {
Expand All @@ -123,6 +124,12 @@ func NewHandler(logger log.Logger, o *Options) *Handler {
Help: "The number of forward requests.",
}, []string{"result"},
),
forwardRequestConfigurationMismatch: promauto.With(o.Registry).NewCounter(
prometheus.CounterOpts{
Name: "thanos_receive_forward_request_config_mismatches_total",
Help: "The number of forward requests that have mismatching configurations.",
},
),
replications: promauto.With(o.Registry).NewCounterVec(
prometheus.CounterOpts{
Name: "thanos_receive_replications_total",
Expand Down Expand Up @@ -258,7 +265,7 @@ func (h *Handler) handleRequest(ctx context.Context, rep uint64, tenant string,
}

if h.hashring.ConfigHash() != config {
// TODO(kakkoyun): Add a metric?
h.forwardRequestConfigurationMismatch.Inc()
level.Warn(h.logger).Log("msg", "hasring configuration mismatch", "current", h.hashring.ConfigHash(), "received", config)
}

Expand Down

0 comments on commit 37f2e33

Please sign in to comment.