rails_server_analytics 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ad5b69aac05847b33c764c3e15b0e80a0d385d854270d27b741ef3cc28a719
|
4
|
+
data.tar.gz: 4a8057197fb0d6827987e4ce8125a1f6f6f3fd09e58e1b9ace6d24bbe6e9d731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: 40dc5596ed1dc6b3fdf9db9e65f34e3e356ab3cf001c54c67f3f9e4d0295f0d924f0d0f3983de578a4eb7d5872237a462e7f5aac6df920080b583d84a6a5cb30
|
7
|
+
data.tar.gz: '084f68a4b4da79339afbaf05ab7df7ac0a4ab3791e33f286432821de83e301e0dd0e54179f197f6a9633a3d403286886190b4c56c9840d2ab2c808597e14ae53'
|
@@ -16,7 +16,7 @@ class AnalyticsController < ApplicationController
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def process_raw_analytics
|
19
|
-
request_count = @analytics.count
|
19
|
+
@request_count = @analytics.count
|
20
20
|
total_request_per_day = @analytics.where(updated_at: (Time.now - 1.day)..Time.now).pluck(:updated_at).count
|
21
21
|
|
22
22
|
average_response_time = get_average("time_spent")
|
@@ -31,7 +31,7 @@ class AnalyticsController < ApplicationController
|
|
31
31
|
|
32
32
|
@analytics_json = {
|
33
33
|
analytics: @analytics,
|
34
|
-
request_count: request_count,
|
34
|
+
request_count: @request_count,
|
35
35
|
total_request_per_day: total_request_per_day,
|
36
36
|
average_response_time: average_response_time,
|
37
37
|
most_frequent_request: most_frequent_request,
|
@@ -45,6 +45,8 @@ class AnalyticsController < ApplicationController
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def get_most_frequent(data)
|
48
|
+
return "None" if no_request
|
49
|
+
|
48
50
|
all_request = @analytics.map(&:analytics_data).pluck(data)
|
49
51
|
all_request.detect { |r| all_request.count(r) > 1 }
|
50
52
|
|
@@ -53,7 +55,13 @@ class AnalyticsController < ApplicationController
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def get_average(data)
|
58
|
+
return 0.00 if no_request
|
59
|
+
|
56
60
|
all_data = @analytics.map(&:analytics_data).pluck(data)
|
57
61
|
(all_data.sum / @analytics.count).truncate(3)
|
58
62
|
end
|
63
|
+
|
64
|
+
def no_request
|
65
|
+
@request_count == 0
|
66
|
+
end
|
59
67
|
end
|
metadata
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_server_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chong Wei Jie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
13
|
+
description: |
|
14
|
+
A rails gem that shows your rails application metrics and analytics in a dashboard view.
|
15
|
+
The gem applies a middleware to your rails application to trace requests and responses from your server, then pushes it to the database.
|
16
|
+
Raw data stored will then be processed and show in an analytical view on your localhost.
|
15
17
|
email:
|
16
18
|
- jackchong398@gmail.com
|
17
19
|
executables: []
|
@@ -33,6 +35,7 @@ licenses:
|
|
33
35
|
metadata:
|
34
36
|
homepage_uri: https://github.com/Cwjiee/rails-server-analytics
|
35
37
|
source_code_uri: https://github.com/Cwjiee/rails-server-analytics
|
38
|
+
changelog_uri: https://github.com/Cwjiee/rails-server-analytics/blob/main/CHANGELOG.md
|
36
39
|
post_install_message:
|
37
40
|
rdoc_options: []
|
38
41
|
require_paths:
|
@@ -51,5 +54,6 @@ requirements: []
|
|
51
54
|
rubygems_version: 3.5.11
|
52
55
|
signing_key:
|
53
56
|
specification_version: 4
|
54
|
-
summary: A
|
57
|
+
summary: A rails gem that shows your rails application metrics and analytics in a
|
58
|
+
dashboard view
|
55
59
|
test_files: []
|