propagate pipeline.id to api resources

this removes explicit references to the "main" pipeline,
using instead the value of the `pipeline.id` from LogStash::SETINGS

Fixes #6606
This commit is contained in:
Joao Duarte 2017-01-27 11:58:48 +00:00 committed by João Duarte
parent 95cfe756a7
commit f5601ecbd7
2 changed files with 8 additions and 9 deletions

View file

@ -17,11 +17,12 @@ module LogStash
payload
end
def pipeline
extract_metrics(
[:stats, :pipelines, :main, :config],
def pipeline(pipeline_id = LogStash::SETTINGS.get("pipeline.id").to_sym)
stats = extract_metrics(
[:stats, :pipelines, pipeline_id, :config],
:workers, :batch_size, :batch_delay, :config_reload_automatic, :config_reload_interval
)
stats.merge(:id => pipeline_id)
end
def os

View file

@ -45,9 +45,10 @@ module LogStash
)
end
def pipeline
stats = service.get_shallow(:stats, :pipelines)
PluginsStats.report(stats)
def pipeline(pipeline_id = LogStash::SETTINGS.get("pipeline.id").to_sym)
stats = service.get_shallow(:stats, :pipelines, pipeline_id)
stats = PluginsStats.report(stats)
stats.merge(:id => pipeline_id)
end
def memory
@ -98,9 +99,6 @@ module LogStash
end
def report(stats)
# Only one pipeline right now.
stats = stats[:main]
{
:events => stats[:events],
:plugins => {