jruby-rack-metrics 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/jruby-rack-metrics.rb +7 -7
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/jruby-rack-metrics.rb
CHANGED
@@ -17,8 +17,7 @@ module JrubyRackMetrics
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_options
|
20
|
-
{ :
|
21
|
-
:default_duration_unit => java.util.concurrent.TimeUnit::MILLISECONDS,
|
20
|
+
{ :default_duration_unit => java.util.concurrent.TimeUnit::MILLISECONDS,
|
22
21
|
:default_rate_unit => java.util.concurrent.TimeUnit::SECONDS,
|
23
22
|
:jmx_enabled => false }
|
24
23
|
end
|
@@ -33,19 +32,20 @@ module JrubyRackMetrics
|
|
33
32
|
else
|
34
33
|
start_time = java.lang.System.nanoTime()
|
35
34
|
begin
|
36
|
-
@app.call(env)
|
35
|
+
status, headers, body = @app.call(env)
|
37
36
|
ensure
|
38
37
|
elapsed = java.lang.System.nanoTime() - start_time
|
39
38
|
# some web servers give us the full url, some only the path part
|
40
39
|
uri = URI.parse(env['REQUEST_URI'])
|
41
40
|
if defined? uri.path && !uri.path.nil?
|
42
|
-
group = @options[:app_name]
|
43
41
|
if uri.path == "/"
|
44
|
-
|
42
|
+
group = "_root"
|
45
43
|
else
|
46
|
-
|
44
|
+
group = uri.path.gsub(/[\/|\s|,|;|#|!|:]/, "_")
|
45
|
+
group = group[1..-1] if group.start_with?("_")
|
47
46
|
end
|
48
|
-
|
47
|
+
type = env['REQUEST_METHOD'].downcase
|
48
|
+
name = (status || 500).to_s
|
49
49
|
metric_name = com.yammer.metrics.core.MetricName.new(group, type, name)
|
50
50
|
metrics_registry.newTimer(metric_name,
|
51
51
|
@options[:default_duration_unit],
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jruby-rack-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Dudziak
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-13 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|