gricer 0.0.2 → 0.0.3
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.
@@ -310,7 +310,7 @@ module Gricer
|
|
310
310
|
require 'digest/sha1'
|
311
311
|
require 'resolv'
|
312
312
|
|
313
|
-
logger.debug("IP: #{ip}")
|
313
|
+
#logger.debug("IP: #{ip}")
|
314
314
|
|
315
315
|
unless ip.blank?
|
316
316
|
self.ip_address_hash = Digest::SHA1.hexdigest(ip)
|
@@ -402,7 +402,7 @@ module Gricer
|
|
402
402
|
# @return [Float]
|
403
403
|
def self.avg_duration
|
404
404
|
if (c = self.count) > 0
|
405
|
-
logger.debug ActiveRecord::Base.connection.class
|
405
|
+
#logger.debug ActiveRecord::Base.connection.class
|
406
406
|
|
407
407
|
if ActiveRecord::Base.connection.class.to_s == 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
|
408
408
|
self.sum("date_part('epoch', \"#{self.table_name}\".\"updated_at\") - date_part('epoch', \"#{self.table_name}\".\"created_at\")").to_f / c.to_f
|
@@ -422,6 +422,7 @@ module Gricer
|
|
422
422
|
# Get the new visitor rate
|
423
423
|
#
|
424
424
|
# This is the rate of new sessions to all sessions
|
425
|
+
# return [Float]
|
425
426
|
def self.new_visitors
|
426
427
|
if (c = self.count) > 0
|
427
428
|
self.new_visits.count / c.to_f
|
@@ -26,9 +26,9 @@ module Gricer
|
|
26
26
|
options[:user_id] = controller.gricer_user_id
|
27
27
|
end
|
28
28
|
|
29
|
-
options.keys.each do |key|
|
30
|
-
|
31
|
-
end
|
29
|
+
# options.keys.each do |key|
|
30
|
+
# Rails.logger.debug key
|
31
|
+
# end
|
32
32
|
|
33
33
|
gricer_request = ::Gricer::Request.create options
|
34
34
|
controller.gricer_request = gricer_request
|
@@ -39,7 +39,7 @@ module Gricer
|
|
39
39
|
|
40
40
|
gricer_request.update_attributes(
|
41
41
|
status_code: controller.response.status,
|
42
|
-
content_type: controller.response.content_type,
|
42
|
+
content_type: controller.response.content_type.to_s,
|
43
43
|
body_size: controller.response.body.size,
|
44
44
|
system_time: (benchmark.cstime*1000).to_i,
|
45
45
|
user_time: (benchmark.cutime*1000).to_i,
|
@@ -49,7 +49,7 @@ module Gricer
|
|
49
49
|
rescue
|
50
50
|
gricer_request.update_attributes(
|
51
51
|
status_code: 500,
|
52
|
-
content_type: controller.response.content_type,
|
52
|
+
content_type: controller.response.content_type.to_s,
|
53
53
|
body_size: controller.response.body.size
|
54
54
|
)
|
55
55
|
raise
|
@@ -125,7 +125,10 @@ module Gricer
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
# Gricer's extensions to ActionController::Base
|
128
129
|
class ActionController::Base
|
130
|
+
# Add this to your controllers to track requests for it.
|
131
|
+
# param options [Hash] Options that may be added in future.
|
129
132
|
def self.gricer_track_requests(options = {})
|
130
133
|
include Gricer::ActionController::Tracker
|
131
134
|
end
|
@@ -94,7 +94,7 @@ module Gricer
|
|
94
94
|
def filter_by(attribute, value)
|
95
95
|
return self if attribute.blank?
|
96
96
|
|
97
|
-
Rails.logger.debug "Attr: #{attribute}, Value: #{value}"
|
97
|
+
#Rails.logger.debug "Attr: #{attribute}, Value: #{value}"
|
98
98
|
|
99
99
|
parts = attribute.to_s.split('.')
|
100
100
|
if parts[1].blank?
|
data/lib/gricer/config.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gricer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sven G. Broenstrup
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-16 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- spec/dummy/config/routes.rb
|
133
133
|
- spec/dummy/config.ru
|
134
134
|
- spec/dummy/db/schema.rb
|
135
|
-
- spec/dummy/log/development.log
|
136
135
|
- spec/dummy/public/404.html
|
137
136
|
- spec/dummy/public/422.html
|
138
137
|
- spec/dummy/public/500.html
|
File without changes
|