statful-client 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +17 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5584d17bad505e388a9a32cbcb2adb3acceacdb0
|
4
|
+
data.tar.gz: 0ae8df0d1bcdb2bc44ff20b76bd5a67584f69c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7f4b7ae1fa3e5198465458908ed204e1c74dae903da4e0450c022c81700215edf73a289dad16772dd6710c89165c21aa5cd0310d9d68f9ab2929f2c552faa0
|
7
|
+
data.tar.gz: 409d9d331ad2cfe686db336a882905cd5d6dd013c54fb77022407a30d6160599da29b6a3758823d5f5877840f5011c05567e664caaa57c4100d246f8d6925c30
|
data/lib/client.rb
CHANGED
@@ -153,17 +153,23 @@ class StatfulClient
|
|
153
153
|
# @private
|
154
154
|
# @param metric [String] Name of the metric, ex: `response_time`
|
155
155
|
# @param value [Numeric] Value of the metric
|
156
|
-
# @param
|
157
|
-
# @param
|
158
|
-
# @param
|
159
|
-
# @param
|
160
|
-
# @param
|
161
|
-
# @param
|
162
|
-
|
163
|
-
|
164
|
-
|
156
|
+
# @param [Hash] options The options to apply to the metric
|
157
|
+
# @param options tags [Hash] Tags to associate to the metric
|
158
|
+
# @param options agg [Array<String>] List of aggregations to be applied by Statful
|
159
|
+
# @param options agg_freq [Integer] Aggregation frequency in seconds
|
160
|
+
# @param options sample_rate [Integer] Sampling rate, between: (1-100)
|
161
|
+
# @param options namespace [String] Namespace of the metric
|
162
|
+
# @param options timestamp [Integer] Timestamp of the metric
|
163
|
+
def put(metric, value, options = {})
|
164
|
+
tags = @config[:tags]
|
165
|
+
tags = tags.merge(options[:tags]) unless options[:tags].nil?
|
166
|
+
|
167
|
+
agg = options[:agg].nil? ? [] : options[:agg]
|
168
|
+
|
169
|
+
sample_rate = options[:sample_rate].nil? ? 100 : options[:sample_rate]
|
170
|
+
namespace = options[:namespace].nil? ? 'application' : options[:namespace]
|
165
171
|
|
166
|
-
_put(metric,
|
172
|
+
_put(metric, tags, value, agg, options[:agg_freq], sample_rate, namespace, options[:timestamp])
|
167
173
|
end
|
168
174
|
|
169
175
|
private
|
@@ -182,7 +188,7 @@ class StatfulClient
|
|
182
188
|
# @param sample_rate [Integer] Sampling rate, between: (1-100)
|
183
189
|
# @param namespace [String] Namespace of the metric
|
184
190
|
# @param timestamp [Integer] Timestamp of the metric
|
185
|
-
def _put(metric, tags, value, agg = [], agg_freq = 10, sample_rate =
|
191
|
+
def _put(metric, tags, value, agg = [], agg_freq = 10, sample_rate = 100, namespace = 'application', timestamp = nil)
|
186
192
|
metric_name = "#{namespace}.#{metric}"
|
187
193
|
sample_rate_normalized = sample_rate / 100
|
188
194
|
timestamp = Time.now.to_i if timestamp.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statful-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Fonseca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|