x_runtime 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +5 -0
- data/VERSION +1 -1
- data/lib/x_runtime/utils.rb +2 -1
- data/x_runtime.gemspec +2 -2
- metadata +3 -3
data/README.markdown
CHANGED
@@ -125,6 +125,11 @@ log_format timing '$remote_addr - $remote_user [$time_local] "$status" $request
|
|
125
125
|
|
126
126
|
最主要的是这个`probe $upstream_http_xx_runtime`
|
127
127
|
|
128
|
+
#### Rails
|
129
|
+
|
130
|
+
在Rails中使用探针的时候,可以统计从请求开始处理时到当前探针点之间,所有ActiveRecord(数据层)消耗的时间,用来排查mysql等db性能有所帮助。
|
131
|
+
__注意__一定要写在render之前,因为render调用会触发cleanup_view_runtime,导致ActiveRecord计数器被清空。
|
132
|
+
|
128
133
|
### Test
|
129
134
|
|
130
135
|
请先修改test/server.rb和test/client.rb中的Redis参数,我的地址是localhost:6380,这个请改为你的地址。
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/x_runtime/utils.rb
CHANGED
@@ -32,7 +32,8 @@ module XRuntime
|
|
32
32
|
|
33
33
|
if headers[PROBELATESTFLAG]
|
34
34
|
last_probe = headers[PROBELATESTFLAG].to_f
|
35
|
-
headers[PROBEFLAG] += ",#{"
|
35
|
+
headers[PROBEFLAG] += ",#{"%.03f"%((Time.now.to_f - last_probe)*1000)}ms"
|
36
|
+
headers[PROBEFLAG] += " AR:#{"%.03f"%ActiveRecord::LogSubscriber.runtime}ms" if (defined? ActiveRecord::LogSubscriber)
|
36
37
|
end
|
37
38
|
|
38
39
|
headers[PROBELATESTFLAG] = Time.now.to_f.to_s
|
data/x_runtime.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "x_runtime"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["\u{5d14}\u{5ce5}"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-09-01"
|
13
13
|
s.description = "\u{7531}\u{4e8e}\u{4f7f}\u{7528}\u{5230}Redis\u{7684}lua script,\u{6240}\u{4ee5}\u{9700}\u{8981}\u{4f60}\u{7684}Redis\u{670d}\u{52a1}\u{652f}\u{6301},redis-server\u{7248}\u{672c}>2.6.x,redis(ruby gem)>3.0.1."
|
14
14
|
s.email = "zheng.cuizh@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: x_runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
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: 2012-
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
segments:
|
153
153
|
- 0
|
154
|
-
hash:
|
154
|
+
hash: 574912010590255651
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
none: false
|
157
157
|
requirements:
|