Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET-6204- Repeating error log in consul-connect-injector #3128

Merged
merged 5 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3128.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
control-plane: only alert on valid errors, not timeouts in gateway
```
8 changes: 7 additions & 1 deletion control-plane/api-gateway/cache/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ func (r *GatewayCache) subscribeToGateway(ctx context.Context, ref api.ResourceR

return nil
}, backoff.WithContext(retryBackoff, ctx)); err != nil {
r.logger.Error(err, fmt.Sprintf("unable to fetch config entry for gateway: %s/%s", ref.Namespace, ref.Name))
// if we timeout we don't care about the error message because it's expected to happen on long polls
// any other error we want to alert on
if !strings.Contains(strings.ToLower(err.Error()), "timeout") &&
!strings.Contains(strings.ToLower(err.Error()), "no such host") &&
!strings.Contains(strings.ToLower(err.Error()), "connection refused") {
r.logger.Error(err, fmt.Sprintf("unable to fetch config entry for gateway: %s/%s", ref.Namespace, ref.Name))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we had a better way to do error handling in general, but this matches what we're doing elsewhere

entries, meta, err := client.ConfigEntries().List(kind, opts.WithContext(ctx))
if err != nil {
// if we timeout we don't care about the error message because it's expected to happen on long polls
// any other error we want to alert on
if !strings.Contains(strings.ToLower(err.Error()), "timeout") &&
!strings.Contains(strings.ToLower(err.Error()), "no such host") &&
!strings.Contains(strings.ToLower(err.Error()), "connection refused") {
c.logger.Error(err, fmt.Sprintf("error fetching config entries for kind: %s", kind))
}
continue
}

continue
}

Expand Down