rails_server_analytics 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/templates/index.html.erb.tt +46 -28
- data/lib/rails_server_analytics/version.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 013b7e598bba87a4ca28a1d98ed7170b474afa7fd09d77e817479f7650b26870
|
4
|
+
data.tar.gz: 065ff1d2e022cc1c495c8b16453b5797c31a962915ccb3cb9da1a356c9ed321d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1560256caf4c5ae65dde73e2741fe41e7125ee90a3a873f57afa54177af2b07b67f0a56cc43f8dcaf29d2da86a51ced5535ddf1507e8b21c6c47e653e29fee5
|
7
|
+
data.tar.gz: 268e2eb5295be08fd42d91eebe4aa57872fc9fcc7ce65f5e4ecf9457e0a4c20654f5f175a44295dba6dcc1d0c9ef4bce8f774955208a7ce8e1ef27d343842515
|
@@ -155,28 +155,10 @@
|
|
155
155
|
</div>
|
156
156
|
</div>
|
157
157
|
|
158
|
-
|
159
|
-
|
160
|
-
<
|
161
|
-
|
162
|
-
<%%
|
163
|
-
# You would need to implement chart rendering here
|
164
|
-
# You could use Chart.js or any other JavaScript charting library
|
165
|
-
# For now, we'll show the data in a table format
|
166
|
-
%>
|
167
|
-
<table style="width: 100%; border-collapse: collapse;">
|
168
|
-
<thead>
|
169
|
-
<tr>
|
170
|
-
<th style="text-align: left; padding: 8px; border-bottom: 1px solid #ddd;">Date</th>
|
171
|
-
<th style="text-align: right; padding: 8px; border-bottom: 1px solid #ddd;">Requests</th>
|
172
|
-
</tr>
|
173
|
-
</thead>
|
174
|
-
<tbody>
|
175
|
-
<tr>
|
176
|
-
<td><%% @analytics_json[:total_request_per_day] %></td>
|
177
|
-
</tr>
|
178
|
-
</tbody>
|
179
|
-
</table>
|
158
|
+
<div class="card">
|
159
|
+
<h3>Request Methods Distribution</h3>
|
160
|
+
<div class="chart-container">
|
161
|
+
<canvas id="methodChart"></canvas>
|
180
162
|
</div>
|
181
163
|
</div>
|
182
164
|
|
@@ -202,11 +184,47 @@
|
|
202
184
|
</div>
|
203
185
|
</div>
|
204
186
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
187
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
188
|
+
|
189
|
+
<script>
|
190
|
+
const analyticsData = <%%= raw @analytics.to_json %>;
|
191
|
+
const methodCounts = analyticsData.reduce((acc, curr) => {
|
192
|
+
const method = curr.analytics_data.request_method.toUpperCase();
|
193
|
+
acc[method] = (acc[method] || 0) + 1;
|
194
|
+
return acc;
|
195
|
+
}, {});
|
196
|
+
|
197
|
+
const methodChartCtx = document.getElementById('methodChart').getContext('2d');
|
198
|
+
new Chart(methodChartCtx, {
|
199
|
+
type: 'doughnut',
|
200
|
+
data: {
|
201
|
+
labels: Object.keys(methodCounts),
|
202
|
+
datasets: [{
|
203
|
+
data: Object.values(methodCounts),
|
204
|
+
backgroundColor: [
|
205
|
+
'#22c55e', // GET
|
206
|
+
'#3b82f6', // POST
|
207
|
+
'#f59e0b', // PUT
|
208
|
+
'#ef4444' // DELETE
|
209
|
+
]
|
210
|
+
}]
|
211
|
+
},
|
212
|
+
options: {
|
213
|
+
responsive: true,
|
214
|
+
maintainAspectRatio: false,
|
215
|
+
plugins: {
|
216
|
+
legend: {
|
217
|
+
position: 'right'
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
});
|
222
|
+
|
223
|
+
<%% if @analytics_json[:auto_refresh] %>
|
224
|
+
setTimeout(function() {
|
225
|
+
window.location.reload();
|
226
|
+
}, 5000);
|
211
227
|
<%% end %>
|
228
|
+
</script>
|
229
|
+
|
212
230
|
|
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.3
|
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-12 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: []
|