-
Notifications
You must be signed in to change notification settings - Fork 824
More visibility on ingesters #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
6f01040
e4e64a9
207ed77
aeebbd7
67f3172
c891ab5
afaca91
83237c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ import ( | |
|
||
var ( | ||
numClientsDesc = prometheus.NewDesc( | ||
"prometheus_distributor_ingester_clients", | ||
"prism_distributor_ingester_clients", | ||
"The current number of ingester clients.", | ||
nil, nil, | ||
) | ||
|
@@ -51,6 +51,7 @@ type Distributor struct { | |
ingesterAppendFailures *prometheus.CounterVec | ||
ingesterQueries *prometheus.CounterVec | ||
ingesterQueryFailures *prometheus.CounterVec | ||
ingestersAlive *prometheus.Desc | ||
} | ||
|
||
// ReadRing represents the read inferface to the ring. | ||
|
@@ -114,7 +115,7 @@ func NewDistributor(cfg DistributorConfig) (*Distributor, error) { | |
}, []string{"ingester"}), | ||
ingesterAppendFailures: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "prism", | ||
Name: "distributor_ingester_appends_total", | ||
Name: "distributor_ingester_append_failures_total", | ||
Help: "The total number of failed batch appends sent to ingesters.", | ||
}, []string{"ingester"}), | ||
ingesterQueries: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
|
@@ -124,9 +125,14 @@ func NewDistributor(cfg DistributorConfig) (*Distributor, error) { | |
}, []string{"ingester"}), | ||
ingesterQueryFailures: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "prism", | ||
Name: "distributor_ingester_appends_total", | ||
Name: "distributor_ingester_query_failures_total", | ||
Help: "The total number of failed queries sent to ingesters.", | ||
}, []string{"ingester"}), | ||
ingestersAlive: prometheus.NewDesc( | ||
"prism_distributor_ingesters_alive_total", | ||
"Number of ingesters in the ring that have heartbeats within timeout.", | ||
nil, nil, | ||
), | ||
}, nil | ||
} | ||
|
||
|
@@ -257,6 +263,10 @@ func (d *Distributor) Query(ctx context.Context, from, to model.Time, matchers . | |
return err | ||
} | ||
|
||
if len(ingesters) < d.cfg.MinReadSuccesses { | ||
return fmt.Errorf("Could only find %d ingesters for query. Need at least %d", len(ingesters), d.cfg.MinReadSuccesses) | ||
} | ||
|
||
// Fetch samples from multiple ingesters and group them by fingerprint (unsorted | ||
// and with overlap). | ||
successes := 0 | ||
|
@@ -363,6 +373,11 @@ func (d *Distributor) Describe(ch chan<- *prometheus.Desc) { | |
d.sendDuration.Describe(ch) | ||
d.cfg.Ring.Describe(ch) | ||
ch <- numClientsDesc | ||
d.ingesterAppends.Describe(ch) | ||
d.ingesterAppendFailures.Describe(ch) | ||
d.ingesterQueries.Describe(ch) | ||
d.ingesterQueryFailures.Describe(ch) | ||
ch <- d.ingestersAlive | ||
} | ||
|
||
// Collect implements prometheus.Collector. | ||
|
@@ -371,6 +386,16 @@ func (d *Distributor) Collect(ch chan<- prometheus.Metric) { | |
ch <- d.receivedSamples | ||
d.sendDuration.Collect(ch) | ||
d.cfg.Ring.Collect(ch) | ||
d.ingesterAppends.Collect(ch) | ||
d.ingesterAppendFailures.Collect(ch) | ||
d.ingesterQueries.Collect(ch) | ||
d.ingesterQueryFailures.Collect(ch) | ||
|
||
ch <- prometheus.MustNewConstMetric( | ||
d.ingestersAlive, | ||
prometheus.GaugeValue, | ||
float64(len(d.cfg.Ring.GetAll(d.cfg.HeartbeatTimeout))), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This metric might strengthen the argument of moving the heartbeat timeout into the ring completely. We have the total ingesters metric in the ring, but the one about alive ones in the distributor, bleh. Just something to keep in mind though, fine for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as the Ring in inextricably tied to IngesterDesc, sure, why not? |
||
) | ||
|
||
d.clientsMtx.RLock() | ||
defer d.clientsMtx.RUnlock() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start
error
strings lower-cased.