Skip to content

Commit

Permalink
fix(telemetry): ignores http get success (spam)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Jul 21, 2024
1 parent eeaf2dc commit 58eb262
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cmd/watch/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,20 @@ func handleConfig(ctx context.Context, version string, config *Config) {
}

client := &http.Client{
Jar: jar,
Timeout: time.Minute,
Transport: otelhttp.NewTransport(http.DefaultTransport),
Jar: jar,
Timeout: time.Minute,
Transport: otelhttp.NewTransport(
http.DefaultTransport,
otelhttp.WithFilter(func(r *http.Request) bool {
if r.Method != http.MethodPost && r.Method != http.MethodPut &&
r.Method != http.MethodPatch {
// Ignore 2XX status codes
return r.Response == nil || r.Response.StatusCode < 200 ||
r.Response.StatusCode >= 300
}
return true
}),
),
}
if params.CookiesRefreshDuration != 0 && params.CookiesFile != "" {
log.Info().Dur("duration", params.CookiesRefreshDuration).Msg("will refresh cookies")
Expand Down

0 comments on commit 58eb262

Please sign in to comment.