mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
* api: avoid 5xx when stats/events not yet populated
* Add catching of metrics exception also for retrieve of :queue metrics. No pipelines means no queues created
* Added empty result when no pipelines is present and query for node info API
Co-authored-by: andsel <selva.andre@gmail.com>
(cherry picked from commit a6c0e75b53
)
This commit is contained in:
parent
5d0ad6ea38
commit
a491462e69
2 changed files with 7 additions and 0 deletions
|
@ -38,6 +38,8 @@ module LogStash
|
||||||
pipeline_ids.each_with_object({}) do |pipeline_id, result|
|
pipeline_ids.each_with_object({}) do |pipeline_id, result|
|
||||||
result[pipeline_id] = pipeline(pipeline_id, options)
|
result[pipeline_id] = pipeline(pipeline_id, options)
|
||||||
end
|
end
|
||||||
|
rescue Instrument::MetricStore::MetricNotFound
|
||||||
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
def pipeline(pipeline_id, options={})
|
def pipeline(pipeline_id, options={})
|
||||||
|
|
|
@ -39,6 +39,8 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
{:events_count => total_queued_events}
|
{:events_count => total_queued_events}
|
||||||
|
rescue Instrument::MetricStore::MetricNotFound
|
||||||
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
def jvm
|
def jvm
|
||||||
|
@ -74,6 +76,9 @@ module LogStash
|
||||||
[:stats, :events],
|
[:stats, :events],
|
||||||
:in, :filtered, :out, :duration_in_millis, :queue_push_duration_in_millis
|
:in, :filtered, :out, :duration_in_millis, :queue_push_duration_in_millis
|
||||||
)
|
)
|
||||||
|
rescue Instrument::MetricStore::MetricNotFound
|
||||||
|
# if the stats/events metrics have not yet been populated, return an empty map
|
||||||
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
def pipeline(pipeline_id = nil, opts={})
|
def pipeline(pipeline_id = nil, opts={})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue