spartan_apm 0.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +55 -0
  5. data/VERSION +1 -0
  6. data/app/assets/flatpickr-4.6.9/LICENSE.md +21 -0
  7. data/app/assets/flatpickr-4.6.9/flatpickr.min.css +13 -0
  8. data/app/assets/flatpickr-4.6.9/flatpickr.min.js +2 -0
  9. data/app/assets/nice-select2-2.0.0/LICENSE +21 -0
  10. data/app/assets/nice-select2-2.0.0/nice-select2.min.css +1 -0
  11. data/app/assets/nice-select2-2.0.0/nice-select2.min.js +1 -0
  12. data/app/assets/spartan.svg +5 -0
  13. data/app/views/_help.html.erb +147 -0
  14. data/app/views/index.html.erb +231 -0
  15. data/app/views/scripts.js +911 -0
  16. data/app/views/styles.css +332 -0
  17. data/config.ru +36 -0
  18. data/lib/spartan_apm/engine.rb +45 -0
  19. data/lib/spartan_apm/error_info.rb +17 -0
  20. data/lib/spartan_apm/instrumentation/active_record.rb +13 -0
  21. data/lib/spartan_apm/instrumentation/base.rb +36 -0
  22. data/lib/spartan_apm/instrumentation/bunny.rb +24 -0
  23. data/lib/spartan_apm/instrumentation/cassandra.rb +13 -0
  24. data/lib/spartan_apm/instrumentation/curb.rb +13 -0
  25. data/lib/spartan_apm/instrumentation/dalli.rb +13 -0
  26. data/lib/spartan_apm/instrumentation/elasticsearch.rb +18 -0
  27. data/lib/spartan_apm/instrumentation/excon.rb +13 -0
  28. data/lib/spartan_apm/instrumentation/http.rb +13 -0
  29. data/lib/spartan_apm/instrumentation/httpclient.rb +13 -0
  30. data/lib/spartan_apm/instrumentation/net_http.rb +13 -0
  31. data/lib/spartan_apm/instrumentation/redis.rb +13 -0
  32. data/lib/spartan_apm/instrumentation/typhoeus.rb +13 -0
  33. data/lib/spartan_apm/instrumentation.rb +71 -0
  34. data/lib/spartan_apm/measure.rb +172 -0
  35. data/lib/spartan_apm/metric.rb +26 -0
  36. data/lib/spartan_apm/middleware/rack/end_middleware.rb +29 -0
  37. data/lib/spartan_apm/middleware/rack/start_middleware.rb +57 -0
  38. data/lib/spartan_apm/middleware/sidekiq/end_middleware.rb +25 -0
  39. data/lib/spartan_apm/middleware/sidekiq/start_middleware.rb +34 -0
  40. data/lib/spartan_apm/middleware.rb +16 -0
  41. data/lib/spartan_apm/persistence.rb +648 -0
  42. data/lib/spartan_apm/report.rb +436 -0
  43. data/lib/spartan_apm/string_cache.rb +27 -0
  44. data/lib/spartan_apm/web/api_request.rb +133 -0
  45. data/lib/spartan_apm/web/helpers.rb +88 -0
  46. data/lib/spartan_apm/web/router.rb +90 -0
  47. data/lib/spartan_apm/web.rb +10 -0
  48. data/lib/spartan_apm.rb +399 -0
  49. data/spartan_apm.gemspec +39 -0
  50. metadata +161 -0
