Skip to content

Commit 6ca302c

Browse files
committed
Moved vpc lookup cache miss to be before potential errors
1 parent 3403539 commit 6ca302c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/aws/albec2/ec2.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ func (e *EC2) GetVPCID() (*string, error) {
622622
return vpc, nil
623623
}
624624

625+
albprom.AWSCache.With(prometheus.Labels{"cache": "vpc", "action": "miss"}).Add(float64(1))
626+
625627
// cache miss: begin lookup of VpcId based on current EC2 instance
626628
// retrieve identity of current running instance
627629
identityDoc, err := EC2Metadatasvc.GetInstanceIdentityDocument()
@@ -651,7 +653,6 @@ func (e *EC2) GetVPCID() (*string, error) {
651653
vpc = descInstancesOutput.Reservations[0].Instances[0].VpcId
652654
// cache the retrieved VpcId for next call
653655
e.cache.Set(key, vpc, time.Minute*60)
654-
albprom.AWSCache.With(prometheus.Labels{"cache": "vpc", "action": "miss"}).Add(float64(1))
655656
return vpc, nil
656657
}
657658

0 commit comments

Comments
 (0)