@@ -1367,8 +1367,8 @@ func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time, hint
13671367}
13681368
13691369// MetricsForLabelMatchers gets the metrics that match said matchers 
1370- func  (d  * Distributor ) MetricsForLabelMatchers (ctx  context.Context , from , through  model.Time , hint  * storage.SelectHints , partialDataEnabled  bool , matchers  ... * labels.Matcher ) ([]model. Metric , error ) {
1371- 	return  d .metricsForLabelMatchersCommon (ctx , from , through , hint , func (ctx  context.Context , rs  ring.ReplicationSet , req  * ingester_client.MetricsForLabelMatchersRequest , metrics  * map [model.Fingerprint ]model. Metric , mutex  * sync.Mutex , queryLimiter  * limiter.QueryLimiter ) error  {
1370+ func  (d  * Distributor ) MetricsForLabelMatchers (ctx  context.Context , from , through  model.Time , hint  * storage.SelectHints , partialDataEnabled  bool , matchers  ... * labels.Matcher ) ([]labels. Labels , error ) {
1371+ 	return  d .metricsForLabelMatchersCommon (ctx , from , through , hint , func (ctx  context.Context , rs  ring.ReplicationSet , req  * ingester_client.MetricsForLabelMatchersRequest , metrics  * map [model.Fingerprint ]labels. Labels , mutex  * sync.Mutex , queryLimiter  * limiter.QueryLimiter ) error  {
13721372		_ , err  :=  d .ForReplicationSet (ctx , rs , false , partialDataEnabled , func (ctx  context.Context , client  ingester_client.IngesterClient ) (interface {}, error ) {
13731373			resp , err  :=  client .MetricsForLabelMatchers (ctx , req )
13741374			if  err  !=  nil  {
@@ -1380,8 +1380,8 @@ func (d *Distributor) MetricsForLabelMatchers(ctx context.Context, from, through
13801380			s  :=  make ([][]cortexpb.LabelAdapter , 0 , len (resp .Metric ))
13811381			for  _ , m  :=  range  resp .Metric  {
13821382				s  =  append (s , m .Labels )
1383- 				m  :=  cortexpb .FromLabelAdaptersToMetric (m .Labels )
1384- 				fingerprint  :=  m . Fingerprint ( )
1383+ 				m  :=  cortexpb .FromLabelAdaptersToLabels (m .Labels )
1384+ 				fingerprint  :=  cortexpb . LabelsToFingerprint ( m )
13851385				mutex .Lock ()
13861386				(* metrics )[fingerprint ] =  m 
13871387				mutex .Unlock ()
@@ -1396,8 +1396,8 @@ func (d *Distributor) MetricsForLabelMatchers(ctx context.Context, from, through
13961396	}, matchers ... )
13971397}
13981398
1399- func  (d  * Distributor ) MetricsForLabelMatchersStream (ctx  context.Context , from , through  model.Time , hint  * storage.SelectHints , partialDataEnabled  bool , matchers  ... * labels.Matcher ) ([]model. Metric , error ) {
1400- 	return  d .metricsForLabelMatchersCommon (ctx , from , through , hint , func (ctx  context.Context , rs  ring.ReplicationSet , req  * ingester_client.MetricsForLabelMatchersRequest , metrics  * map [model.Fingerprint ]model. Metric , mutex  * sync.Mutex , queryLimiter  * limiter.QueryLimiter ) error  {
1399+ func  (d  * Distributor ) MetricsForLabelMatchersStream (ctx  context.Context , from , through  model.Time , hint  * storage.SelectHints , partialDataEnabled  bool , matchers  ... * labels.Matcher ) ([]labels. Labels , error ) {
1400+ 	return  d .metricsForLabelMatchersCommon (ctx , from , through , hint , func (ctx  context.Context , rs  ring.ReplicationSet , req  * ingester_client.MetricsForLabelMatchersRequest , metrics  * map [model.Fingerprint ]labels. Labels , mutex  * sync.Mutex , queryLimiter  * limiter.QueryLimiter ) error  {
14011401		_ , err  :=  d .ForReplicationSet (ctx , rs , false , partialDataEnabled , func (ctx  context.Context , client  ingester_client.IngesterClient ) (interface {}, error ) {
14021402			stream , err  :=  client .MetricsForLabelMatchersStream (ctx , req )
14031403			if  err  !=  nil  {
@@ -1417,9 +1417,9 @@ func (d *Distributor) MetricsForLabelMatchersStream(ctx context.Context, from, t
14171417
14181418				s  :=  make ([][]cortexpb.LabelAdapter , 0 , len (resp .Metric ))
14191419				for  _ , metric  :=  range  resp .Metric  {
1420- 					m  :=  cortexpb .FromLabelAdaptersToMetricWithCopy (metric .Labels )
1420+ 					m  :=  cortexpb .FromLabelAdaptersToLabels (metric .Labels )
14211421					s  =  append (s , metric .Labels )
1422- 					fingerprint  :=  m . Fingerprint ( )
1422+ 					fingerprint  :=  cortexpb . LabelsToFingerprint ( m )
14231423					mutex .Lock ()
14241424					(* metrics )[fingerprint ] =  m 
14251425					mutex .Unlock ()
@@ -1436,7 +1436,7 @@ func (d *Distributor) MetricsForLabelMatchersStream(ctx context.Context, from, t
14361436	}, matchers ... )
14371437}
14381438
1439- func  (d  * Distributor ) metricsForLabelMatchersCommon (ctx  context.Context , from , through  model.Time , hints  * storage.SelectHints , f  func (context.Context , ring.ReplicationSet , * ingester_client.MetricsForLabelMatchersRequest , * map [model.Fingerprint ]model. Metric , * sync.Mutex , * limiter.QueryLimiter ) error , matchers  ... * labels.Matcher ) ([]model. Metric , error ) {
1439+ func  (d  * Distributor ) metricsForLabelMatchersCommon (ctx  context.Context , from , through  model.Time , hints  * storage.SelectHints , f  func (context.Context , ring.ReplicationSet , * ingester_client.MetricsForLabelMatchersRequest , * map [model.Fingerprint ]labels. Labels , * sync.Mutex , * limiter.QueryLimiter ) error , matchers  ... * labels.Matcher ) ([]labels. Labels , error ) {
14401440	replicationSet , err  :=  d .GetIngestersForMetadata (ctx )
14411441	queryLimiter  :=  limiter .QueryLimiterFromContextWithFallback (ctx )
14421442	if  err  !=  nil  {
@@ -1448,7 +1448,7 @@ func (d *Distributor) metricsForLabelMatchersCommon(ctx context.Context, from, t
14481448		return  nil , err 
14491449	}
14501450	mutex  :=  sync.Mutex {}
1451- 	metrics  :=  map [model.Fingerprint ]model. Metric {}
1451+ 	metrics  :=  map [model.Fingerprint ]labels. Labels {}
14521452
14531453	err  =  f (ctx , replicationSet , req , & metrics , & mutex , queryLimiter )
14541454
@@ -1457,7 +1457,7 @@ func (d *Distributor) metricsForLabelMatchersCommon(ctx context.Context, from, t
14571457	}
14581458
14591459	mutex .Lock ()
1460- 	result  :=  make ([]model. Metric , 0 , len (metrics ))
1460+ 	result  :=  make ([]labels. Labels , 0 , len (metrics ))
14611461	for  _ , m  :=  range  metrics  {
14621462		result  =  append (result , m )
14631463	}
0 commit comments