Use a trivial solution to #1605

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2024-08-31 10:34:02 +02:00
parent e061dfae88
commit dc819ceb1b
1 changed files with 3 additions and 3 deletions

View File

@ -1682,13 +1682,13 @@ func makeNativeExemplars(ttl time.Duration, maxCount int) nativeExemplars {
}
func (n *nativeExemplars) addExemplar(e *dto.Exemplar) {
n.Lock()
defer n.Unlock()
if cap(n.exemplars) == 0 {
return
}
n.Lock()
defer n.Unlock()
// The index where to insert the new exemplar.
var nIdx int = -1