knotice-ruby-statsd 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/kstatsd.rb +19 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzQxZTQ0NmY5YjhmOWIyZGU3ZDVmNGIwZmJmYWQ5ZDNhYmQwYmFkNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2RlMGE3ZWU3YmJiODk4ZDRjNTg3MjEwNTQ1NDRlYmQ3YmI0NjhkMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjRhM2ZmNmRkZDY1NmRlYTg5Yjc2MzFkZjYzNjg5ZjBiZWMyMzUzOGQ2ZDA4
|
10
|
+
OTM5NjExZjQ5ZWExYmNlMDk0NjMzZjNjN2Q5ODhlNjExNjU3MzlmNTMxNmYx
|
11
|
+
NTdkNjEwYTBjNDcyZGQ5YTVjOGJkMmRlZTE0NzQ3ZTlmYTc2MWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGE4MGU4ODQzNmU0NjZmNTU0MGY2NmEzY2FmMWRlZGYwZjAyYTA4MWVjMDQ2
|
14
|
+
YzBhMTQ3MDQyMjk0ZGJkNTE0ZmFkYmRiN2Y2ZjQ3MzVkNzMyNWU4NDY2N2I3
|
15
|
+
NmFhNjI2Yzg5NjJmOGNiNWYxOTk0ZDVhNjYyZjU0YzFmZGQ4NGM=
|
data/lib/kstatsd.rb
CHANGED
@@ -8,28 +8,35 @@ class Kstatsd
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def increment(bucket)
|
12
|
-
$statsd.increment bucket
|
11
|
+
def increment(bucket, sr=1)
|
12
|
+
$statsd.increment bucket,sr
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
$statsd.
|
15
|
+
def decrement(bucket, sr=1)
|
16
|
+
$statsd.increment bucket,sr
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
$statsd.
|
19
|
+
def timing(bucket,ms, sr=1)
|
20
|
+
$statsd.timing bucket,ms,sr
|
21
|
+
end
|
22
|
+
|
23
|
+
def gauge (bucket, ms, sr=1)
|
24
|
+
$statsd.gauge bucket, ms,sr
|
21
25
|
end
|
22
26
|
|
23
|
-
def timeEnd(bucket,startTime)
|
24
|
-
$statsd.timing bucket, time_diff_milli(startTime)
|
27
|
+
def timeEnd(bucket,startTime, sr=1)
|
28
|
+
$statsd.timing bucket, time_diff_milli(startTime),sr
|
25
29
|
end
|
26
30
|
|
31
|
+
def time (bucket,sr=1)
|
32
|
+
$statsd.time(bucket,sr) { yield }
|
33
|
+
end
|
34
|
+
|
27
35
|
def time_diff_milli(start)
|
28
|
-
|
29
36
|
finish = Time.now
|
30
|
-
puts 'start' + start.to_s
|
31
|
-
puts 'finish' + finish.to_s
|
32
|
-
return ((
|
37
|
+
#puts 'start' + start.to_s
|
38
|
+
#puts 'finish' + finish.to_s
|
39
|
+
return ((finish - start)* 1000.0).round
|
33
40
|
end
|
34
41
|
|
35
42
|
end
|