Skip to content

[9.4] (backport #19091) Clear pipeline metrics when a pipeline fails to start#19120

Open
mergify[bot] wants to merge 2 commits into
9.4from
mergify/bp/9.4/pr-19091
Open

[9.4] (backport #19091) Clear pipeline metrics when a pipeline fails to start#19120
mergify[bot] wants to merge 2 commits into
9.4from
mergify/bp/9.4/pr-19091

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 15, 2026

Release notes

Fixes a metric leak in _node/stats when a pipeline repeatedly fails to start with config.reload.automatic: true. Previously, each retry left a fresh set of plugin metric entries in the collector, causing the stats payload to grow indefinitely.

What does this PR do?

When Create.execute fails, it now calls new_pipeline.shutdown to clean up pipeline metrics.

Reload and Recover are unchanged. Both already invoke old_pipeline.shutdown before retrying, so they inherit the cleanup.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • Verified the fix end-to-end via a Docker repro on the patched image

How to test this PR locally

  1. Run beats-input with invalid SSL certificate
  2. Observe codec count over time curl -s http://localhost:9600/_node/stats/pipelines/main

Expected: codecs stays at 0–2 regardless of how high failures climbs. Total _node/stats payload size stays roughly constant (a few KB) instead of growing linearly with retries.

Related issues

On a failed pipeline start, `Create#execute` now calls `new_pipeline.shutdown`
to clear plugin/events/flow/batch metrics. Without this, retries under
`config.reload.automatic: true` leaked metric entries into `_node/stats`.

Closes #19009

(cherry picked from commit d583fb7)

# Conflicts:
#	logstash-core/lib/logstash/pipeline_action/create.rb
@mergify mergify Bot added backport conflicts Detected git conflicts labels May 15, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented May 15, 2026

Cherry-pick of d583fb7 has failed:

On branch mergify/bp/9.4/pr-19091
Your branch is up to date with 'origin/9.4'.

You are currently cherry-picking commit d583fb7c.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   logstash-core/spec/logstash/pipeline_action/create_spec.rb

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   logstash-core/lib/logstash/pipeline_action/create.rb

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • run exhaustive tests : Run the exhaustive tests Buildkite pipeline.

@elasticmachine
Copy link
Copy Markdown

@kaisecheng kaisecheng requested a review from mashhurs May 15, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts Detected git conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants