brokepoint 0.0.0 → 0.0.1
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/brokepoint.gemspec +17 -0
- data/lib/brokepoint/middleware.rb +44 -0
- data/lib/brokepoint.rb +5 -32
- metadata +28 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11e1b854ee90fb01aa519015cd31bcfbf5f15f2e895ca0b01c0984e4ad17d40
|
4
|
+
data.tar.gz: 1142ca2dd6673af8b848eee3534dfcd0ef152d9702261c073d6f8e375cd192bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6e1d1b2066a561f650ecaf90d02ef10884bc07108332cbe8f076bcf12dec848247d516e61d99cdcf7f78bcc159172e32a196d10ee64cf1758dd322b41ac1c3
|
7
|
+
data.tar.gz: 165142e4f39ba4ffd6621bee0d1ef014b655a29d076052c489ccb31b27378ce9ff98b5906f78a5675838509b63584b5aa327e8678b251f58e13d323e503f68e7
|
data/brokepoint.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'lib/brokepoint'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'brokepoint'
|
5
|
+
s.version = Brokepoint::VERSION
|
6
|
+
s.summary = "Use this gem to capture errors, exceptions, and logs and send them to your Brokepoint install"
|
7
|
+
s.authors = ["Shane P"]
|
8
|
+
s.email = 'shane@shane.computer'
|
9
|
+
s.files = Dir['lib/**/*.rb', '*.gemspec']
|
10
|
+
s.homepage = 'https://rubygems.org/gems/brokepoint'
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.license = nil
|
13
|
+
|
14
|
+
s.metadata = { "rubygems_mfa_required" => "true" }
|
15
|
+
|
16
|
+
s.add_dependency 'zeitwerk', '~> 2.0'
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Brokepoint
|
6
|
+
class Middleware
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
begin
|
13
|
+
status, headers, response = @app.call(env)
|
14
|
+
rescue Exception => e
|
15
|
+
if ENV.key?('BROKEPOINT_URL')
|
16
|
+
Rails.logger.debug("exception has been noted; #{e.inspect}")
|
17
|
+
send_message_to_brokepoint(e.message, e.full_message, env)
|
18
|
+
end
|
19
|
+
|
20
|
+
raise e
|
21
|
+
end
|
22
|
+
|
23
|
+
[status, headers, response]
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def send_message_to_brokepoint(message, stacktrace, env)
|
29
|
+
brokepoint_installation_address = URI.parse("#{ENV.fetch('BROKEPOINT_URL')}/events")
|
30
|
+
headers = {'Content-Type': 'application/json'}
|
31
|
+
|
32
|
+
error = {
|
33
|
+
name: message,
|
34
|
+
raw_body: stacktrace,
|
35
|
+
url: [env['rack.url_scheme'], '://', env['HTTP_HOST'], env['REQUEST_URI']].join
|
36
|
+
}
|
37
|
+
|
38
|
+
Timeout.timeout(1) {
|
39
|
+
Net::HTTP.post(brokepoint_installation_address, { event: error }.to_json, headers)
|
40
|
+
}
|
41
|
+
rescue Timeout::Error
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/brokepoint.rb
CHANGED
@@ -1,35 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'uri'
|
3
|
-
require 'json'
|
1
|
+
require 'zeitwerk'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
@app = app
|
8
|
-
end
|
3
|
+
loader = Zeitwerk::Loader.for_gem
|
4
|
+
loader.setup
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
status, headers, response = @app.call(env)
|
13
|
-
rescue Exception => e
|
14
|
-
Rails.logger.debug("exception has been noted")
|
15
|
-
send_message_to_brokepoint(e.message, e.full_message)
|
16
|
-
raise e
|
17
|
-
end
|
18
|
-
|
19
|
-
[status, headers, response]
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def send_message_to_brokepoint(message, stacktrace)
|
25
|
-
brokepoint_installation_address = URI.parse("#{ENV.fetch('BROKEPOINT_URL')}/events")
|
26
|
-
headers = {'Content-Type': 'application/json'}
|
27
|
-
|
28
|
-
error = {
|
29
|
-
title: message,
|
30
|
-
raw_body: stacktrace
|
31
|
-
}
|
32
|
-
|
33
|
-
Net::HTTP.post(brokepoint_installation_address, { event: error }.to_json, headers)
|
34
|
-
end
|
6
|
+
module Brokepoint
|
7
|
+
VERSION = '0.0.1'
|
35
8
|
end
|
metadata
CHANGED
@@ -1,28 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brokepoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Shane
|
8
|
-
autorequire:
|
7
|
+
- Shane P
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
date: 2025-07-14 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: zeitwerk
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '2.0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '2.0'
|
26
|
+
email: shane@shane.computer
|
16
27
|
executables: []
|
17
28
|
extensions: []
|
18
29
|
extra_rdoc_files: []
|
19
30
|
files:
|
31
|
+
- brokepoint.gemspec
|
20
32
|
- lib/brokepoint.rb
|
21
|
-
|
33
|
+
- lib/brokepoint/middleware.rb
|
34
|
+
homepage: https://rubygems.org/gems/brokepoint
|
22
35
|
licenses:
|
23
|
-
-
|
24
|
-
metadata:
|
25
|
-
|
36
|
+
-
|
37
|
+
metadata:
|
38
|
+
rubygems_mfa_required: 'true'
|
26
39
|
rdoc_options: []
|
27
40
|
require_paths:
|
28
41
|
- lib
|
@@ -37,8 +50,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
50
|
- !ruby/object:Gem::Version
|
38
51
|
version: '0'
|
39
52
|
requirements: []
|
40
|
-
rubygems_version: 3.
|
41
|
-
signing_key:
|
53
|
+
rubygems_version: 3.6.1
|
42
54
|
specification_version: 4
|
43
|
-
summary:
|
55
|
+
summary: Use this gem to capture errors, exceptions, and logs and send them to your
|
56
|
+
Brokepoint install
|
44
57
|
test_files: []
|