knotice-ruby-statsd 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/kstatsd.rb +35 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTgxZWE3OTg0OTQ1MDFiNjQyMDM1ZjQ3MDk1YjUxMjMxMGFiZWMxNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTkxMmNlN2IyZTJjYjJmNjBmYmQxNzBhOTlhMjJiOTkyNzliZTIxNw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjdhMWE0NWYxYTA4MGM5ZGM3ODI1ZThiZjA3OWM4MTdkNzg4NGE4M2E3OWUz
|
10
|
+
NzNjNDczNDRhZDIwYjcyNDk1NjBiZjA4ZDA2MGZmOGQyODYxY2YxNjhkZmQ1
|
11
|
+
Mjk5ZTZkMTg3YjZhN2Q4M2RiYjViMDM4ODk2MDBlZTdhYTgzNGY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MDUxNTk5ZTcxZjE4ZGNjY2FiYmJjYjcwZjFiNTVkZTFkNzQxZWYxM2UzODJi
|
14
|
+
MjgwZmFjNzk5OTUwMWQyM2Y3YTIzYjcyMDE2NmIyMDgxMDdkOTg0NWJiNzFm
|
15
|
+
ZjUyYTZjYmFlZjY5MTgxNTQzY2E0Nzk2OWE2NGQyMjhjN2Q1ZmM=
|
data/lib/kstatsd.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'statsd'
|
2
|
+
|
3
|
+
class Kstatsd
|
4
|
+
|
5
|
+
def initialize(serverhost,serverport)
|
6
|
+
if($statsd == nil)
|
7
|
+
$statsd = Statsd.new serverhost,serverport
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def increment(bucket)
|
12
|
+
$statsd.increment bucket
|
13
|
+
end
|
14
|
+
|
15
|
+
def timing(bucket,ms)
|
16
|
+
$statsd.timing bucket,ms
|
17
|
+
end
|
18
|
+
|
19
|
+
def gauge (bucket, ms)
|
20
|
+
$statsd.gauge bucket, ms
|
21
|
+
end
|
22
|
+
|
23
|
+
def timeEnd(bucket,startTime)
|
24
|
+
$statsd.timing bucket, time_diff_milli(startTime)
|
25
|
+
end
|
26
|
+
|
27
|
+
def time_diff_milli(start)
|
28
|
+
|
29
|
+
finish = Time.now
|
30
|
+
puts 'start' + start.to_s
|
31
|
+
puts 'finish' + finish.to_s
|
32
|
+
return (((finish - start)* 1000.0).to_i).to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: knotice-ruby-statsd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Darshan Pradhan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ! 'knotice statsD client on top of statsd-ruby '
|
14
|
+
email: dpradhan@knotice.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/kstatsd.rb
|
20
|
+
homepage: http://www.knotice.com
|
21
|
+
licenses:
|
22
|
+
- ''
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.1.4
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: statsD client
|
44
|
+
test_files: []
|