stackdriver 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64f9a913bf98b918d3daea27e0337e315eba8448
4
+ data.tar.gz: ef7d7d6180f27bd7a507f9f88fe465a0eb7cac08
5
+ SHA512:
6
+ metadata.gz: 781dba994021268baccfc4c7e35ad7399fd645daa54166d28e3b621d465bc9a174e120ab867c6d8092269cc1c38764a44d79d3a77c817c6c1108fb120ce6ac3e
7
+ data.tar.gz: 2d8de416d88daa7808d3c29c7b0315626afcf077f8b98b0406654235e2f18a5cfba392d16748bc7911b67b442cbc930f19d301048a1f4a4aafe5caa865aeab8a
checksums.yaml.gz.asc ADDED
@@ -0,0 +1,12 @@
1
+ -----BEGIN PGP SIGNATURE-----
2
+ Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
3
+ Comment: GPGTools - http://gpgtools.org
4
+
5
+ iQEcBAABCgAGBQJRh9ymAAoJELb2/9DjtYBvzUIH+wYM7V+TNbr30vbI6sIly32I
6
+ PyshSw4y7xfNyN4r/m/j288PPmha+w+iVKT/k/oYU7BouiGTYiMdSLzVnVm9MJDl
7
+ r50ejUVpxk4EZ7Pz4mj4t3D2OeDA0Wd1yz71Gl6Yeap+BSjSjTb2GbnlkSbGw95r
8
+ KVUIOEdsb1MwbJB+kIF2s2wW/lDvlP4s+g8BcuasPZjvtyLCJTf899mAsuXL/bGU
9
+ JFzAgsjv0G6jsz1iE70VoNSgqTIJMGyXZuFzb64lbVhLefgbODnqg68GAbUOf1ru
10
+ t+bYIy4SqstrMV3YwLD/YEmhDUO2tSGEI3fBxwaX7+Ly8QKNg2RNbFu/G1zqwZQ=
11
+ =NrTb
12
+ -----END PGP SIGNATURE-----
data.tar.gz.asc ADDED
@@ -0,0 +1,12 @@
1
+ -----BEGIN PGP SIGNATURE-----
2
+ Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
3
+ Comment: GPGTools - http://gpgtools.org
4
+
5
+ iQEcBAABCgAGBQJRh9ymAAoJELb2/9DjtYBv+RYIAM+7rck5EWvZpWTb/xTqtqFu
6
+ 0UdB08sbdo4+PGAbWzDo0ZKKWU5xZ3oYXnBZft2dXtWW1NzapeA4RHXjxo5pnWUC
7
+ FxVY4vuJNY0nBb+Aq2IiFIPe+Czcm1xbCHZMXqyO3d+U4Kfy+12BtVXlVHuxm1tF
8
+ vV/X+VCzqjWZAbtQSIykYdTu3PeXNfht75FqygTMf0yYwzxKumfDNQ3bg7y4G+UY
9
+ npTonhvYfxc46VxWizlkY0fKZMq0Hh2N6HM0yCs85XAe6YUdQ622c7smTn+dk4QH
10
+ C5mFXBntEngwAMM6KpINe3KZAYOyWiKvV0N9uRYU344YSQNClX/hz8hG4Uq1/qE=
11
+ =jbwj
12
+ -----END PGP SIGNATURE-----
@@ -0,0 +1,37 @@
1
+ require 'multi_json'
2
+
3
+ module StackDriver
4
+ POST_URI = "https://custom-gateway.stackdriver.com/v1/custom"
5
+
6
+ def self.init customer_id, api_key
7
+ @customer_id = customer_id
8
+ @api_key = api_key
9
+ end
10
+
11
+ def self.send_metric name, value, time
12
+ msg = build_message name, value, time
13
+ post MultiJson.dump(msg)
14
+ end
15
+
16
+ private
17
+
18
+ def self.post msg
19
+ headers = {'content-type' => 'application/json',
20
+ 'x-stackdriver-apikey' => @api_key}
21
+
22
+ uri = URI(StackDriver::POST_URI)
23
+ http = Net::HTTP.new(uri.host, uri.port)
24
+ http.use_ssl = true
25
+
26
+ http.start do |http|
27
+ http.post(uri.path, msg.to_json, headers)
28
+ end
29
+ end
30
+
31
+ def self.build_message name, value, time
32
+ data_point = {'name' => name, 'value' => value, 'collected_at' => time}
33
+
34
+ {'timestamp' => Time.now.to_i, 'customer_id' => @customer_id,
35
+ 'proto_version' => '1', 'data' => data_point}
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stackdriver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Grant T. Olson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.0
27
+ description: Send StackDriver custom metrics via the API.
28
+ email:
29
+ - kgo@grant-olson.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ./lib/stackdriver.rb
35
+ homepage: https://github.com/grant-olson/stackdriver-ruby
36
+ licenses: []
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.0.3
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Send StackDriver custom metrics
58
+ test_files: []
metadata.gz.asc ADDED
@@ -0,0 +1,12 @@
1
+ -----BEGIN PGP SIGNATURE-----
2
+ Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
3
+ Comment: GPGTools - http://gpgtools.org
4
+
5
+ iQEcBAABCgAGBQJRh9ymAAoJELb2/9DjtYBv3AMIAOKl6errLhmx5vkeHFgjEVYT
6
+ 5OQl1ndbnlmYQ4qigmbfTlRk5zF/NYYMQXx50p9IKpZM5LaKaRW7taOccYYZ9lQn
7
+ E9NB2rNNMm6Ol+qF6L4TM+j6gQSUDMiCBEJH0TeVN33NRVv7lpVTF/jpKt+bR5Uy
8
+ fXGXA76zgyUKjqgGUFdEn/AIcB4H3nBsHI+lKZULUHJMnZhnp2awF/JmeLcqOH/s
9
+ 6WIEEPR3zDJEWW5FrRB376eyRtar8A0Z1TEuuCL9YC21bnP/l7Agx/RX+PjIXW+T
10
+ /lJ+7qHPrhRxQdxVFVOJAKY9WxI97aiWUnFEwSl6JuIctf38fvvT/yXcQaAvG00=
11
+ =ksyO
12
+ -----END PGP SIGNATURE-----