rubycut-metriks 0.9.9.10 → 0.9.9.11
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.
- data/lib/metriks/reporter/cassandra.rb +16 -5
- data/metriks.gemspec +2 -2
- metadata +2 -2
@@ -20,9 +20,11 @@ module Metriks::Reporter
|
|
20
20
|
|
21
21
|
end
|
22
22
|
def open_connection
|
23
|
-
@connection = Cql::Client.connect(host: @host
|
23
|
+
@connection = Cql::Client.connect(host: @host)
|
24
24
|
@connection.use(@database)
|
25
|
-
|
25
|
+
|
26
|
+
@write_statement = @connection.prepare("INSERT INTO #{@table}(server,metric, time, v) VALUES
|
27
|
+
(?, ?, ?, ?) USING TTL 1209600") # two weeks
|
26
28
|
end
|
27
29
|
def connection
|
28
30
|
@connection
|
@@ -96,6 +98,7 @@ module Metriks::Reporter
|
|
96
98
|
]
|
97
99
|
end
|
98
100
|
end
|
101
|
+
sleep 2
|
99
102
|
close_connection
|
100
103
|
|
101
104
|
end
|
@@ -104,10 +107,18 @@ module Metriks::Reporter
|
|
104
107
|
end
|
105
108
|
def send_metric(compound_name, metric, keys, snapshot_keys = [])
|
106
109
|
keys.each do |key|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
+
execute_prepared_statement [@source,compound_name,"#{Time.now.to_i}",metric.send(key)]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
def execute_prepared_statement array
|
114
|
+
future = write_statement.async.execute(*array)
|
115
|
+
future.on_failure do |error|
|
116
|
+
raise error
|
110
117
|
end
|
111
118
|
end
|
119
|
+
def write_statement
|
120
|
+
@write_statement
|
121
|
+
end
|
122
|
+
|
112
123
|
end
|
113
124
|
end
|
data/metriks.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'rubycut-metriks'
|
16
|
-
s.version = '0.9.9.
|
17
|
-
s.date = '
|
16
|
+
s.version = '0.9.9.11'
|
17
|
+
s.date = '2014-01-03'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubycut-metriks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.9.
|
4
|
+
version: 0.9.9.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: atomic
|