Skip to content

Commit

Permalink
[pkg/batchperresourceattr] Mark as not mutating
Browse files Browse the repository at this point in the history
The consumer does not mutate the original data, it does defensive copying. It improves performance of exporters using it (signalfx, sapm, splunkhec) in forked pipelines
  • Loading branch information
dmitryax committed May 11, 2023
1 parent b4e29f9 commit b05e446
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .chloggen/batchbyres-not-mutating.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Mark as not mutating as it does defensive copying.

# One or more tracking issues related to the change
issues: [21885]
6 changes: 3 additions & 3 deletions pkg/batchperresourceattr/batchperresourceattr.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewBatchPerResourceTraces(attrKey string, next consumer.Traces) consumer.Tr

// Capabilities implements the consumer interface.
func (bt *batchTraces) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: true}
return consumer.Capabilities{MutatesData: false}
}

func (bt *batchTraces) ConsumeTraces(ctx context.Context, td ptrace.Traces) error {
Expand Down Expand Up @@ -90,7 +90,7 @@ func NewBatchPerResourceMetrics(attrKey string, next consumer.Metrics) consumer.

// Capabilities implements the consumer interface.
func (bt *batchMetrics) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: true}
return consumer.Capabilities{MutatesData: false}
}

func (bt *batchMetrics) ConsumeMetrics(ctx context.Context, td pmetric.Metrics) error {
Expand Down Expand Up @@ -142,7 +142,7 @@ func NewBatchPerResourceLogs(attrKey string, next consumer.Logs) consumer.Logs {

// Capabilities implements the consumer interface.
func (bt *batchLogs) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: true}
return consumer.Capabilities{MutatesData: false}
}

func (bt *batchLogs) ConsumeLogs(ctx context.Context, td plog.Logs) error {
Expand Down

0 comments on commit b05e446

Please sign in to comment.