Skip to content

Commit

Permalink
[exporter/splunkhec] handle overCapacity error better when we are try…
Browse files Browse the repository at this point in the history
…ing to complete a gzip buffer (open-telemetry#20482)
  • Loading branch information
atoulme committed Mar 29, 2023
1 parent 80aea5f commit 02fa09b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .chloggen/over-capacity-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: splunkhecexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Make sure to not return an error if we are over capacity, just return that we cannot accept the event.

# One or more tracking issues related to the change
issues: [20481]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
4 changes: 4 additions & 0 deletions exporter/splunkhecexporter/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func (b *bufferState) accept(data []byte) (bool, error) {
// if the byte writer was over capacity, try to write the new entry in the zip writer:
if overCapacity {
if _, err2 := zipWriter.Write(data); err2 != nil {
overCapacity2 := errors.Is(err2, errOverCapacity)
if overCapacity2 {
return false, nil
}
return false, err2
}

Expand Down

0 comments on commit 02fa09b

Please sign in to comment.