Class: LogStash::Outputs::SumoLogic::Statistics
- Inherits:
-
Object
- Object
- LogStash::Outputs::SumoLogic::Statistics
- Includes:
- Common
- Defined in:
- lib/logstash/outputs/sumologic/statistics.rb
Constant Summary
Constants included from Common
Common::CARBON2, Common::DEFAULT_LOG_FORMAT, Common::DEFLATE, Common::GRAPHITE, Common::GZIP, Common::LOG_TO_CONSOLE, Common::METRICS_NAME_PLACEHOLDER, Common::STATS_TAG
Instance Attribute Summary collapse
-
#current_pile_bytes ⇒ Object
readonly
Returns the value of attribute current_pile_bytes.
-
#current_pile_items ⇒ Object
readonly
Returns the value of attribute current_pile_items.
-
#current_queue_bytes ⇒ Object
readonly
Returns the value of attribute current_queue_bytes.
-
#current_queue_items ⇒ Object
readonly
Returns the value of attribute current_queue_items.
-
#initialize_time ⇒ Object
readonly
Returns the value of attribute initialize_time.
-
#total_deque_bytes ⇒ Object
readonly
Returns the value of attribute total_deque_bytes.
-
#total_deque_times ⇒ Object
readonly
Returns the value of attribute total_deque_times.
-
#total_enque_bytes ⇒ Object
readonly
Returns the value of attribute total_enque_bytes.
-
#total_enque_times ⇒ Object
readonly
Returns the value of attribute total_enque_times.
-
#total_input_bytes ⇒ Object
readonly
Returns the value of attribute total_input_bytes.
-
#total_input_events ⇒ Object
readonly
Returns the value of attribute total_input_events.
-
#total_log_lines ⇒ Object
readonly
Returns the value of attribute total_log_lines.
-
#total_metrics_datapoints ⇒ Object
readonly
Returns the value of attribute total_metrics_datapoints.
-
#total_output_bytes ⇒ Object
readonly
Returns the value of attribute total_output_bytes.
-
#total_output_bytes_compressed ⇒ Object
readonly
Returns the value of attribute total_output_bytes_compressed.
-
#total_output_requests ⇒ Object
readonly
Returns the value of attribute total_output_requests.
-
#total_response(key) ⇒ Object
readonly
def initialize.
-
#total_response_success ⇒ Object
readonly
Returns the value of attribute total_response_success.
-
#total_response_times ⇒ Object
readonly
Returns the value of attribute total_response_times.
Instance Method Summary collapse
-
#atomic_map_increase(map, key) ⇒ Object
def record_response_failure.
-
#initialize ⇒ Statistics
constructor
A new instance of Statistics.
-
#record_clear_pile ⇒ Object
def record_metrics_process.
-
#record_deque(payload) ⇒ Object
def record_enque.
-
#record_enque(payload) ⇒ Object
def record_pile_clear.
-
#record_input(entry) ⇒ Object
def record_multi_input.
-
#record_log_process ⇒ Object
def record_input.
-
#record_metrics_process(dps) ⇒ Object
def record_log_process.
- #record_multi_input(events, bytesize) ⇒ Object
-
#record_request(size, size_compressed) ⇒ Object
def record_deque.
-
#record_response_failure ⇒ Object
def record_response_success.
-
#record_response_success(code) ⇒ Object
def record_request.
Methods included from Common
#log_dbg, #log_err, #log_info, #log_warn, #set_logger
Constructor Details
#initialize ⇒ Statistics
Returns a new instance of Statistics.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 29 def initialize() @initialize_time = Time.now() @total_input_events = Concurrent::AtomicFixnum.new @total_input_bytes = Concurrent::AtomicFixnum.new @total_metrics_datapoints = Concurrent::AtomicFixnum.new @total_log_lines = Concurrent::AtomicFixnum.new @current_pile_items = Concurrent::AtomicFixnum.new @current_pile_bytes = Concurrent::AtomicFixnum.new @total_enque_times = Concurrent::AtomicFixnum.new @total_enque_bytes = Concurrent::AtomicFixnum.new @total_deque_times = Concurrent::AtomicFixnum.new @total_deque_bytes = Concurrent::AtomicFixnum.new @current_queue_items = Concurrent::AtomicFixnum.new @current_queue_bytes = Concurrent::AtomicFixnum.new @total_output_requests = Concurrent::AtomicFixnum.new @total_output_bytes = Concurrent::AtomicFixnum.new @total_output_bytes_compressed = Concurrent::AtomicFixnum.new @total_response = Concurrent::Map.new @total_response_times = Concurrent::AtomicFixnum.new @total_response_success = Concurrent::AtomicFixnum.new end |
Instance Attribute Details
#current_pile_bytes ⇒ Object (readonly)
Returns the value of attribute current_pile_bytes.
15 16 17 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 15 def current_pile_bytes @current_pile_bytes end |
#current_pile_items ⇒ Object (readonly)
Returns the value of attribute current_pile_items.
14 15 16 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 14 def current_pile_items @current_pile_items end |
#current_queue_bytes ⇒ Object (readonly)
Returns the value of attribute current_queue_bytes.
21 22 23 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 21 def current_queue_bytes @current_queue_bytes end |
#current_queue_items ⇒ Object (readonly)
Returns the value of attribute current_queue_items.
20 21 22 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 20 def current_queue_items @current_queue_items end |
#initialize_time ⇒ Object (readonly)
Returns the value of attribute initialize_time.
9 10 11 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 9 def initialize_time @initialize_time end |
#total_deque_bytes ⇒ Object (readonly)
Returns the value of attribute total_deque_bytes.
19 20 21 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 19 def total_deque_bytes @total_deque_bytes end |
#total_deque_times ⇒ Object (readonly)
Returns the value of attribute total_deque_times.
18 19 20 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 18 def total_deque_times @total_deque_times end |
#total_enque_bytes ⇒ Object (readonly)
Returns the value of attribute total_enque_bytes.
17 18 19 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 17 def total_enque_bytes @total_enque_bytes end |
#total_enque_times ⇒ Object (readonly)
Returns the value of attribute total_enque_times.
16 17 18 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 16 def total_enque_times @total_enque_times end |
#total_input_bytes ⇒ Object (readonly)
Returns the value of attribute total_input_bytes.
11 12 13 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 11 def total_input_bytes @total_input_bytes end |
#total_input_events ⇒ Object (readonly)
Returns the value of attribute total_input_events.
10 11 12 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 10 def total_input_events @total_input_events end |
#total_log_lines ⇒ Object (readonly)
Returns the value of attribute total_log_lines.
13 14 15 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 13 def total_log_lines @total_log_lines end |
#total_metrics_datapoints ⇒ Object (readonly)
Returns the value of attribute total_metrics_datapoints.
12 13 14 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 12 def total_metrics_datapoints @total_metrics_datapoints end |
#total_output_bytes ⇒ Object (readonly)
Returns the value of attribute total_output_bytes.
23 24 25 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 23 def total_output_bytes @total_output_bytes end |
#total_output_bytes_compressed ⇒ Object (readonly)
Returns the value of attribute total_output_bytes_compressed.
24 25 26 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 24 def total_output_bytes_compressed @total_output_bytes_compressed end |
#total_output_requests ⇒ Object (readonly)
Returns the value of attribute total_output_requests.
22 23 24 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 22 def total_output_requests @total_output_requests end |
#total_response(key) ⇒ Object (readonly)
def initialize
52 53 54 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 52 def total_response @total_response end |
#total_response_success ⇒ Object (readonly)
Returns the value of attribute total_response_success.
27 28 29 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 27 def total_response_success @total_response_success end |
#total_response_times ⇒ Object (readonly)
Returns the value of attribute total_response_times.
26 27 28 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 26 def total_response_times @total_response_times end |
Instance Method Details
#atomic_map_increase(map, key) ⇒ Object
def record_response_failure
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 111 def atomic_map_increase(map, key) number = map.get(key) if number.nil? newNumber = Concurrent::AtomicFixnum.new number = map.put_if_absent(key, newNumber) if number.nil? number = newNumber end end number.increment() end |
#record_clear_pile ⇒ Object
def record_metrics_process
76 77 78 79 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 76 def record_clear_pile() @current_pile_items.value= 0 @current_pile_bytes.value= 0 end |
#record_deque(payload) ⇒ Object
def record_enque
88 89 90 91 92 93 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 88 def record_deque(payload) @total_deque_times.increment() @total_deque_bytes.update { |v| v + payload.bytesize } @current_queue_items.decrement() @current_queue_bytes.update { |v| v - payload.bytesize } end |
#record_enque(payload) ⇒ Object
def record_pile_clear
81 82 83 84 85 86 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 81 def record_enque(payload) @total_enque_times.increment() @total_enque_bytes.update { |v| v + payload.bytesize } @current_queue_items.increment() @current_queue_bytes.update { |v| v + payload.bytesize } end |
#record_input(entry) ⇒ Object
def record_multi_input
61 62 63 64 65 66 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 61 def record_input(entry) @total_input_events.increment() @total_input_bytes.update { |v| v + entry.bytesize } @current_pile_items.increment() @current_pile_bytes.update { |v| v + entry.bytesize } end |
#record_log_process ⇒ Object
def record_input
68 69 70 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 68 def record_log_process() @total_log_lines.increment() end |
#record_metrics_process(dps) ⇒ Object
def record_log_process
72 73 74 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 72 def record_metrics_process(dps) @total_metrics_datapoints.update { |v| v + dps } end |
#record_multi_input(events, bytesize) ⇒ Object
56 57 58 59 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 56 def record_multi_input(events, bytesize) @total_input_events.update { |v| v + events } @total_input_bytes.update { |v| v + bytesize } end |
#record_request(size, size_compressed) ⇒ Object
def record_deque
95 96 97 98 99 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 95 def record_request(size, size_compressed) @total_output_requests.increment() @total_output_bytes.update { |v| v + size } @total_output_bytes_compressed.update { |v| v + size_compressed } end |
#record_response_failure ⇒ Object
def record_response_success
107 108 109 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 107 def record_response_failure() atomic_map_increase(@total_response, "failure") end |
#record_response_success(code) ⇒ Object
def record_request
101 102 103 104 105 |
# File 'lib/logstash/outputs/sumologic/statistics.rb', line 101 def record_response_success(code) atomic_map_increase(@total_response, code.to_s) @total_response_success.increment() if code == 200 @total_response_times.increment() end |