Adds extra docs to flehs out ParseLabels implementation (#7562)

Adding some extra comments for archaeological purposes
pull/7428/head
Owen Diehl 3 years ago committed by GitHub
parent 8b66e1c3fc
commit fd3a6dfaf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      pkg/logql/syntax/parser.go

@ -202,7 +202,18 @@ func ParseLabels(lbs string) (labels.Labels, error) {
if err != nil {
return nil, err
}
// Sort labels to ensure functionally equivalent
// inputs map to the same output
sort.Sort(ls)
// Use the label builder to trim empty label values.
// Empty label values are equivalent to absent labels
// in Prometheus, but they unfortunately alter the
// Hash values created. This can cause problems in Loki
// if we can't rely on a set of labels to have a deterministic
// hash value.
// Therefore we must normalize early in the write path.
// See https://github.com/grafana/loki/pull/7355
// for more information
return labels.NewBuilder(ls).Labels(nil), nil
}

Loading…
Cancel
Save