Skip to content

Commit ebd0814

Browse files
andseldonoghuc
andauthored
Better wording for code comment
Co-authored-by: Cas Donoghue <[email protected]>
1 parent aa029b9 commit ebd0814

File tree

1 file changed

+2
-1
lines changed
  • logstash-core/lib/logstash/api/commands

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ def refine_batch_metrics(stats)
176176
# current is a tuple of [event_count, byte_size] store the reference locally to avoid repeatedly
177177
# reading and retrieve unrelated values
178178
current_data_point = stats[:batch][:current]
179-
# average return a FlowMetric which and we need to invoke getValue to obtain the map with metric details.
179+
# FlowMetric (from stats[:batch][:event_count][:average]) returns a composite object containing lifetime/last_1_minute/etc values. In order to get the map of sub-metrics we must use `.value`.
180+
# See: https://github.com/elastic/logstash/blob/279171b79c1f3be5fc85e6e2e4092281e504a6f9/logstash-core/src/main/java/org/logstash/instrument/metrics/ExtendedFlowMetric.java#L89
180181
event_count_average_flow_metric = stats[:batch][:event_count][:average].value
181182
event_count_average_lifetime = event_count_average_flow_metric["lifetime"] ? event_count_average_flow_metric["lifetime"].round : 0
182183
byte_size_average_flow_metric = stats[:batch][:byte_size][:average].value

0 commit comments

Comments
 (0)