fluent-plugin-metricsense 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -93,9 +93,11 @@ module Fluent::MetricSenseOutput::Backends
93
93
  }
94
94
  }.to_json
95
95
 
96
- METRIC_INITIALIZE_REQUEST_PER_MODE[UpdateMode::LATEST] = {
96
+ METRIC_INITIALIZE_REQUEST_PER_MODE[UpdateMode::MAX] = {
97
97
  "type" => "gauge",
98
98
  "attributes" => {
99
+ "source_aggregate" => false,
100
+ "summarize_function" => "max",
99
101
  }
100
102
  }.to_json
101
103
 
@@ -29,7 +29,7 @@ module Fluent
29
29
 
30
30
  module UpdateMode
31
31
  ADD = 0
32
- LATEST = 1
32
+ MAX = 1
33
33
  end
34
34
 
35
35
  class Backend
@@ -129,8 +129,8 @@ module Fluent
129
129
  # get update_mode key
130
130
  update_mode = record.delete(@update_mode_key)
131
131
  case update_mode
132
- when "latest"
133
- update_mode = UpdateMode::LATEST
132
+ when "max"
133
+ update_mode = UpdateMode::MAX
134
134
  else
135
135
  # default is add
136
136
  update_mode = UpdateMode::ADD
@@ -178,18 +178,21 @@ module Fluent
178
178
  end
179
179
  end
180
180
 
181
- class LatestUpdater
181
+ class MaxUpdater
182
182
  def initialize
183
183
  @value = 0
184
184
  end
185
185
  attr_reader :value
186
186
 
187
187
  def add(value)
188
- @value += value
188
+ if @value < value
189
+ @value = value
190
+ end
191
+ @value
189
192
  end
190
193
 
191
194
  def mode
192
- UpdateMode::LATEST
195
+ UpdateMode::MAX
193
196
  end
194
197
  end
195
198
 
@@ -205,8 +208,8 @@ module Fluent
205
208
  case update_mode
206
209
  when UpdateMode::ADD
207
210
  updater = AddUpdater
208
- when UpdateMode::LATEST
209
- updater = LatestUpdater
211
+ when UpdateMode::MAX
212
+ updater = MaxUpdater
210
213
  else # default is AddUpdater
211
214
  updater = AddUpdater
212
215
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-metricsense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: