Skip to content

Commit

Permalink
Fixes PermissionDenied errors
Browse files Browse the repository at this point in the history
Relates to #32
  • Loading branch information
awlx committed Jun 25, 2021
1 parent 41bf0b9 commit bc04eed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
"google.golang.org/grpc"
"google.golang.org/grpc/status"

"github.com/danopstech/starlink_exporter/pkg/spacex.com/api/device"
)
Expand Down Expand Up @@ -287,8 +288,13 @@ func (e *Exporter) collectDishContext(ch chan<- prometheus.Metric) bool {
defer cancel()
resp, err := e.Client.Handle(ctx, req)
if err != nil {
log.Errorf("failed to collect context from dish: %s", err.Error())
return false
st, ok := status.FromError(err)
if ok && st.Code() == 7 {
log.Info("Got PermissionDenied for Endpoint ... continuing")
} else {
log.Errorf("failed to collect context from dish: %s", err.Error())
return false
}
}

dishC := resp.GetDishGetContext()
Expand Down

0 comments on commit bc04eed

Please sign in to comment.