-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Include pipeline processing-load snapshot in support bundles #26161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
patrickmann
merged 10 commits into
master
from
feature/processing-load-support-bundle-snapshot
Jun 11, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fd6a35e
Collect pipeline processing-load data for support bundles
xd4rker 1c79958
Minor refactoring
xd4rker f1cf494
Add changelog
xd4rker 2a53d25
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker 7c7440a
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker cbbb7da
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker 52a331b
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker 65bfbe2
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker a5b56da
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker 3b14da1
Merge branch 'master' into feature/processing-load-support-bundle-sna…
xd4rker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type = "a" | ||
| message = "Include pipeline processing-load snapshot in support bundles." | ||
|
|
||
| issues = ["Graylog2/graylog-plugin-enterprise#14145"] | ||
| pulls = ["26161"] |
105 changes: 105 additions & 0 deletions
105
...erver/src/main/java/org/graylog/plugins/pipelineprocessor/rest/ProcessingLoadBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /* | ||
| * Copyright (C) 2020 Graylog, Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the Server Side Public License, version 1, | ||
| * as published by MongoDB, Inc. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * Server Side Public License for more details. | ||
| * | ||
| * You should have received a copy of the Server Side Public License | ||
| * along with this program. If not, see | ||
| * <http://www.mongodb.com/licensing/server-side-public-license>. | ||
| */ | ||
| package org.graylog.plugins.pipelineprocessor.rest; | ||
|
|
||
| import com.google.common.collect.Maps; | ||
| import jakarta.inject.Inject; | ||
| import jakarta.inject.Singleton; | ||
| import org.graylog.plugins.pipelineprocessor.db.RuleMetricsConfigService; | ||
| import org.graylog.plugins.pipelineprocessor.processors.PipelineInterpreterStateUpdater; | ||
| import org.graylog.plugins.pipelineprocessor.rest.ProcessingLoadService.ActiveCombination; | ||
| import org.graylog2.rest.models.system.metrics.responses.MetricsSummaryResponse; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Builds a {@link ProcessingLoadResponse} from cluster-wide debug timer data, shared by the | ||
| * {@code /system/pipelines/processing-load} endpoint and the support-bundle snapshot so both stay | ||
| * in sync. Callers pass a {@link NodeMetricsFetcher}, keeping this class agnostic of how the | ||
| * per-node {@code multipleMetrics} fan-out is transported. | ||
| */ | ||
| @Singleton | ||
| public class ProcessingLoadBuilder { | ||
|
|
||
| private final PipelineInterpreterStateUpdater stateUpdater; | ||
| private final RuleMetricsConfigService ruleMetricsConfigService; | ||
| private final ProcessingLoadService processingLoadService; | ||
| private final NodeTimerSnapshotParser snapshotParser; | ||
|
|
||
| @Inject | ||
| public ProcessingLoadBuilder(PipelineInterpreterStateUpdater stateUpdater, | ||
| RuleMetricsConfigService ruleMetricsConfigService, | ||
| ProcessingLoadService processingLoadService, | ||
| NodeTimerSnapshotParser snapshotParser) { | ||
| this.stateUpdater = stateUpdater; | ||
| this.ruleMetricsConfigService = ruleMetricsConfigService; | ||
| this.processingLoadService = processingLoadService; | ||
| this.snapshotParser = snapshotParser; | ||
| } | ||
|
|
||
| public boolean metricsEnabled() { | ||
| return ruleMetricsConfigService.get().metricsEnabled(); | ||
| } | ||
|
|
||
| /** | ||
| * The active pipeline-stage-rule combinations, or empty if debug metrics are off. Callers can | ||
| * permission-check these before the cluster fan-out, then pass the same list to | ||
| * {@link #buildUnfiltered(List, NodeMetricsFetcher)} to avoid resolving them twice. | ||
| */ | ||
| List<ActiveCombination> activeCombinations() { | ||
| if (!metricsEnabled()) { | ||
| return List.of(); | ||
| } | ||
| return processingLoadService.activeCombinations(stateUpdater.getLatestState()); | ||
| } | ||
|
|
||
| /** | ||
| * Builds the unfiltered response, resolving the active combinations itself. Returns | ||
| * {@code unavailable} when metrics are off, no combinations are active, or no node reported data. | ||
| */ | ||
| public ProcessingLoadResponse buildUnfiltered(NodeMetricsFetcher fetcher) { | ||
| return buildUnfiltered(activeCombinations(), fetcher); | ||
| } | ||
|
|
||
| /** | ||
| * Builds the unfiltered response from already-resolved combinations, so a caller that needed | ||
| * them (e.g. for a permission check) doesn't recompute them. | ||
| */ | ||
| ProcessingLoadResponse buildUnfiltered(List<ActiveCombination> combinations, NodeMetricsFetcher fetcher) { | ||
| if (combinations.isEmpty()) { | ||
| return ProcessingLoadResponse.unavailable(); | ||
| } | ||
|
|
||
| final List<String> timerNames = processingLoadService.expectedTimerNames(combinations); | ||
| final Map<String, MetricsSummaryResponse> perNodeResponses = fetcher.fetch(timerNames); | ||
| final Map<String, NodeTimerSnapshot> perNodeSnapshots = Maps.newHashMapWithExpectedSize(perNodeResponses.size()); | ||
| perNodeResponses.forEach((nodeId, response) -> perNodeSnapshots.put(nodeId, snapshotParser.parse(response))); | ||
|
|
||
| return processingLoadService.compute(combinations, perNodeSnapshots); | ||
| } | ||
|
|
||
| /** | ||
| * Fans a {@code multipleMetrics} call out to every node, returning responses keyed by node id. | ||
| * The implementation supplies the transport (REST proxy vs. support-bundle helper). | ||
| * A node missing from the map simply has no data. | ||
| */ | ||
| @FunctionalInterface | ||
| public interface NodeMetricsFetcher { | ||
| Map<String, MetricsSummaryResponse> fetch(List<String> timerNames); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.