diff --git a/pkg/queryfrontend/metadata_codec.go b/pkg/queryfrontend/metadata_codec.go index 36b7ca7edc7..09c3870fafe 100644 --- a/pkg/queryfrontend/metadata_codec.go +++ b/pkg/queryfrontend/metadata_codec.go @@ -4,21 +4,20 @@ import ( "bytes" "context" "encoding/json" - "io/ioutil" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "github.com/cortexproject/cortex/pkg/querier/queryrange" cortexutil "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/spanlogger" "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" - "github.com/weaveworks/common/httpgrpc" - queryv1 "github.com/thanos-io/thanos/pkg/api/query" + "github.com/weaveworks/common/httpgrpc" + "io/ioutil" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" ) type metadataCodec struct { @@ -47,7 +46,9 @@ func (c metadataCodec) MergeResponse(responses ...queryrange.Response) (queryran for _, res := range responses { for _, value := range res.(*ThanosLabelsResponse).Data { - set[value] = struct{}{} + if _, ok := set[value]; !ok { + set[value] = struct{}{} + } } } labels := make([]string, 0, len(set)) @@ -69,6 +70,7 @@ func (c metadataCodec) MergeResponse(responses ...queryrange.Response) (queryran return &ThanosSeriesResponse{ Status: queryrange.StatusSuccess, + // TODO: fix this Data: metadataResponses[0].Data, }, nil default: @@ -261,6 +263,7 @@ func (c metadataCodec) parseLabelsRequest(r *http.Request, op string) (queryrang break } } + time.Now().UnixNano() return &result, nil }