outputs: remove redundant beatPaths parameter from Factory#49839
outputs: remove redundant beatPaths parameter from Factory#49839orestisfl wants to merge 2 commits intoelastic:mainfrom
Conversation
🤖 GitHub commentsJust comment with:
|
This comment has been minimized.
This comment has been minimized.
16c045b to
0f9b932
Compare
|
This pull request is now in conflicts. Could you fix it? 🙏 |
Now that Paths lives in beat.Info, output factories can access paths via the Info parameter. The separate paths argument is no longer needed in the Factory type or Load function.
0f9b932 to
5adeee3
Compare
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
📝 WalkthroughWalkthroughThis change removes the explicit Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
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 (2)
libbeat/publisher/pipeline/stress/run.go (1)
70-93:⚠️ Potential issue | 🟠 Major
RunTestsdoes not propagate constructed paths to output factories.The function creates
beatPaths(lines 70–75) and assigns it topipelineSettings.Paths, but output factories receiveinfowith its originalPathsfield unset. Multiple outputs (elasticsearch, logstash, kafka, redis, fileout, console, discard) explicitly usebeat.Paths, so this leaves them without proper path configuration.Add
info.Paths = beatPathsafter the local paths initialization to ensure outputs receive the intended configuration.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libbeat/publisher/pipeline/stress/run.go` around lines 70 - 93, The constructed local beatPaths are assigned to pipelineSettings.Paths but not injected into the Beat info passed to output factories; update the RunTests function to set info.Paths = beatPaths immediately after creating beatPaths (after beatPaths.Home/Config/Data/Logs are set) so that outputs loaded by outputs.Load (inside the anonymous factory passed to pipeline.LoadWithSettings) receive the proper Paths configuration; keep the existing pipelineSettings assignment to Paths as well.x-pack/dockerlogbeat/pipelinemanager/libbeattools.go (1)
68-75:⚠️ Potential issue | 🔴 Critical
info.Pathsis not populated beforeoutputs.Load, so path-aware outputs can failLine 87 now relies on
beat.Info.Paths, but this file never assignsbeatPathsintoinfo.Paths. That can break outputs that resolve files/certs/templates via beat paths.Suggested fix
@@ info, err := getBeatInfo(logOptsConfig, hostname, log) if err != nil { return nil, err } + beatPaths := paths.New() + info.Paths = beatPaths + processing, err := processing.MakeDefaultBeatSupport(true)(info, log, cfg) if err != nil { return nil, fmt.Errorf("error in MakeDefaultSupport: %w", err) } @@ - beatPaths := paths.New() - settings := pipeline.Settings{ WaitClose: time.Second * 10, WaitCloseMode: pipeline.WaitOnPipelineClose, Processors: processing, Paths: beatPaths, }Also applies to: 87-88
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@x-pack/dockerlogbeat/pipelinemanager/libbeattools.go` around lines 68 - 75, The code constructs beatPaths and passes it into pipeline.Settings but does not assign those paths to beat.Info.Paths before calling outputs.Load, causing path-aware outputs to fail; fix by setting info.Paths = beatPaths (or otherwise populating the beat.Info object used by outputs.Load) prior to calling outputs.Load so outputs can resolve files/certs/templates correctly — update the code around where beatPaths is created and before outputs.Load is invoked (referencing beatPaths, pipeline.Settings, outputs.Load, and beat.Info.Paths).
🤖 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/publisher/pipeline/stress/run.go`:
- Around line 70-93: The constructed local beatPaths are assigned to
pipelineSettings.Paths but not injected into the Beat info passed to output
factories; update the RunTests function to set info.Paths = beatPaths
immediately after creating beatPaths (after beatPaths.Home/Config/Data/Logs are
set) so that outputs loaded by outputs.Load (inside the anonymous factory passed
to pipeline.LoadWithSettings) receive the proper Paths configuration; keep the
existing pipelineSettings assignment to Paths as well.
In `@x-pack/dockerlogbeat/pipelinemanager/libbeattools.go`:
- Around line 68-75: The code constructs beatPaths and passes it into
pipeline.Settings but does not assign those paths to beat.Info.Paths before
calling outputs.Load, causing path-aware outputs to fail; fix by setting
info.Paths = beatPaths (or otherwise populating the beat.Info object used by
outputs.Load) prior to calling outputs.Load so outputs can resolve
files/certs/templates correctly — update the code around where beatPaths is
created and before outputs.Load is invoked (referencing beatPaths,
pipeline.Settings, outputs.Load, and beat.Info.Paths).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 47d8be26-9287-42c8-8328-8f2eb79b1618
📒 Files selected for processing (20)
libbeat/cmd/instance/beat.golibbeat/cmd/test/output.golibbeat/outputs/console/console.golibbeat/outputs/discard/discard.golibbeat/outputs/elasticsearch/client_integration_test.golibbeat/outputs/elasticsearch/elasticsearch.golibbeat/outputs/fileout/file.golibbeat/outputs/kafka/client_test.golibbeat/outputs/kafka/kafka.golibbeat/outputs/kafka/kafka_integration_test.golibbeat/outputs/logstash/logstash.golibbeat/outputs/logstash/logstash_integration_test.golibbeat/outputs/logstash/logstash_test.golibbeat/outputs/output_reg.golibbeat/outputs/redis/redis.golibbeat/outputs/redis/redis_integration_test.golibbeat/outputs/redis/redis_test.golibbeat/publisher/pipeline/stress/out.golibbeat/publisher/pipeline/stress/run.gox-pack/dockerlogbeat/pipelinemanager/libbeattools.go
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
TL;DR
Remediation
Investigation detailsRoot CauseThe failing step is a compile-time/vet error in
Buildkite reports that Evidence
Verification
Follow-upAfter fixing the two call sites, check whether any additional tests in Note 🔒 Integrity filter blocked 2 itemsThe following items were blocked because they don't meet the GitHub integrity level.
To allow these resources, lower tools:
github:
min-integrity: approved # merged | approved | unapproved | noneWhat is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
Proposed commit message
Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragmentsusing the changelog tool.Disruptive User Impact
None. Internal API change only.
How to test this PR locally
Related issues
Beat.Info#49803