@@ -0,0 +1,231 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= h(application_name) %></title>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="pinterest" content="nopin" />
7
+ <meta name="format-detection" content="telephone=no">
8
+
9
+ <script type="text/javascript">
10
+ // The relative links to assets won't be found if the app was mounted under a path but
11
+ // the request comes in without a trailing slash.
12
+ if (!window.location.pathname.endsWith("/")) {
13
+ window.location.pathname = window.location.pathname + "/";
14
+ }
15
+ </script>
16
+
17
+ <link rel="stylesheet" href="assets/nice-select2-2.0.0/nice-select2.min.css">
18
+ <link rel="stylesheet" href="assets/flatpickr-4.6.9/flatpickr.min.css">
19
+ <style type="text/css">
20
+ <%= render "styles.css" %>
21
+ </style>
22
+
23
+ <script type="text/javascript" src="assets/nice-select2-2.0.0/nice-select2.min.js"></script>
24
+ <script type="text/javascript" src="assets/flatpickr-4.6.9/flatpickr.min.js"></script>
25
+ <script type="text/javascript" src="<%= h(SpartanAPM.plotly_js_url) %>"></script>
26
+ <script>
27
+ <%= render "scripts.js" %>
28
+ </script>
29
+ </head>
30
+
31
+ <body data-authentication-url="<%= h(authentication_url) %>">
32
+ <header>
33
+ <div class="dates">
34
+ <span id="start-time" class="nowrap"></span>
35
+ <span class="hide-xs">-</span>
36
+ <span id="end-time" class="nowrap"></span>
37
+ </div>
38
+ <div class="help-btn">
39
+ <a href="#" id="help">&#9432;</a>
40
+ </div>
41
+ <h1>
42
+ <% if application_url %>
43
+ <a href="<%= h(application_url) %>"><%= h(application_name) %></a>
44
+ <% else %>
45
+ <%= h(application_name) %>
46
+ <% end %>
47
+ </h1>
48
+ </header>
49
+
50
+ <div class="container">
51
+ <nav>
52
+ <% if environments.size > 1 %>
53
+ <select id="env" size="1" title="Environment">
54
+ <% environments.each_with_index do |env, index| %>
55
+ <option <%= "selected" if index == 0%>><%= h(env) %></option>
56
+ <% end %>
57
+ </select>
58
+ <% else %>
59
+ <input id="env" type="hidden">
60
+ <% end %>
61
+
62
+ <% if apps.size > 1 %>
63
+ <select id="app" size="1" title="App">
64
+ <% apps.each_with_index do |app, index| %>
65
+ <option <%= "selected" if index == 0%>><%= h(app) %></option>
66
+ <% end %>
67
+ </select>
68
+ <% else %>
69
+ <input id="app" type="hidden">
70
+ <% end %>
71
+
72
+ <select id="host" size="1" data-searchable="true" title="Host">
73
+ <option value="" selected>All hosts</option>
74
+ </select>
75
+
76
+ <select id="action" size="1" data-searchable="true" title="Action">
77
+ <option value="" selected>All actions</option>
78
+ </select>
79
+
80
+ <span class="nowrap">
81
+ <select id="minutes" size="1" title="Minutes">
82
+ <option value="15">15 minutes</option>
83
+ <option value="30" selected>30 minutes</option>
84
+ <option value="60">60 minutes</option>
85
+ <option value="120">2 hours</option>
86
+ <option value="180">3 hours</option>
87
+ <option value="240">4 hours</option>
88
+ <option value="360">6 hours</option>
89
+ <option value="720">12 hours</option>
90
+ <option value="1440">24 hours</option>
91
+ <option value="2880">2 days</option>
92
+ <option value="4320">3 days</option>
93
+ <option value="10080">7 days</option>
94
+ <option value="20160">14 days</option>
95
+ <option value="43200">30 days</option>
96
+ <option value="86400">60 days</option>
97
+ <option value="129600">90 days</option>
98
+ <option value="259200">180 days</option>
99
+ <option value="525600">365 days</option>
100
+ </select>
101
+ </span>
102
+
103
+ <span class="nowrap">
104
+ <input type="datetime-local" id="time" class="form-control" value="" title="Select start time or leave blank to see current time" placeholder="Start time">
105
+
106
+ <span id="live-checkbox">
107
+ <input type="checkbox" value="1" id="live">
108
+ <label for="live">Live</label>
109
+ </span>
110
+ &nbsp;
111
+ </span>
112
+
113
+ <span class="nowrap">
114
+ <button type="button" class="btn" id="update-charts" title="refresh">
115
+ <svg viewBox="0 0 32 32" width="20" height="20">
116
+ <path d=" M16 2 A14 14 0 0 0 2 16 A14 14 0 0 0 16 30 A14 14 0 0 0 26 26 L 23.25 23 A10 10 0 0 1 16 26 A10 10 0 0 1 6 16 A10 10 0 0 1 16 6 A10 10 0 0 1 23.25 9 L19 13 L30 13 L30 2 L26 6 A14 14 0 0 0 16 2 ">
117
+ </svg>
118
+ </button>
119
+ <button type="button" class="btn" id="previous" disabled title="Previous">
120
+ &#8678;
121
+ </button>
122
+ <button type="button" class="btn" id="next" disabled title="Next">
123
+ &#8680;
124
+ </button>
125
+ </span>
126
+ </nav>
127
+
128
+ <div id="alert"></div>
129
+
130
+ <div id="loading-spinner" class="push-up spinner"></div>
131
+
132
+ <div id="charts" class="hidden">
133
+ <h2 class="text-center text-normal">
134
+ Request Time
135
+
136
+ <small class="nowrap">
137
+ (<span id="interval-minutes"></span> increments, <span id="avg-request-time"></span>ms average)
138
+ </small>
139
+
140
+ <small class="nowrap">
141
+ &nbsp;
142
+ <select id="measurement" size="1" title="Measurement">
143
+ <option value="avg" selected>average</option>
144
+ <option value="p50">average p50</option>
145
+ <option value="p90">average p90</option>
146
+ <option value="p99">average p99</option>
147
+ </select>
148
+ &nbsp;
149
+ </small>
150
+ </h2>
151
+ <div id="request-timing"></div>
152
+
153
+ <hr>
154
+
155
+ <h2 class="text-center text-normal">
156
+ Throughput
157
+ <small>(<span id="avg-requests-per-minute"></span> rpm average)</small>
158
+ </h2>
159
+ <div id="throughput"></div>
160
+
161
+ <hr>
162
+
163
+ <div class="flex-container">
164
+ <div class="flex-item">
165
+ <h2 class="text-center text-normal">
166
+ Error Rate
167
+ <small>(<span id="avg-error-rate"></span> average)</small>
168
+ </h2>
169
+ <div id="error-rate"></div>
170
+ </div>
171
+
172
+ <div class="flex-item">
173
+ <h2 class="text-center text-normal">
174
+ Errors
175
+ <small>(<span id="avg-errors-per-minute"></span> / minute average)</small>
176
+ </h2>
177
+ <div id="error-count"></div>
178
+ </div>
179
+ </div>
180
+
181
+ <div class="text-center">
182
+ </div>
183
+
184
+ <div id="error-details" class="push-up hidden">
185
+ <table id="error-table" class="table table-striped">
186
+ <thead>
187
+ <tr>
188
+ <th>Error</th>
189
+ <th>Count</th>
190
+ <th>Stacktrace</th>
191
+ </thead>
192
+ <tbody>
193
+ </table>
194
+ </div>
195
+
196
+ <div id="action-details" class="push-up hidden">
197
+ <h2 class="text-center text-normal">
198
+ Top Actions
199
+ <small>(% total time spent)</small>
200
+ </h2>
201
+ <div id="action-load"></div>
202
+ </div>
203
+
204
+ <div id="details-loading-spinner" class="push-up hidden spinner"></div>
205
+
206
+ <div class="text-center">
207
+ <button type="button" class="btn push-up" id="show-error-details">Show Error Details</button>
208
+ <button type="button" class="btn push-up" id="show-action-details">Show Action Details</button>
209
+ <button type="button" class="btn push-up" id="download-data">Download Data</button>
210
+ </div>
211
+ </div>
212
+ </div>
213
+
214
+ <div id="modal" class="js-close-modal" aria-hidden="true" aria-role="dialog">
215
+ <div class="modal-dialog">
216
+ <button type="button" title="Close Dialog" class="modal-close js-close-modal">&times;</button>
217
+ <div class="modal-content">
218
+ <%= render "_help.html.erb" %>
219
+ </div>
220
+ </div>
221
+ </div>
222
+
223
+ <template id="error-table-row" class="hidden">
224
+ <tr>
225
+ <td class="error-class-name"></td>
226
+ <td class="text-right error-count"></td>
227
+ <td class="error-backtrace"></td>
228
+ </tr>
229
+ </template>
230
+ </body>
231
+ </html>