Skip to content

Commit

Permalink
Always log host metadata payload, even when too large (DataDog#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
zippolyte authored Jan 17, 2019
1 parent 5dc049a commit 03047b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/serializer/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,19 @@ func (s *Serializer) SendMetadata(m marshaler.Marshaler) error {
smallEnough, payload, err := split.CheckSizeAndSerialize(m, false, split.MarshalJSON)
if err != nil {
return fmt.Errorf("could not determine size of metadata payload: %s", err)
} else if !smallEnough {
return fmt.Errorf("metadata payload was too big to send, metadata payloads cannot be split")
}

log.Debugf("Sending host metadata payload, content: %v", apiKeyRegExp.ReplaceAllString(string(payload), apiKeyReplacement))

if !smallEnough {
return fmt.Errorf("metadata payload was too big to send (%d bytes), metadata payloads cannot be split", len(payload))
}

if err := s.Forwarder.SubmitV1Intake(forwarder.Payloads{&payload}, jsonExtraHeaders); err != nil {
return err
}

log.Infof("Sent host metadata payload, size: %d bytes.", len(payload))
log.Debugf("Sent host metadata payload, content: %v", apiKeyRegExp.ReplaceAllString(string(payload), apiKeyReplacement))
return nil
}

Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/log_host_meta-161ea1937da7bb2a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Each section from every releasenote are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
other:
- Log host metadata at debug level regardless of its size.

0 comments on commit 03047b0

Please sign in to comment.