dead_bro 0.2.10 → 0.2.12
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/FEATURES.md +1 -6
- data/README.md +19 -0
- data/lib/dead_bro/configuration.rb +45 -3
- data/lib/dead_bro/job_subscriber.rb +1 -1
- data/lib/dead_bro/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 56f6a72ccfa1a5e362c74eddace39a1ffeba97d06bab551f38d9091311609770
|
|
4
|
+
data.tar.gz: 20ee34708c5eed8ac00af8d462953422ba7a24e3b9701e56e31eea8ba35752f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 932ce6601969ac9f95ba0ce327b93a5412c167a4c7fe367d0c14bd05c5c751b69bb3da48eaf829e73bcf6ca10c66fd7678ff0caca4eba7e0ec42a3b4bae72e54
|
|
7
|
+
data.tar.gz: 032ee4230c5b043a7ef8cf176963500eb60157927ad18f18c8e657f2439b31ab8b3526e7dd90036f79ec5fc7e978b55de540fcad14925f1fb33ffb6308379964
|
data/FEATURES.md
CHANGED
|
@@ -284,12 +284,7 @@ A comprehensive feature list for comparing ApmBro with other APM (Application Pe
|
|
|
284
284
|
## Deployment & Environment
|
|
285
285
|
|
|
286
286
|
### Deploy Tracking
|
|
287
|
-
- **Deploy ID Resolution**: Multiple sources for deploy identification
|
|
288
|
-
- Explicit configuration
|
|
289
|
-
- Rails settings/credentials
|
|
290
|
-
- Environment variables (APM_BRO_DEPLOY_ID, GIT_REV)
|
|
291
|
-
- Heroku (HEROKU_SLUG_COMMIT)
|
|
292
|
-
- Process-stable UUID fallback
|
|
287
|
+
- **Deploy ID Resolution**: Multiple sources for deploy identification (`Configuration#deploy_id=` wins when set, then ENV in `Configuration::DEPLOY_REVISION_ENV_KEYS` order—including `DEAD_BRO_DEPLOY_ID`, git/CI vars, `DD_VERSION`, etc.), otherwise a **per-process UUID** (fine for single dyno/process; unusable alone for fleets like ECS replicas)
|
|
293
288
|
- **Revision Tracking**: Includes deploy/revision ID in all metric payloads
|
|
294
289
|
|
|
295
290
|
### Environment Support
|
data/README.md
CHANGED
|
@@ -30,6 +30,25 @@ end
|
|
|
30
30
|
|
|
31
31
|
That is enough to start shipping metrics. Create or copy the key from your DeadBro account, then wire it into `DEAD_BRO_API_KEY` (or assign `config.api_key` directly).
|
|
32
32
|
|
|
33
|
+
### Deploy / release tracking (ECS, Kubernetes, autoscaling groups)
|
|
34
|
+
|
|
35
|
+
DeadBro sends a **`revision`** string on every payload so charts and deploys group metrics by release. If you do **not** configure a stable value, the gem generates a UUID **once per Ruby process**. With multiple containers or EC2 instances, each replica then looks like a separate deployment.
|
|
36
|
+
|
|
37
|
+
**Use one shared identifier for every task in the same rollout**, for example:
|
|
38
|
+
|
|
39
|
+
- Set `DEAD_BRO_DEPLOY_ID` (or `dead_bro_DEPLOY_ID`) in the task definition / pod spec to your **git SHA**, **image digest**, or CD **release id** injected at build or deploy time.
|
|
40
|
+
- Or set it in Ruby (this wins over environment variables when non-blank):
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
DeadBro.configure do |config|
|
|
44
|
+
config.deploy_id = ENV.fetch("GIT_SHA") { raise "Set GIT_SHA in the task definition" }
|
|
45
|
+
end
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The gem also checks these environment variables in order (first non-empty wins): `DEAD_BRO_DEPLOY_ID`, `dead_bro_DEPLOY_ID`, `GIT_REV`, `GIT_COMMIT`, `GIT_COMMIT_SHA`, `GIT_SHA`, `CODEBUILD_RESOLVED_SOURCE_REVISION`, `HEROKU_SLUG_COMMIT`, `RENDER_GIT_COMMIT`, `DD_VERSION`, `APP_REVISION`, `RELEASE_VERSION`, `SOURCE_VERSION`.
|
|
49
|
+
|
|
50
|
+
For **Amazon ECS**, add one of these variables in your task definition from CodeBuild, GitHub Actions, or your pipeline so all tasks in the service share the same value for that image version.
|
|
51
|
+
|
|
33
52
|
### Dashboard configuration
|
|
34
53
|
|
|
35
54
|
Use the DeadBro UI to turn features on or off, set sample rates, define controller/job inclusions and exclusions, tune slow-query EXPLAIN, enable queue and system metrics, and adjust related limits. After you deploy the initializer above, those choices take effect when the gem receives them from the API (typically on the next successful metric or heartbeat response).
|
|
@@ -7,7 +7,7 @@ module DeadBro
|
|
|
7
7
|
# returns it in a response; local configure() values apply until the next remote update.
|
|
8
8
|
attr_accessor :api_key, :open_timeout, :read_timeout, :enabled, :ruby_dev,
|
|
9
9
|
:circuit_breaker_enabled, :circuit_breaker_failure_threshold, :circuit_breaker_recovery_timeout,
|
|
10
|
-
:circuit_breaker_retry_timeout, :
|
|
10
|
+
:circuit_breaker_retry_timeout, :disk_paths, :interfaces_ignore
|
|
11
11
|
|
|
12
12
|
# Remote-managed settings (overwritten by backend JSON `settings` on successful API responses)
|
|
13
13
|
attr_accessor :memory_tracking_enabled, :allocation_tracking_enabled,
|
|
@@ -30,6 +30,24 @@ module DeadBro
|
|
|
30
30
|
|
|
31
31
|
HEARTBEAT_INTERVAL = 60 # seconds
|
|
32
32
|
|
|
33
|
+
# First non-empty ENV value wins for release/revision payloads and deploy grouping on the server.
|
|
34
|
+
# Order is roughly: DeadBro-native → common CI/hosting → observability tooling.
|
|
35
|
+
DEPLOY_REVISION_ENV_KEYS = %w[
|
|
36
|
+
DEAD_BRO_DEPLOY_ID
|
|
37
|
+
dead_bro_DEPLOY_ID
|
|
38
|
+
GIT_REV
|
|
39
|
+
GIT_COMMIT
|
|
40
|
+
GIT_COMMIT_SHA
|
|
41
|
+
GIT_SHA
|
|
42
|
+
CODEBUILD_RESOLVED_SOURCE_REVISION
|
|
43
|
+
HEROKU_SLUG_COMMIT
|
|
44
|
+
RENDER_GIT_COMMIT
|
|
45
|
+
DD_VERSION
|
|
46
|
+
APP_REVISION
|
|
47
|
+
RELEASE_VERSION
|
|
48
|
+
SOURCE_VERSION
|
|
49
|
+
].freeze
|
|
50
|
+
|
|
33
51
|
REMOTE_SETTING_KEYS = %w[
|
|
34
52
|
enabled sample_rate memory_tracking_enabled allocation_tracking_enabled
|
|
35
53
|
explain_analyze_enabled slow_query_threshold_ms max_sql_queries_to_send max_logs_to_send
|
|
@@ -47,7 +65,7 @@ module DeadBro
|
|
|
47
65
|
@circuit_breaker_failure_threshold = 3
|
|
48
66
|
@circuit_breaker_recovery_timeout = 60
|
|
49
67
|
@circuit_breaker_retry_timeout = 300
|
|
50
|
-
@
|
|
68
|
+
@explicit_deploy_revision = nil
|
|
51
69
|
@disk_paths = ["/"]
|
|
52
70
|
@interfaces_ignore = %w[lo lo0 docker0]
|
|
53
71
|
|
|
@@ -74,6 +92,17 @@ module DeadBro
|
|
|
74
92
|
@settings_mutex = Mutex.new
|
|
75
93
|
end
|
|
76
94
|
|
|
95
|
+
# Current release revision sent as `revision` on all API payloads — same semantics as `#resolve_deploy_id`.
|
|
96
|
+
def deploy_id
|
|
97
|
+
resolve_deploy_id
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Overrides ENV-based resolution when set to a non-empty string (or clears override when nil/blank).
|
|
101
|
+
def deploy_id=(value)
|
|
102
|
+
s = value&.respond_to?(:to_s) ? value.to_s.strip : ""
|
|
103
|
+
@explicit_deploy_revision = s.empty? ? nil : s
|
|
104
|
+
end
|
|
105
|
+
|
|
77
106
|
def excluded_controllers=(value)
|
|
78
107
|
@excluded_controllers = Array(value).map(&:to_s)
|
|
79
108
|
@compiled_excluded_controllers = compile_patterns(@excluded_controllers)
|
|
@@ -124,7 +153,20 @@ module DeadBro
|
|
|
124
153
|
end
|
|
125
154
|
|
|
126
155
|
def resolve_deploy_id
|
|
127
|
-
|
|
156
|
+
explicit = @explicit_deploy_revision&.to_s&.strip
|
|
157
|
+
return explicit unless explicit.nil? || explicit.empty?
|
|
158
|
+
|
|
159
|
+
DEPLOY_REVISION_ENV_KEYS.each do |key|
|
|
160
|
+
v = ENV[key]
|
|
161
|
+
next unless v.respond_to?(:to_s)
|
|
162
|
+
|
|
163
|
+
stripped = v.to_s.strip
|
|
164
|
+
next if stripped.empty?
|
|
165
|
+
|
|
166
|
+
return stripped
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
DeadBro.process_deploy_id
|
|
128
170
|
end
|
|
129
171
|
|
|
130
172
|
def excluded_controller?(controller_name, action_name = nil)
|
|
@@ -215,7 +215,7 @@ module DeadBro
|
|
|
215
215
|
(arg.length > 200) ? arg[0, 200] + "..." : arg
|
|
216
216
|
when Hash
|
|
217
217
|
# Filter sensitive keys and limit size
|
|
218
|
-
filtered = arg.
|
|
218
|
+
filtered = arg.reject { |k, _| %w[password token secret key].include?(k.to_s) }
|
|
219
219
|
(filtered.keys.size > 20) ? filtered.first(20).to_h : filtered
|
|
220
220
|
when Array
|
|
221
221
|
arg.first(5)
|
data/lib/dead_bro/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dead_bro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emanuel Comsa
|
|
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
65
65
|
requirements:
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 2.7.0
|
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
71
|
- - ">="
|