Skip to content

Commit

Permalink
fleetdb: match on error and status code, update metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Aug 23, 2024
1 parent 37721ec commit d6045f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/fleetdb/fleetdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
)

func fleetdbAPIError(operation string) {
metrics.DependencyError("serverservice", operation)
metrics.DependencyError("fleetdbapi", operation)
}

// AddServer creates a server record in FleetDB
Expand Down Expand Up @@ -218,7 +218,8 @@ func (s *fleetDBImpl) FirmwareSetByID(ctx context.Context, id uuid.UUID) (*fleet
errFirmwareSetIDLookup := errors.New("error in firmware set ID lookup")
obj, _, err := s.client.GetServerComponentFirmwareSet(otelCtx, id)
if err != nil {
if strings.Contains(err.Error(), "404") {
se := &fleetdbapi.ServerError{}
if errors.As(err, se) && se.StatusCode == 404 {
return nil, ErrFirmwareSetNotFound
}

Expand Down

0 comments on commit d6045f4

Please sign in to comment.