Skip to content

Commit 592591b

Browse files
cachedoutycombinator
authored andcommitted
Add graph?=true parameter
Fixes #10561
1 parent 8fd6e58 commit 592591b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

logstash-core/lib/logstash/api/commands/node.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ def pipelines
2424
end
2525
end
2626

27-
def pipeline(pipeline_id)
28-
extract_metrics(
27+
def pipeline(pipeline_id, options={})
28+
metrics = extract_metrics(
2929
[:stats, :pipelines, pipeline_id.to_sym, :config],
30-
:graph,
3130
:ephemeral_id,
3231
:hash,
3332
:workers,
@@ -39,6 +38,10 @@ def pipeline(pipeline_id)
3938
:dead_letter_queue_path,
4039
:cluster_uuids
4140
).reject{|_, v|v.nil?}
41+
if options.fetch(:graph, false)
42+
metrics.merge!(extract_metrics([:stats, :pipelines, pipeline_id.to_sym, :config], :graph))
43+
end
44+
metrics
4245
rescue
4346
{}
4447
end

logstash-core/lib/logstash/api/modules/node.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def node
2828

2929
get "/pipelines/:id" do
3030
pipeline_id = params["id"]
31-
payload = node.pipeline(pipeline_id)
31+
opts = {:graph => as_boolean(params.fetch("graph", false))}
32+
payload = node.pipeline(pipeline_id, opts)
3233
halt(404) if payload.empty?
3334
respond_with(:pipelines => { pipeline_id => payload } )
3435
end

0 commit comments

Comments
 (0)