instrumental 0.1.5 → 0.1.6
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/VERSION +1 -1
- data/instrumental.gemspec +3 -2
- data/lib/instrumental/agent.rb +10 -9
- data/lib/instrumental.rb +4 -0
- data/lib/tasks/milestone.rake +8 -0
- data/spec/instrumental/instrument_methods_spec.rb +8 -0
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/instrumental.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{instrumental}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Douglas F Shearer"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-10}
|
13
13
|
s.description = %q{Rails instrumentation and client for imperialapp.com}
|
14
14
|
s.email = %q{support@imperialapp.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/instrumental/configuration.rb",
|
31
31
|
"lib/instrumental/intervalometer.rb",
|
32
32
|
"lib/tasks/install.rake",
|
33
|
+
"lib/tasks/milestone.rake",
|
33
34
|
"lib/tasks/templates/instrumental.rb.erb",
|
34
35
|
"spec/instrumental/agent_spec.rb",
|
35
36
|
"spec/instrumental/configuration_spec.rb",
|
data/lib/instrumental/agent.rb
CHANGED
@@ -25,6 +25,10 @@ module Instrumental
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def milestone(name = Time.now.utc.to_s)
|
29
|
+
post_response("#{ config.path }/milestone", { :name => name })
|
30
|
+
end
|
31
|
+
|
28
32
|
def setup_and_run
|
29
33
|
@intervalometer = Intervalometer.new(config.report_interval)
|
30
34
|
|
@@ -70,20 +74,14 @@ module Instrumental
|
|
70
74
|
|
71
75
|
def send_report(type, name, value)
|
72
76
|
if type == :measure
|
73
|
-
|
77
|
+
params = { :values => value }
|
74
78
|
else
|
75
|
-
|
79
|
+
params = { :value => value }
|
76
80
|
end
|
77
81
|
|
78
|
-
attributes[:name] = URI.escape("#{ config.name_prefix }#{ name }")
|
79
|
-
attributes[:api_key] = config.api_key
|
80
|
-
|
81
|
-
# attributes_string = attributes.to_a.map{ |a| a.join('=') }.join('&')
|
82
|
-
|
83
82
|
path = "#{ config.path }#{ type }"
|
84
|
-
# config.logger.debug("Calling #{ path }")
|
85
83
|
|
86
|
-
response = post_response(path,
|
84
|
+
response = post_response(path, params)
|
87
85
|
|
88
86
|
unless response.is_a?(Net::HTTPSuccess)
|
89
87
|
config.logger.error "[Instrumental] Unexpected response from server (#{ response.code }): #{ response.message }"
|
@@ -91,6 +89,9 @@ module Instrumental
|
|
91
89
|
end
|
92
90
|
|
93
91
|
def post_response(path, params)
|
92
|
+
params[:api_key] = config.api_key
|
93
|
+
params[:name] = URI.escape("#{ config.name_prefix }#{ params[:name] }")
|
94
|
+
|
94
95
|
req = Net::HTTP::Post.new(path)
|
95
96
|
req.set_form_data(params)
|
96
97
|
Net::HTTP.new(config.host, config.port).start { |h| h.request(req) }
|
data/lib/instrumental.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrumental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Douglas F Shearer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/instrumental/configuration.rb
|
84
84
|
- lib/instrumental/intervalometer.rb
|
85
85
|
- lib/tasks/install.rake
|
86
|
+
- lib/tasks/milestone.rake
|
86
87
|
- lib/tasks/templates/instrumental.rb.erb
|
87
88
|
- spec/instrumental/agent_spec.rb
|
88
89
|
- spec/instrumental/configuration_spec.rb
|