File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,10 @@ func (p *Provider) Instance(ctx context.Context, IP ...gostatsd.Source) (map[gos
8282 values [i ] = string (ip )
8383 }
8484 privateIPFilter := "private-ip-address"
85- input := & ec2.DescribeInstancesInput {
86- Filters : []ec2Types.Filter {
87- {
88- Name : & privateIPFilter ,
89- Values : values ,
90- },
85+ inputFilters := []ec2Types.Filter {
86+ {
87+ Name : & privateIPFilter ,
88+ Values : values ,
9189 },
9290 }
9391
@@ -96,12 +94,19 @@ func (p *Provider) Instance(ctx context.Context, IP ...gostatsd.Source) (map[gos
9694 instancesFound := uint64 (0 )
9795 pages := uint64 (0 )
9896 var err error
97+ var nextToken string
9998
10099 p .logger .WithField ("ips" , IP ).Debug ("Looking up instances" )
101100 hasPagesRemaining := true
102101 for hasPagesRemaining {
103102 pages ++
103+ input := & ec2.DescribeInstancesInput {
104+ Filters : inputFilters ,
105+ NextToken : & nextToken ,
106+ }
107+
104108 page , rawErr := p .Ec2 .DescribeInstances (ctx , input )
109+ nextToken = * page .NextToken
105110 if rawErr != nil {
106111 atomic .AddUint64 (& p .describeInstanceErrors , 1 )
107112 hasPagesRemaining = false
You can’t perform that action at this time.
0 commit comments