multimeter 1.0.0.pre2-java → 1.0.0.pre3-java

Sign up to get free protection for your applications and to get access to all the features.
data/lib/multimeter.rb CHANGED
@@ -9,14 +9,15 @@ require 'json'
9
9
 
10
10
  module Yammer
11
11
  module Metrics
12
- import 'com.yammer.metrics.core.MetricsRegistry'
13
- import 'com.yammer.metrics.core.MetricName'
14
- import 'com.yammer.metrics.core.Meter'
15
- import 'com.yammer.metrics.core.Counter'
16
- import 'com.yammer.metrics.core.Histogram'
17
- import 'com.yammer.metrics.core.Gauge'
18
- import 'com.yammer.metrics.core.Timer'
19
- import 'com.yammer.metrics.reporting.JmxReporter'
12
+ java_import 'com.yammer.metrics.core.MetricsRegistry'
13
+ java_import 'com.yammer.metrics.core.MetricName'
14
+ java_import 'com.yammer.metrics.core.Meter'
15
+ java_import 'com.yammer.metrics.core.Counter'
16
+ java_import 'com.yammer.metrics.core.Histogram'
17
+ java_import 'com.yammer.metrics.core.Gauge'
18
+ java_import 'com.yammer.metrics.core.Timer'
19
+ java_import 'com.yammer.metrics.stats.Snapshot'
20
+ java_import 'com.yammer.metrics.reporting.JmxReporter'
20
21
 
21
22
  class Meter
22
23
  def type
@@ -63,7 +64,7 @@ module Yammer
63
64
  :mean => mean,
64
65
  :std_dev => std_dev,
65
66
  :sum => sum
66
- }
67
+ }.merge(snapshot.to_h)
67
68
  end
68
69
  end
69
70
 
@@ -99,7 +100,7 @@ module Yammer
99
100
  :mean => mean,
100
101
  :std_dev => std_dev,
101
102
  :sum => sum
102
- }
103
+ }.merge(snapshot.to_h)
103
104
  end
104
105
 
105
106
  def measure
@@ -111,14 +112,29 @@ module Yammer
111
112
  end
112
113
  end
113
114
  end
115
+
116
+ class Snapshot
117
+ def to_h
118
+ {
119
+ :median => median,
120
+ :percentiles => {
121
+ '75' => get75thPercentile,
122
+ '95' => get95thPercentile,
123
+ '98' => get98thPercentile,
124
+ '99' => get99thPercentile,
125
+ '99.9' => get999thPercentile
126
+ }
127
+ }
128
+ end
129
+ end
114
130
  end
115
131
  end
116
132
 
117
133
  module JavaConcurrency
118
- import 'java.util.concurrent.TimeUnit'
119
- import 'java.util.concurrent.ConcurrentHashMap'
120
- import 'java.util.concurrent.atomic.AtomicReference'
121
- import 'java.lang.Thread'
134
+ java_import 'java.util.concurrent.TimeUnit'
135
+ java_import 'java.util.concurrent.ConcurrentHashMap'
136
+ java_import 'java.util.concurrent.atomic.AtomicReference'
137
+ java_import 'java.lang.Thread'
122
138
  end
123
139
 
124
140
  module Multimeter
@@ -326,7 +342,7 @@ module Multimeter
326
342
  body = registry.to_h.to_json
327
343
  headers = JSON_HEADERS
328
344
  if (callback_name = env['QUERY_STRING'][/callback=([^$&]+)/, 1])
329
- if callback_name =~ /^[\w\d]+$/
345
+ if callback_name =~ /^[\w\d.]+$/
330
346
  body = "#{callback_name}(#{body});"
331
347
  headers = JSONP_HEADERS
332
348
  else
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Multimeter
4
- VERSION = '1.0.0.pre2'
4
+ VERSION = '1.0.0.pre3'
5
5
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: multimeter
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.0.0.pre2
5
+ version: 1.0.0.pre3
6
6
  platform: java
7
7
  authors:
8
8
  - Theo Hultberg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000Z
12
+ date: 2012-07-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: metrics-core-jars