|
|
@ -176,16 +176,11 @@ func (ce *CircularExemplarStorage) ValidateExemplar(l labels.Labels, e exemplar.
|
|
|
|
return ce.validateExemplar(seriesLabels, e, false)
|
|
|
|
return ce.validateExemplar(seriesLabels, e, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Not thread safe. The append parameters tells us whether this is an external validation, or interal
|
|
|
|
// Not thread safe. The append parameters tells us whether this is an external validation, or internal
|
|
|
|
// as a reuslt of an AddExemplar call, in which case we should update any relevant metrics.
|
|
|
|
// as a result of an AddExemplar call, in which case we should update any relevant metrics.
|
|
|
|
func (ce *CircularExemplarStorage) validateExemplar(l string, e exemplar.Exemplar, append bool) error {
|
|
|
|
func (ce *CircularExemplarStorage) validateExemplar(l string, e exemplar.Exemplar, append bool) error {
|
|
|
|
idx, ok := ce.index[l]
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Exemplar label length does not include chars involved in text rendering such as quotes
|
|
|
|
// Exemplar label length does not include chars involved in text rendering such as quotes
|
|
|
|
// equals sign, or commas. See definiton of const ExemplarMaxLabelLength.
|
|
|
|
// equals sign, or commas. See definition of const ExemplarMaxLabelLength.
|
|
|
|
labelSetLen := 0
|
|
|
|
labelSetLen := 0
|
|
|
|
for _, l := range e.Labels {
|
|
|
|
for _, l := range e.Labels {
|
|
|
|
labelSetLen += utf8.RuneCountInString(l.Name)
|
|
|
|
labelSetLen += utf8.RuneCountInString(l.Name)
|
|
|
@ -196,6 +191,11 @@ func (ce *CircularExemplarStorage) validateExemplar(l string, e exemplar.Exempla
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
idx, ok := ce.index[l]
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check for duplicate vs last stored exemplar for this series.
|
|
|
|
// Check for duplicate vs last stored exemplar for this series.
|
|
|
|
// NB these are expected, and appending them is a no-op.
|
|
|
|
// NB these are expected, and appending them is a no-op.
|
|
|
|
if ce.exemplars[idx.newest].exemplar.Equals(e) {
|
|
|
|
if ce.exemplars[idx.newest].exemplar.Equals(e) {
|
|
|
|