ddstat 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTBlOWNmNTk5OGMxOTZiOGYxZDY4Y2UxNTQ5ZTcyMzljNzUyZGI4ZA==
4
+ YzZhMWQzOTM5OWViOTc5OWExYWRhMGNhZjQyY2IwZGM2MjhmNmMwMw==
5
5
  data.tar.gz: !binary |-
6
- NzdlNjBjOTY4NjI4Zjc2YzllMDE3OWQ5M2I3YjhkMzcyMGE2NTkwMQ==
6
+ N2ZjMTkzNzJiNDIyYzU2ODIwYjQ4ZTg2NTExNzU0YjFkZThlYTM4OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2JlMTI1Y2MzN2YzOTA3OGIxMmYzMTNlMDY4YWM1ODFmMWQxY2IxNjQyNGE5
10
- NGQ1NmQ3MDczYjhmMDRjODI3ZTJmNThkYTI3NzFmNjNjMjA5MWFkYWNkYjEz
11
- MWZlN2M2ZjA1YTdmNmU3YzNmZjRlZjg4Y2RiMjY2YTMzMmJmOTA=
9
+ YjViNjE0M2JmYzI3NmY4MWVmOGI3MWJkODQ0YmYzMGM1MzBhMmE5NmQzMzdi
10
+ NWM4NGQ2OTgzZWRjOWJiNjEyY2ZlYjc3YzFlZWE1YWM1ZmIxYjczOTg3OTBh
11
+ MjU1NDIzNDk2M2JiNTMwMDhlOGIyZDZiYjcyY2M4ODQzNGQxYzA=
12
12
  data.tar.gz: !binary |-
13
- ZDRmZDk3OWZmYjBiZGNjZjZiZTUxZGFlOWEwODhjOGY2NWFmOThiMTQ2OTgz
14
- NzU3MGQxYzBiMjVjYTNmNzRjOTc0ZWQwZWExZTMzOGIyMTk5MTEzODhlNTVk
15
- MmIyZDBhMGFhZjAxOWVkZDc2OGY3NjRlNTJhYjM5ZWNlYTM0YTY=
13
+ NDFjODhjZWY3NTZiNjYwNWMxOWNkZTQ0NDU2Y2MzZTI2Njk0ODBiN2VhZGUx
14
+ OWE2ODI3OGRkZjRhZmNhOTc4ZTBjOTZhODMxMGY5ZDRlMWU2YWRlNTgyNWRl
15
+ ZDRkM2Q4YzM5NWRmNDJmOTgwMzhmNTU1MDhiNzk4ODY2NDU5ZmM=
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'json'
21
+ spec.add_dependency 'dogapi'
22
22
  spec.add_development_dependency 'bundler', '~> 1.5'
23
23
  spec.add_development_dependency 'rake'
24
24
  end
@@ -4,11 +4,10 @@ module Ddstat
4
4
  end
5
5
  end
6
6
 
7
- require 'json'
8
- require 'net/http'
7
+ require 'dogapi'
9
8
  require 'pty'
10
- require 'time'
11
9
  require 'socket'
10
+ require 'time'
11
+ require 'thread'
12
12
  require 'ddstat/version'
13
13
  require 'ddstat/ddstat'
14
- require 'ddstat/ddclient'
@@ -6,7 +6,7 @@ class Ddstat::Ddstat
6
6
  api_key = ENV['DD_API_KEY']
7
7
  host = %x[hostname -f 2> /dev/null].strip
8
8
  host = Socket.gethostname if host.empty?
9
- @dog = Ddstat::Ddclient.new(api_key, host)
9
+ @dog = Dogapi::Client.new(api_key, nil, host)
10
10
  end
11
11
 
12
12
  def run
@@ -94,16 +94,15 @@ class Ddstat::Ddstat
94
94
  Time.now
95
95
  end
96
96
 
97
- metrics = {}
98
-
99
97
  field_values.each do |category, fields|
100
98
  fields.each do |name, value|
101
99
  metric_name = [PREFIX, category, name].join('.')
102
- metrics[metric_name] = value.to_f
100
+
101
+ Thread.start do
102
+ @dog.emit_point(metric_name, value.to_f)
103
+ end
103
104
  end
104
105
  end
105
-
106
- @dog.emit_series(date_time, metrics)
107
106
  rescue Timeout::Error
108
107
  # nothing to do
109
108
  end
@@ -1,3 +1,3 @@
1
1
  module Ddstat
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
14
+ name: dogapi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ! '>='