bugwatch-ruby 0.2.0 → 0.3.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/lib/bugwatch/version.rb +1 -1
- data/lib/bugwatch.rb +55 -0
- 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: 5d0be9627dc1693332f0a201853dbca22da0e1f5a1e98ea7253ef5749c94f245
|
|
4
|
+
data.tar.gz: d896401132b2ba5eb708fac049711184a12a0cc0001831121e9a11bccee16ebc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1212d03ecfe11f84acb0f6ef8a1dda3e97b3896bbd878fba89bd1f933b6275afabd2d51a7bd49a934cd25652e8641a37d070c9a034d3d72be410152c4a0aefd
|
|
7
|
+
data.tar.gz: 79c7558fc9c17f8540e51638a0958f520faaef012cf524d0433c87d801dcc3bf4d4abdcad740d8f77d481fbe54fd4b8906c37b5395364bf26cb16e212e8f3f67
|
data/lib/bugwatch/version.rb
CHANGED
data/lib/bugwatch.rb
CHANGED
|
@@ -49,6 +49,61 @@ module Bugwatch
|
|
|
49
49
|
BreadcrumbCollector.add(message, type: type, metadata: metadata)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
def check_in(slug)
|
|
53
|
+
return unless configuration.api_key
|
|
54
|
+
return unless configuration.endpoint
|
|
55
|
+
|
|
56
|
+
Thread.new do
|
|
57
|
+
uri = URI.parse("#{configuration.endpoint.chomp("/")}/api/v1/monitors/#{slug}/check_in")
|
|
58
|
+
|
|
59
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
60
|
+
http.use_ssl = uri.scheme == "https"
|
|
61
|
+
http.open_timeout = 3
|
|
62
|
+
http.read_timeout = 3
|
|
63
|
+
http.write_timeout = 3
|
|
64
|
+
|
|
65
|
+
request = Net::HTTP::Post.new(uri.path)
|
|
66
|
+
request["X-Api-Key"] = configuration.api_key
|
|
67
|
+
request["X-BugWatch-Ruby"] = Bugwatch::VERSION
|
|
68
|
+
|
|
69
|
+
http.request(request)
|
|
70
|
+
rescue StandardError
|
|
71
|
+
# Fire-and-forget: never affect the host app
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def track_deploy(version:, environment: nil, description: nil, deployed_by: nil)
|
|
76
|
+
return unless configuration.api_key
|
|
77
|
+
return unless configuration.endpoint
|
|
78
|
+
|
|
79
|
+
env = environment || configuration.release_stage
|
|
80
|
+
|
|
81
|
+
Thread.new do
|
|
82
|
+
uri = URI.parse("#{configuration.endpoint.chomp("/")}/api/v1/deploys")
|
|
83
|
+
|
|
84
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
85
|
+
http.use_ssl = uri.scheme == "https"
|
|
86
|
+
http.open_timeout = 3
|
|
87
|
+
http.read_timeout = 3
|
|
88
|
+
http.write_timeout = 3
|
|
89
|
+
|
|
90
|
+
request = Net::HTTP::Post.new(uri.path)
|
|
91
|
+
request["Content-Type"] = "application/json"
|
|
92
|
+
request["X-Api-Key"] = configuration.api_key
|
|
93
|
+
request["X-BugWatch-Ruby"] = Bugwatch::VERSION
|
|
94
|
+
|
|
95
|
+
payload = { version: version, environment: env, deployed_at: Time.now.iso8601 }
|
|
96
|
+
payload[:description] = description if description
|
|
97
|
+
payload[:deployed_by] = deployed_by if deployed_by
|
|
98
|
+
|
|
99
|
+
request.body = JSON.generate(payload)
|
|
100
|
+
|
|
101
|
+
http.request(request)
|
|
102
|
+
rescue StandardError
|
|
103
|
+
# Fire-and-forget: never affect the host app
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
52
107
|
def transaction_buffer
|
|
53
108
|
@transaction_buffer ||= TransactionBuffer.new(config: configuration)
|
|
54
109
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bugwatch-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- BugWatch
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-04-
|
|
10
|
+
date: 2026-04-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: railties
|