File tree Expand file tree Collapse file tree
lib/logstash/api/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ def pipeline(pipeline_id = nil, opts={})
6565 service . agent ,
6666 service . snapshot . metric_store ,
6767 true ) . each_with_object ( { } ) do |pipeline_stats , memo |
68- pipeline_id = pipeline_stats [ "id" ] . to_s
69- memo [ pipeline_id ] = pipeline_stats
68+ p_id = pipeline_stats [ "id" ] . to_s
69+ memo [ p_id ] = pipeline_stats
7070 end
7171
7272 if pipeline_id . nil?
Original file line number Diff line number Diff line change 4949 end
5050
5151 end
52+
53+ describe "pipeline stats" do
54+ let ( :report_method ) { :pipeline }
55+ it "returns information on existing pipeline" do
56+ expect ( report . keys ) . to include ( :main )
57+ end
58+ context "for each pipeline" do
59+ it "returns information on pipeline" do
60+ expect ( report [ :main ] . keys ) . to include (
61+ :events ,
62+ :plugins ,
63+ :reloads ,
64+ :queue ,
65+ )
66+ end
67+ it "returns event information" do
68+ expect ( report [ :main ] [ :events ] . keys ) . to include (
69+ :in ,
70+ :filtered ,
71+ :duration_in_millis ,
72+ :out ,
73+ :queue_push_duration_in_millis
74+ )
75+ end
76+ end
77+ context "when using multiple pipelines" do
78+ before ( :each ) do
79+ expect ( LogStash ::Config ::PipelinesInfo ) . to receive ( :format_pipelines_info ) . and_return ( [
80+ { "id" => :main } ,
81+ { "id" => :secondary } ,
82+ ] )
83+ end
84+ it "contains metrics for all pipelines" do
85+ expect ( report . keys ) . to include ( :main , :secondary )
86+ end
87+ end
88+ end
5289end
Original file line number Diff line number Diff line change 2424 settings . set ( "config.reload.automatic" , false )
2525 @agent = make_test_agent ( settings )
2626 @agent . execute
27+ @pipelines_registry = LogStash ::PipelinesRegistry . new
2728 pipeline_config = mock_pipeline_config ( :main , "input { generator { id => '123' } } output { null {} }" )
2829 pipeline_creator = LogStash ::PipelineAction ::Create . new ( pipeline_config , @agent . metric )
29- @pipelines_registry = LogStash ::PipelinesRegistry . new
30+ expect ( pipeline_creator . execute ( @agent , @pipelines_registry ) ) . to be_truthy
31+ pipeline_config = mock_pipeline_config ( :secondary , "input { generator { id => '123' } } output { null {} }" )
32+ pipeline_creator = LogStash ::PipelineAction ::Create . new ( pipeline_config , @agent . metric )
3033 expect ( pipeline_creator . execute ( @agent , @pipelines_registry ) ) . to be_truthy
3134 end
3235
You can’t perform that action at this time.
0 commit comments