Skip to content

Commit

Permalink
fix(otelcol/fanoutconsumer): fix panic when fanning out to invalid re…
Browse files Browse the repository at this point in the history
…ceivers (#6759)

Signed-off-by: hainenber <[email protected]>
Co-authored-by: Paschalis Tsilias <[email protected]>
  • Loading branch information
hainenber and tpaschalis authored Apr 4, 2024
1 parent 077d70b commit bc294b1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Main (unreleased)
whenever that argument is explicitly configured. This issue only affected a
small subset of arguments across 15 components. (@erikbaranowski, @rfratto)

- Fix panic when fanning out to invalid receivers. (@hainenber)

- Fix a bug where a panic could occur when reloading custom components. (@wildum)

- The `import.git` config block did not work with branches or tags this now fixes that behavior. (@mattdurham)
Expand Down
3 changes: 3 additions & 0 deletions internal/component/otelcol/internal/fanoutconsumer/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func Metrics(in []otelcol.Consumer) otelconsumer.Metrics {
// Iterate through all the consumers besides the last.
for i := 0; i < len(in)-1; i++ {
consumer := in[i]
if consumer == nil {
continue
}

if consumer.Capabilities().MutatesData {
clone = append(clone, consumer)
Expand Down
3 changes: 3 additions & 0 deletions internal/component/otelcol/internal/fanoutconsumer/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func Traces(in []otelcol.Consumer) otelconsumer.Traces {
// Iterate through all the consumers besides the last.
for i := 0; i < len(in)-1; i++ {
consumer := in[i]
if consumer == nil {
continue
}

if consumer.Capabilities().MutatesData {
clone = append(clone, consumer)
Expand Down

0 comments on commit bc294b1

Please sign in to comment.