prometheus-junkyard / tsdb

The Prometheus time series database layer.
Apache License 2.0
835 stars 178 forks source link

labels: support for removing duplicate labels. #661

Closed johncming closed 5 years ago

johncming commented 5 years ago

It is possible to insert duplicate labels using the FromStrings function

https://github.com/prometheus/tsdb/blob/3bc1ea3d7584d67882fd4019d5bd892905966eb2/labels/labels.go#L148-L162

This pr is modified to improve the function based on 'FromMap'

brian-brazil commented 5 years ago

Which piece of code is using it this way?

johncming commented 5 years ago

Which piece of code is using it this way?

This interface is rarely used, the pr to keep the interfaces consistent.

  1. FromStrings
  2. FromMap

FromMap imply uniqueness, but FromStrings not.

brian-brazil commented 5 years ago

It'd be a programming error if it wasn't unique, and silently throwing away data doesn't sound like the best of ideas.

johncming commented 5 years ago

It'd be a programming error if it wasn't unique, and silently throwing away data doesn't sound like the best of ideas.

ok. I will close the issue