catpm 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/app/views/catpm/system/index.html.erb +3 -3
- data/lib/catpm/engine.rb +0 -6
- data/lib/catpm/flusher.rb +11 -10
- data/lib/catpm/version.rb +1 -1
- data/lib/generators/catpm/templates/initializer.rb.tt +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a84d81e5f4bbf2dca6af9f3b1c91d18af2160e9a15e24c8093216be4b8c5e20
|
|
4
|
+
data.tar.gz: 347b9026049cb39becf4d7618996c3091ddc0243115efdf47e689c644ec03f89
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da7474f427ad062a4cad9098263adacc90df2835cc8e2425689363346e805ca3fa520870fe2366cb750ea0f47bb3579adc06872891c413a2bcb9bd9222467278
|
|
7
|
+
data.tar.gz: a1161b1475b8c45654a6e0833cc1884686adaf2bdb1de5293c8337085e5e290503399053a19d2c3d2ce1fce2c79cc7ec0b31ea5d0e31207ffaff3a32ce50710b
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<div class="node-icon"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" stroke="var(--text-2)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="14" cy="8" rx="8" ry="4"/><path d="M6 8v12c0 2.2 3.58 4 8 4s8-1.8 8-4V8"/><path d="M6 14c0 2.2 3.58 4 8 4s8-1.8 8-4"/></svg></div>
|
|
40
40
|
<div class="node-label">Database</div>
|
|
41
41
|
<div class="node-value"><%= @bucket_count %> <span style="font-size:12px;font-weight:400;color:var(--text-2)">buckets</span></div>
|
|
42
|
-
<div class="node-detail">Aggregated stats are stored as time buckets, plus <%= @sample_count %> detailed samples and <%= @error_count %> error fingerprints.<br><%= @oldest_bucket ? "Data since #{@oldest_bucket.strftime('%b %-d')}, retained #{(@config.retention_period / 1.day).to_i} days." : "No data yet." %></div>
|
|
42
|
+
<div class="node-detail">Aggregated stats are stored as time buckets, plus <%= @sample_count %> detailed samples and <%= @error_count %> error fingerprints.<br><%= @oldest_bucket ? "Data since #{@oldest_bucket.strftime('%b %-d')}, retained #{@config.retention_period ? "#{(@config.retention_period / 1.day).to_i} days" : "forever"}." : "No data yet." %></div>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
45
45
|
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
<tr><td>Shutdown Timeout</td><td class="mono"><%= @config.shutdown_timeout %>s</td></tr>
|
|
85
85
|
|
|
86
86
|
<tr><td colspan="2" style="font-weight:600;color:var(--text-2);font-size:11px;text-transform:uppercase;letter-spacing:0.5px;padding-top:12px">Retention & Downsampling</td></tr>
|
|
87
|
-
<tr><td>Retention Period</td><td class="mono"><%= (@config.retention_period / 1.day).to_i
|
|
87
|
+
<tr><td>Retention Period</td><td class="mono"><%= @config.retention_period ? "#{(@config.retention_period / 1.day).to_i} days" : "forever" %></td></tr>
|
|
88
88
|
<tr><td>Cleanup Interval</td><td class="mono"><%= (@config.cleanup_interval / 1.minute).to_i %> min</td></tr>
|
|
89
|
-
<tr><td>Bucket Sizes</td><td class="mono"
|
|
89
|
+
<tr><td>Bucket Sizes</td><td class="mono"><%= @config.bucket_sizes.map { |k, v| "#{k}: #{v < 1.hour ? "#{(v / 1.minute).to_i}min" : v < 1.day ? "#{(v / 1.hour).to_i}h" : "#{(v / 1.day).to_i}d"}" }.join(", ") %></td></tr>
|
|
90
90
|
|
|
91
91
|
<tr><td colspan="2" style="font-weight:600;color:var(--text-2);font-size:11px;text-transform:uppercase;letter-spacing:0.5px;padding-top:12px">Error Tracking</td></tr>
|
|
92
92
|
<tr><td>Max Error Contexts</td><td class="mono"><%= @config.max_error_contexts %></td></tr>
|
data/lib/catpm/engine.rb
CHANGED
|
@@ -4,12 +4,6 @@ module Catpm
|
|
|
4
4
|
class Engine < ::Rails::Engine
|
|
5
5
|
isolate_namespace Catpm
|
|
6
6
|
|
|
7
|
-
initializer 'catpm.migrations' do |app|
|
|
8
|
-
config.paths['db/migrate'].expanded.each do |path|
|
|
9
|
-
app.config.paths['db/migrate'] << path unless app.config.paths['db/migrate'].include?(path)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
7
|
initializer 'catpm.middleware' do |app|
|
|
14
8
|
app.middleware.insert_before 0, Catpm::Middleware
|
|
15
9
|
end
|
data/lib/catpm/flusher.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'concurrent'
|
|
4
|
-
|
|
5
3
|
module Catpm
|
|
6
4
|
class Flusher
|
|
7
5
|
attr_reader :running
|
|
@@ -13,26 +11,29 @@ module Catpm
|
|
|
13
11
|
@circuit = CircuitBreaker.new
|
|
14
12
|
@last_cleanup_at = Time.now
|
|
15
13
|
@running = false
|
|
16
|
-
@
|
|
14
|
+
@thread = nil
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
def start
|
|
20
18
|
return if @running
|
|
21
19
|
|
|
22
20
|
@running = true
|
|
23
|
-
@
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
@thread = Thread.new do
|
|
22
|
+
while @running
|
|
23
|
+
sleep(effective_interval)
|
|
24
|
+
flush_cycle if @running
|
|
25
|
+
end
|
|
26
|
+
rescue => e
|
|
27
|
+
Catpm.config.error_handler.call(e)
|
|
28
|
+
retry if @running
|
|
29
|
+
end
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def stop(timeout: Catpm.config.shutdown_timeout)
|
|
31
33
|
return unless @running
|
|
32
34
|
|
|
33
35
|
@running = false
|
|
34
|
-
@
|
|
35
|
-
@timer&.wait_for_termination(timeout)
|
|
36
|
+
@thread&.join(timeout)
|
|
36
37
|
flush_cycle # Final flush
|
|
37
38
|
end
|
|
38
39
|
|
data/lib/catpm/version.rb
CHANGED
|
@@ -17,9 +17,9 @@ Catpm.configure do |config|
|
|
|
17
17
|
|
|
18
18
|
# === Instrumentation ===
|
|
19
19
|
#
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
config.instrument_http = true # Track HTTP requests (default: true)
|
|
21
|
+
config.instrument_jobs = false # Track ActiveJob (default: false)
|
|
22
|
+
config.instrument_segments = true # Track SQL/view/cache segments (default: true)
|
|
23
23
|
# config.instrument_net_http = false # Patch Net::HTTP for outbound tracking (default: false)
|
|
24
24
|
# config.instrument_middleware_stack = false # Decompose middleware into per-middleware segments (default: false)
|
|
25
25
|
# config.max_segments_per_request = 50 # Cap segments per request (keeps slowest)
|