Don't federate stale samples
This commit is contained in:
parent
5af6dda58c
commit
b35e25a082
|
@ -46,11 +46,13 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
format := expfmt.Negotiate(req.Header)
|
var (
|
||||||
|
minTimestamp = model.Now().Add(-promql.StalenessDelta)
|
||||||
|
format = expfmt.Negotiate(req.Header)
|
||||||
|
enc = expfmt.NewEncoder(w, format)
|
||||||
|
)
|
||||||
w.Header().Set("Content-Type", string(format))
|
w.Header().Set("Content-Type", string(format))
|
||||||
|
|
||||||
enc := expfmt.NewEncoder(w, format)
|
|
||||||
|
|
||||||
protMetric := &dto.Metric{
|
protMetric := &dto.Metric{
|
||||||
Label: []*dto.LabelPair{},
|
Label: []*dto.LabelPair{},
|
||||||
Untyped: &dto.Untyped{},
|
Untyped: &dto.Untyped{},
|
||||||
|
@ -64,7 +66,8 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) {
|
||||||
globalUsed := map[model.LabelName]struct{}{}
|
globalUsed := map[model.LabelName]struct{}{}
|
||||||
|
|
||||||
sp := h.storage.LastSamplePairForFingerprint(fp)
|
sp := h.storage.LastSamplePairForFingerprint(fp)
|
||||||
if sp == nil {
|
// Discard if sample does not exist or lays before the staleness interval.
|
||||||
|
if sp == nil || sp.Timestamp.Before(minTimestamp) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ func webUiTemplatesAlertsHtml() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "web/ui/templates/alerts.html", size: 1707, mode: os.FileMode(420), modTime: time.Unix(1448976906, 0)}
|
info := bindataFileInfo{name: "web/ui/templates/alerts.html", size: 1707, mode: os.FileMode(420), modTime: time.Unix(1450269200, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue