Skip to content

Commit

Permalink
[receiver/fluentforward] Fix performance degradation (#20721)
Browse files Browse the repository at this point in the history
* Prevent context from being mutated

* changelog
  • Loading branch information
TylerHelmuth authored Apr 5, 2023
1 parent 52a9d72 commit 23c6e57
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .chloggen/ffr-fix-performance.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: fluentforwardreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fixed performance issue.

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

# (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:
6 changes: 3 additions & 3 deletions receiver/fluentforwardreceiver/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func (c *Collector) processEvents(ctx context.Context) {
c.fillBufferUntilChanEmpty(logSlice)

stats.Record(context.Background(), observ.RecordsGenerated.M(int64(out.LogRecordCount())))
ctx = c.obsrecv.StartLogsOp(ctx)
err := c.nextConsumer.ConsumeLogs(ctx, out)
c.obsrecv.EndLogsOp(ctx, "fluent", out.LogRecordCount(), err)
obsCtx := c.obsrecv.StartLogsOp(ctx)
err := c.nextConsumer.ConsumeLogs(obsCtx, out)
c.obsrecv.EndLogsOp(obsCtx, "fluent", out.LogRecordCount(), err)
}
}
}
Expand Down

0 comments on commit 23c6e57

Please sign in to comment.