Skip to content

fix: Correctly handle the deprecated topic field in otelcol.receiver.kafka configuration#5726

Merged
thampiotr merged 2 commits into
mainfrom
thampiotr/kafka-topic-bug
Mar 9, 2026
Merged

fix: Correctly handle the deprecated topic field in otelcol.receiver.kafka configuration#5726
thampiotr merged 2 commits into
mainfrom
thampiotr/kafka-topic-bug

Conversation

@thampiotr
Copy link
Copy Markdown
Contributor

@thampiotr thampiotr commented Mar 9, 2026

Brief description of Pull Request

Fixes otelcol.receiver.kafka conversion logic to correctly handle the deprecated per-signal topic attribute by migrating it into the new topics field, aligning with upstream Kafka receiver behavior.

Pull Request Details

The documentation was already correct and doesn't require updates.

Issue(s) fixed by this Pull Request

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

@thampiotr thampiotr requested a review from Copilot March 9, 2026 15:23
@thampiotr thampiotr changed the title fix: otelcol.receiver.kafka incorrect handling of the deprecated topic config attribute fix: Correctly handle the deprecated topic field in otelcol.receiver.kafka configuration Mar 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes otelcol.receiver.kafka conversion logic to correctly handle the deprecated per-signal topic attribute by migrating it into the new topics field, aligning with upstream Kafka receiver behavior.

Changes:

  • Add migration logic during conversion so topic (singular, deprecated) becomes topics (slice) in the generated kafkareceiver.Config.
  • Emit a warning log when the deprecated topic attribute is used.
  • Add a unit test to ensure deprecated topic is migrated and cleared in the converted config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/component/otelcol/receiver/kafka/kafka.go Migrates deprecated topic into topics, logs deprecation usage, and validates the resulting upstream config.
internal/component/otelcol/receiver/kafka/kafka_test.go Adds coverage verifying topictopics migration for logs/metrics/traces.

@thampiotr thampiotr marked this pull request as ready for review March 9, 2026 15:40
@thampiotr thampiotr requested a review from a team as a code owner March 9, 2026 15:40
@thampiotr thampiotr enabled auto-merge (squash) March 9, 2026 15:45
@thampiotr thampiotr merged commit 538ac75 into main Mar 9, 2026
55 of 56 checks passed
@thampiotr thampiotr deleted the thampiotr/kafka-topic-bug branch March 9, 2026 16:15
@thampiotr thampiotr added the backport/v1.14 Backport to release/v1.14 label Mar 9, 2026
grafana-alloybot Bot pushed a commit that referenced this pull request Mar 9, 2026
…kafka configuration (#5726)

<!--
  CONTRIBUTORS GUIDE:

https://github.com/grafana/alloy/blob/main/docs/developer/contributing.md

If this is your first PR or you have not contributed in a while, we
recommend
  taking the time to review the guide.

  **NOTE**
Your PR title must adhere to Conventional Commit style. For details on
this,
  check out the Contributors Guide linked above.
-->

### Brief description of Pull Request

Fixes otelcol.receiver.kafka conversion logic to correctly handle the
deprecated per-signal topic attribute by migrating it into the new
topics field, aligning with upstream Kafka receiver behavior.

<!--
Add a human-readable description of the PR that may be used as the
commit body
  (i.e. "Extended description") when it gets merged.
-->

### Pull Request Details

The documentation was already correct and doesn't require updates.

<!-- Add a more detailed descripion of the Pull Request here, if needed.
-->

### Issue(s) fixed by this Pull Request

<!--
Uncomment the following line and fill in an issue number if you want a
GitHub
  issue to be closed automatically when this PR gets merged.
-->

<!-- Fixes #issue_id -->

### Notes to the Reviewer

<!-- Add any relevant notes for the reviewers and testers of this PR.
-->

### PR Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [x] Documentation added
- [x] Tests updated
- [ ] Config converters updated

(cherry picked from commit 538ac75)
thampiotr added a commit that referenced this pull request Mar 9, 2026
…kafka configuration [backport] (#5730)

## Backport of #5726

This PR backports #5726 to release/v1.14.

### Original PR Author
@thampiotr

### Description
<!--
  CONTRIBUTORS GUIDE:

https://github.com/grafana/alloy/blob/main/docs/developer/contributing.md

If this is your first PR or you have not contributed in a while, we
recommend
  taking the time to review the guide.

  **NOTE**
Your PR title must adhere to Conventional Commit style. For details on
this,
  check out the Contributors Guide linked above.
-->

### Brief description of Pull Request

Fixes otelcol.receiver.kafka conversion logic to correctly handle the
deprecated per-signal topic attribute by migrating it into the new
topics field, aligning with upstream Kafka receiver behavior.

<!--
Add a human-readable description of the PR that may be used as the
commit body
  (i.e. "Extended description") when it gets merged.
-->

### Pull Request Details

The documentation was already correct and doesn't require updates. 

<!-- Add a more detailed descripion of the Pull Request here, if needed.
-->

### Issue(s) fixed by this Pull Request

<!--
Uncomment the following line and fill in an issue number if you want a
GitHub
  issue to be closed automatically when this PR gets merged.
-->

<!-- Fixes #issue_id -->

### Notes to the Reviewer

<!-- Add any relevant notes for the reviewers and testers of this PR.
-->

### PR Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [x] Documentation added
- [x] Tests updated
- [ ] Config converters updated


---
*This backport was created automatically.*

Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v1.14 Backport to release/v1.14 frozen-due-to-age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants