salopulse 0.4.0 → 0.5.0
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/CHANGELOG.md +10 -0
- data/lib/salopulse/client.rb +42 -0
- data/lib/salopulse/configuration.rb +3 -1
- data/lib/salopulse/version.rb +1 -1
- 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: cc7bf7f198d439d42f261e8bdc3dd4047db5184dfebb3fc8db4b9b5a447e90a7
|
|
4
|
+
data.tar.gz: 5c97cb6e8117811a8c0f10b67b088e755f250830bc627bd2a4a686cf179a66b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66f824d471a449b8addb8d8d72454cb6317a49abb05a0d4ea39bd90cf834809fa1b82a8887b63d8ca42324502d0295505c7135e85bc793921647b04b1e9af3af
|
|
7
|
+
data.tar.gz: 0411bebdccca31b8986fda4aabb515286bceb06816b9f3916b71d4d607846f8885ef21c56cb77d46e971c477dbba8e13c0732bf0a40927fc11517852ee958971
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
4
4
|
|
|
5
|
+
## [0.5.0] - 2026-06-10
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Deploy tracking: when `release` is configured, the SDK now emits a one-shot
|
|
9
|
+
`"deploy"` event on `init` (process-scoped, idempotent on the backend by
|
|
10
|
+
`(project_environment_id, release)`). Captures runtime, framework, and host
|
|
11
|
+
automatically; users can enrich via the new `release_metadata` config
|
|
12
|
+
(known keys `sha`, `deployed_by`, `previous_release` are promoted, everything
|
|
13
|
+
else flows into a free-form metadata hash). Toggle off with `deploys: false`
|
|
14
|
+
|
|
5
15
|
## [0.4.0] - 2026-06-10
|
|
6
16
|
|
|
7
17
|
### Added
|
data/lib/salopulse/client.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "time"
|
|
2
|
+
require "socket"
|
|
2
3
|
require "singleton"
|
|
3
4
|
require_relative "version"
|
|
4
5
|
require_relative "configuration"
|
|
@@ -41,6 +42,7 @@ module Salopulse
|
|
|
41
42
|
install_at_exit_hook
|
|
42
43
|
|
|
43
44
|
@initialized = true
|
|
45
|
+
announce_deploy!
|
|
44
46
|
self
|
|
45
47
|
end
|
|
46
48
|
end
|
|
@@ -195,10 +197,50 @@ module Salopulse
|
|
|
195
197
|
@dsn = nil
|
|
196
198
|
@pid = nil
|
|
197
199
|
@initialized = false
|
|
200
|
+
@deploy_announced = false
|
|
198
201
|
end
|
|
199
202
|
|
|
200
203
|
private
|
|
201
204
|
|
|
205
|
+
KNOWN_RELEASE_META = %w[sha deployed_by previous_release].freeze
|
|
206
|
+
|
|
207
|
+
def announce_deploy!
|
|
208
|
+
return if @deploy_announced
|
|
209
|
+
return unless @configuration&.deploys
|
|
210
|
+
return if @configuration.release.to_s.empty?
|
|
211
|
+
|
|
212
|
+
meta = (@configuration.release_metadata || {}).each_with_object({}) { |(k, v), h| h[k.to_s] = v }
|
|
213
|
+
extras = meta.reject { |k, _| KNOWN_RELEASE_META.include?(k) }
|
|
214
|
+
|
|
215
|
+
data = {
|
|
216
|
+
"release" => @configuration.release,
|
|
217
|
+
"deployed_at" => Time.now.utc.iso8601(3),
|
|
218
|
+
"runtime" => "ruby #{RUBY_VERSION}",
|
|
219
|
+
"framework" => detect_framework,
|
|
220
|
+
"host" => detect_host,
|
|
221
|
+
"sha" => meta["sha"],
|
|
222
|
+
"deployed_by" => meta["deployed_by"],
|
|
223
|
+
"previous_release" => meta["previous_release"],
|
|
224
|
+
"metadata" => extras.empty? ? nil : extras
|
|
225
|
+
}.compact
|
|
226
|
+
|
|
227
|
+
enqueue(build_event(type: "deploy", data: data, ctx: nil))
|
|
228
|
+
@deploy_announced = true
|
|
229
|
+
rescue StandardError => e
|
|
230
|
+
@configuration&.logger&.warn("[Salopulse] deploy announce failed: #{e.class}: #{e.message}")
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def detect_framework
|
|
234
|
+
return "rails #{Rails::VERSION::STRING}" if defined?(Rails) && defined?(Rails::VERSION)
|
|
235
|
+
nil
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def detect_host
|
|
239
|
+
Socket.gethostname
|
|
240
|
+
rescue StandardError
|
|
241
|
+
nil
|
|
242
|
+
end
|
|
243
|
+
|
|
202
244
|
def enqueue(event)
|
|
203
245
|
return false unless ensure_runtime_ready!
|
|
204
246
|
return false unless @buffer
|
|
@@ -5,7 +5,7 @@ module Salopulse
|
|
|
5
5
|
attr_accessor :dsn, :release, :environment, :sample_rate,
|
|
6
6
|
:flush_interval, :flush_batch_size, :n1_threshold,
|
|
7
7
|
:before_send, :logger, :enabled, :max_buffer_size,
|
|
8
|
-
:app_root
|
|
8
|
+
:app_root, :deploys, :release_metadata
|
|
9
9
|
|
|
10
10
|
def initialize
|
|
11
11
|
@release = nil
|
|
@@ -19,6 +19,8 @@ module Salopulse
|
|
|
19
19
|
@enabled = true
|
|
20
20
|
@max_buffer_size = 10_000
|
|
21
21
|
@app_root = detect_app_root
|
|
22
|
+
@deploys = true
|
|
23
|
+
@release_metadata = {}
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
private
|
data/lib/salopulse/version.rb
CHANGED