make kafka config global variable#49347
Conversation
🤖 GitHub commentsJust comment with:
|
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
CI failure is from Root cause (from
Recommended minimal remediation:
Tests/checks run:
What is this? | From workflow: PR Actions Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
/test |
📝 WalkthroughWalkthroughThis change exports previously private configuration-related types and functions in the Kafka output package. The unexported ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
libbeat/outputs/kafka/config.go (1)
231-253:⚠️ Potential issue | 🟠 MajorFix the unsigned-to-signed cast in the Kerberos path.
Line 245 is currently tripping
golangci-lint(G115), so this stays red.config.Kerberos.AuthTypeis being cast tointforsarama.GSSAPIConfig.AuthType; please add an explicit bound check or map the supported auth-type enum values before assigning.If
libbeat/common/transport/kerberosconfirms an unsigned backing type, this cast needs guarding.#!/bin/bash set -euo pipefail # Inspect the Kerberos auth type definition and its valid values. rg -n -C3 --type=go '\btype\s+\w*AuthType\b|\bAuthType\b' libbeat/common/transport/kerberos # Show the cast site that triggers G115. rg -n -C2 --type=go 'AuthType:\s+int\(config\.Kerberos\.AuthType\)' libbeat/outputs/kafka/config.go🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libbeat/outputs/kafka/config.go` around lines 231 - 253, The code casts config.Kerberos.AuthType directly to int when populating sarama.GSSAPIConfig.AuthType (inside k.Net.SASL.GSSAPI), which trips an unsigned-to-signed lint (G115); add an explicit bounds check or map allowable libbeat/common/transport/kerberos AuthType values to the expected sarama integer constants before assignment (e.g., switch/map on config.Kerberos.AuthType), and if the value is out of range return or surface a clear error/default instead of blind casting; update the assignment to use the validated/mapped int value so the cast is safe and lint-clean.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@libbeat/outputs/kafka/config.go`:
- Around line 231-253: The code casts config.Kerberos.AuthType directly to int
when populating sarama.GSSAPIConfig.AuthType (inside k.Net.SASL.GSSAPI), which
trips an unsigned-to-signed lint (G115); add an explicit bounds check or map
allowable libbeat/common/transport/kerberos AuthType values to the expected
sarama integer constants before assignment (e.g., switch/map on
config.Kerberos.AuthType), and if the value is out of range return or surface a
clear error/default instead of blind casting; update the assignment to use the
validated/mapped int value so the cast is safe and lint-clean.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ce570ab1-e9c8-4398-932f-974ae4f91c7c
📒 Files selected for processing (4)
libbeat/outputs/kafka/config.golibbeat/outputs/kafka/config_nofips_test.golibbeat/outputs/kafka/config_test.golibbeat/outputs/kafka/kafka.go
|
Checked workflow run Root cause: none found in this run because no step failed. Recommended action: no remediation needed for this specific run; if you expected a failure, please share the exact failing run ID and I can analyze that one. Tests/log evidence:
What is this? | From workflow: PR Actions Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
The workflow failure is from Root cause from job logs:
Recommended minimal remediation:
Tests run by me: no local test execution; analysis is based on GitHub Actions job logs for the failed run. What is this? | From workflow: PR Actions Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
* add changelog * make kafka config global variable (cherry picked from commit ece5f0f)
* add changelog * make kafka config global variable
* add changelog * make kafka config global variable
Proposed commit message
This PR makes kafka config a global parameter - this is required for kafka output translation to kafka exporter