feat(docker-agent): add payload size logging for debugging body-too-large errors
Related to #823 - Log payload size (in KB and bytes) at debug level - Warn when payload approaches 400KB (512KB limit) - Helps diagnose 'request body too large' errors
This commit is contained in:
parent
aca2534a1a
commit
ce10dbad60
1 changed files with 12 additions and 0 deletions
|
|
@ -1053,8 +1053,20 @@ func (a *Agent) sendReport(ctx context.Context, report agentsdocker.Report) erro
|
|||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
// Warn if payload is approaching the server's 512KB limit
|
||||
const warnThresholdKB = 400
|
||||
payloadSizeKB := len(payload) / 1024
|
||||
if payloadSizeKB >= warnThresholdKB {
|
||||
a.logger.Warn().
|
||||
Int("containers", containerCount).
|
||||
Int("payloadSizeKB", payloadSizeKB).
|
||||
Msg("Report payload is large and approaching the 512KB limit. Consider reducing container count or running 'docker container prune' to remove stopped containers.")
|
||||
}
|
||||
|
||||
a.logger.Debug().
|
||||
Int("containers", containerCount).
|
||||
Int("payloadSizeKB", payloadSizeKB).
|
||||
Int("payloadBytes", len(payload)).
|
||||
Int("targets", len(a.targets)).
|
||||
Msg("Report sent to Pulse targets")
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue