Ticket #10651: gltailpatch

File gltailpatch, 3.7 KB (added by Sean Legassick, 15 years ago)
Line 
1diff -ru gl_tail_orig/element.rb gl_tail/element.rb
2--- gl_tail_orig/element.rb 2007-11-14 21:08:04.000000000 +0000
3+++ gl_tail/element.rb 2007-11-14 21:17:06.000000000 +0000
4@@ -95,6 +95,10 @@
5 @size = 0.01
6 end
7
8+ if not defined? @name || @name.nil?
9+ return
10+ end
11+
12 @wx = @block.is_right ? (@block.alignment - (@block.width+8)*8.0 / (engine.screen.window_width / 2.0)) : @block.alignment
13
14 if(@y == -@block.top)
15@@ -144,14 +148,16 @@
16 raise "unknown block type #{self.inspect}"
17 end
18
19- if @x < 0
20- str = sprintf("%#{@block.width}s %s", @name.length > @block.width ? @name[-@block.width..-1] : @name, txt)
21- else
22- str = sprintf("%s %s", txt, @name[0..@block.width-1])
23+ unless @name.nil?
24+ if @x < 0
25+ str = sprintf("%#{@block.width}s %s", @name.length > @block.width ? @name[-@block.width..-1] : @name, txt)
26+ else
27+ str = sprintf("%s %s", txt, @name[0..@block.width-1])
28+ end
29+
30+ engine.render_string(str)
31 end
32
33- engine.render_string(str)
34-
35 glPopMatrix()
36
37 t = glutGet(GLUT_ELAPSED_TIME)
38diff -ru gl_tail_orig/parsers/apache.rb gl_tail/parsers/apache.rb
39--- gl_tail_orig/parsers/apache.rb 2007-11-14 21:08:04.000000000 +0000
40+++ gl_tail/parsers/apache.rb 2007-11-14 21:17:17.000000000 +0000
41@@ -20,7 +20,7 @@
42 url, parameters = url.split('?')
43
44 referrer.gsub!(/http:\/\//,'') if referrer
45-
46+
47 add_activity(:block => 'sites', :name => server.name, :size => size.to_i) # Size of activity based on size of request
48 add_activity(:block => 'urls', :name => url)
49 add_activity(:block => 'users', :name => host, :size => size.to_i)
50diff -ru gl_tail_orig/parsers/rails.rb gl_tail/parsers/rails.rb
51--- gl_tail_orig/parsers/rails.rb 2007-11-14 21:08:04.000000000 +0000
52+++ gl_tail/parsers/rails.rb 2007-11-14 21:17:13.000000000 +0000
53@@ -13,15 +13,15 @@
54 if url
55 _, host, url = /^http[s]?:\/\/([^\/]+)(.*)/.match(url).to_a
56
57- add_activity(:block => 'sites', :name => host, :size => ms.to_f) # Size of activity based on request time.
58+ add_activity(:block => 'sites', :name => server.name, :size => ms.to_f) # Size of activity based on request time.
59 add_activity(:block => 'urls', :name => HttpHelper.generalize_url(url), :size => ms.to_f)
60 add_activity(:block => 'slow requests', :name => url, :size => ms.to_f)
61 add_activity(:block => 'content', :name => 'page')
62
63 # Events to pop up
64- add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url.include?('/login')
65- add_event(:block => 'info', :name => "Sales", :message => "$", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if url.include?('/checkout')
66- add_event(:block => 'info', :name => "Signups", :message => "New User...", :update_stats => true, :color => [1.0, 1.0, 1.0, 1.0]) if(url.include?('/signup') || url.include?('/users/create'))
67+ add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url && url.include?('/login')
68+ add_event(:block => 'info', :name => "Sales", :message => "$", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if url && url.include?('/checkout')
69+ add_event(:block => 'info', :name => "Signups", :message => "New User...", :update_stats => true, :color => [1.0, 1.0, 1.0, 1.0]) if url && (url.include?('/signup') || url.include?('/users/create'))
70 elsif line.include?('Processing ')
71 #Processing TasksController#update_sheet_info (for 123.123.123.123 at 2007-10-05 22:34:33) [POST]
72 _, host = /^Processing .* \(for (\d+.\d+.\d+.\d+) at .*\).*$/.match(line).to_a
Back to Top