@@ -604,7 +604,7 @@ func (d *Distributor) send(ctx context.Context, ingester ring.IngesterDesc, time
604
604
}
605
605
606
606
// ForAllIngesters runs f, in parallel, for all ingesters
607
- func (d * Distributor ) ForAllIngesters (ctx context.Context , reallyAll bool , f func (client.IngesterClient ) (interface {}, error )) ([]interface {}, error ) {
607
+ func (d * Distributor ) ForAllIngesters (ctx context.Context , reallyAll bool , f func (context. Context , client.IngesterClient ) (interface {}, error )) ([]interface {}, error ) {
608
608
replicationSet , err := d .ingestersRing .GetAll (ring .Read )
609
609
if err != nil {
610
610
return nil , err
@@ -613,13 +613,13 @@ func (d *Distributor) ForAllIngesters(ctx context.Context, reallyAll bool, f fun
613
613
replicationSet .MaxErrors = 0
614
614
}
615
615
616
- return replicationSet .Do (ctx , d .cfg .ExtraQueryDelay , func (ing * ring.IngesterDesc ) (interface {}, error ) {
616
+ return replicationSet .Do (ctx , d .cfg .ExtraQueryDelay , func (ctx context. Context , ing * ring.IngesterDesc ) (interface {}, error ) {
617
617
client , err := d .ingesterPool .GetClientFor (ing .Addr )
618
618
if err != nil {
619
619
return nil , err
620
620
}
621
621
622
- return f (client .(ingester_client.IngesterClient ))
622
+ return f (ctx , client .(ingester_client.IngesterClient ))
623
623
})
624
624
}
625
625
@@ -628,7 +628,7 @@ func (d *Distributor) LabelValuesForLabelName(ctx context.Context, labelName mod
628
628
req := & client.LabelValuesRequest {
629
629
LabelName : string (labelName ),
630
630
}
631
- resps , err := d .ForAllIngesters (ctx , false , func (client client.IngesterClient ) (interface {}, error ) {
631
+ resps , err := d .ForAllIngesters (ctx , false , func (ctx context. Context , client client.IngesterClient ) (interface {}, error ) {
632
632
return client .LabelValues (ctx , req )
633
633
})
634
634
if err != nil {
@@ -652,7 +652,7 @@ func (d *Distributor) LabelValuesForLabelName(ctx context.Context, labelName mod
652
652
// LabelNames returns all of the label names.
653
653
func (d * Distributor ) LabelNames (ctx context.Context ) ([]string , error ) {
654
654
req := & client.LabelNamesRequest {}
655
- resps , err := d .ForAllIngesters (ctx , false , func (client client.IngesterClient ) (interface {}, error ) {
655
+ resps , err := d .ForAllIngesters (ctx , false , func (ctx context. Context , client client.IngesterClient ) (interface {}, error ) {
656
656
return client .LabelNames (ctx , req )
657
657
})
658
658
if err != nil {
@@ -684,7 +684,7 @@ func (d *Distributor) MetricsForLabelMatchers(ctx context.Context, from, through
684
684
return nil , err
685
685
}
686
686
687
- resps , err := d .ForAllIngesters (ctx , false , func (client client.IngesterClient ) (interface {}, error ) {
687
+ resps , err := d .ForAllIngesters (ctx , false , func (ctx context. Context , client client.IngesterClient ) (interface {}, error ) {
688
688
return client .MetricsForLabelMatchers (ctx , req )
689
689
})
690
690
if err != nil {
@@ -712,7 +712,7 @@ func (d *Distributor) MetricsForLabelMatchers(ctx context.Context, from, through
712
712
func (d * Distributor ) MetricsMetadata (ctx context.Context ) ([]scrape.MetricMetadata , error ) {
713
713
req := & ingester_client.MetricsMetadataRequest {}
714
714
// TODO(gotjosh): We only need to look in all the ingesters if shardByAllLabels is enabled.
715
- resps , err := d .ForAllIngesters (ctx , false , func (client client.IngesterClient ) (interface {}, error ) {
715
+ resps , err := d .ForAllIngesters (ctx , false , func (ctx context. Context , client client.IngesterClient ) (interface {}, error ) {
716
716
return client .MetricsMetadata (ctx , req )
717
717
})
718
718
if err != nil {
@@ -746,7 +746,7 @@ func (d *Distributor) MetricsMetadata(ctx context.Context) ([]scrape.MetricMetad
746
746
// UserStats returns statistics about the current user.
747
747
func (d * Distributor ) UserStats (ctx context.Context ) (* UserStats , error ) {
748
748
req := & client.UserStatsRequest {}
749
- resps , err := d .ForAllIngesters (ctx , true , func (client client.IngesterClient ) (interface {}, error ) {
749
+ resps , err := d .ForAllIngesters (ctx , true , func (ctx context. Context , client client.IngesterClient ) (interface {}, error ) {
750
750
return client .UserStats (ctx , req )
751
751
})
752
752
if err != nil {
0 commit comments