Skip to content

Commit

Permalink
finding
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasgiese committed Jul 12, 2021
1 parent 2af841d commit 222ec42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cloud/services/compute/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,11 @@ func (s *Service) getPort(portID string) (port *ports.Port, err error) {
}
mc := metrics.NewMetricPrometheusContext("port", "get")
port, err = ports.Get(s.networkClient, portID).Extract()
if mc.ObserveRequest(err) != nil {
if err != nil {
if capoerrors.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("get port %q detail failed: %v", portID, err)
return nil, fmt.Errorf("get port %q detail failed: %v", portID, mc.ObserveRequest(err))
}
return port, nil
}
Expand Down Expand Up @@ -819,11 +819,11 @@ func (s *Service) GetInstance(resourceID string) (instance *infrav1.Instance, er
}
mc := metrics.NewMetricPrometheusContext("server", "get")
server, err := servers.Get(s.computeClient, resourceID).Extract()
if mc.ObserveRequest(err) != nil {
if err != nil {
if capoerrors.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("get server %q detail failed: %v", resourceID, err)
return nil, fmt.Errorf("get server %q detail failed: %v", resourceID, mc.ObserveRequest(err))
}
i, err := serverToInstance(server)
if err != nil {
Expand Down

0 comments on commit 222ec42

Please sign in to comment.