kubelink 0.1.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kubelink.gemspec +9 -6
- data/lib/kubelink/sentry.rb +24 -19
- data/lib/kubelink/version.rb +3 -1
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09b17b7605e0c013c5943b6a4653434dad2203ef23c7cc035c8d99a993a47c04'
|
4
|
+
data.tar.gz: 7db92ce6f41ccb5d43f91ab3665385778a23e9608081581cb0443a1ddfee2780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dc67d25782851faa8acb113f7816d93817a050b550fbb185d978580c498d4f92433a523021e13c91012a6dd7be3ab5f6e768ef96b34297d1dba574af61ccbd
|
7
|
+
data.tar.gz: 736b8b6cdcc588f6023876cd175af2e8c72e0bbb674b4d5c3d3a2235ea1a973a113dcc45618d743900a1befc28c49b89a32493c9948c973852c0845f489138b0
|
data/kubelink.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'kubelink/version'
|
4
6
|
|
@@ -8,7 +10,7 @@ Gem::Specification.new do |s|
|
|
8
10
|
s.author = 'Martino di Filippo'
|
9
11
|
s.email = 'difilippo@shaman.xyz'
|
10
12
|
s.homepage = 'https://git.shaman.xyz/shaman/kubelink'
|
11
|
-
s.summary =
|
13
|
+
s.summary = 'Integrate a Rails app with our Kubernetes environment'
|
12
14
|
s.license = 'MIT'
|
13
15
|
s.metadata = {
|
14
16
|
'source_code_uri' => 'https://git.shaman.xyz/shaman/kubelink/tree/master'
|
@@ -16,7 +18,7 @@ Gem::Specification.new do |s|
|
|
16
18
|
|
17
19
|
s.required_ruby_version = '>= 2.3.0'
|
18
20
|
|
19
|
-
s.files = Dir.chdir(File.expand_path(
|
21
|
+
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
23
|
end
|
22
24
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -24,10 +26,11 @@ Gem::Specification.new do |s|
|
|
24
26
|
|
25
27
|
s.add_dependency 'activesupport', '>= 5.1', '< 7'
|
26
28
|
s.add_dependency 'lograge', '~> 0.11.2'
|
27
|
-
s.add_dependency 'prometheus_exporter', '~> 0.
|
29
|
+
s.add_dependency 'prometheus_exporter', '~> 0.7.0'
|
28
30
|
s.add_dependency 'rails', '>= 5.1', '< 7'
|
29
|
-
s.add_dependency 'sentry-
|
31
|
+
s.add_dependency 'sentry-rails', '~> 4.5.1'
|
32
|
+
s.add_dependency 'sentry-ruby', '~> 4.5.1'
|
30
33
|
|
31
|
-
s.add_development_dependency 'bundler', '~> 2.
|
34
|
+
s.add_development_dependency 'bundler', '~> 2.2'
|
32
35
|
s.add_development_dependency 'rake', '~> 12.3'
|
33
36
|
end
|
data/lib/kubelink/sentry.rb
CHANGED
@@ -1,47 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kubelink
|
2
|
-
class
|
4
|
+
class Sentrylink < Rails::Railtie
|
3
5
|
def self.sentry_dsn
|
4
6
|
@dsn ||= begin
|
5
7
|
u = URI.parse(ENV['SENTRY_DSN'])
|
6
8
|
u.password = nil
|
7
9
|
u.to_s
|
8
|
-
rescue
|
10
|
+
rescue StandardError
|
9
11
|
nil
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
initializer
|
15
|
+
initializer 'kubelink.sentry_integration' do
|
14
16
|
ActiveSupport.on_load :action_view do
|
15
17
|
include Helpers
|
16
18
|
end
|
17
19
|
|
18
|
-
if
|
19
|
-
require '
|
20
|
+
if Sentrylink.sentry_dsn.present?
|
21
|
+
require 'sentry-ruby'
|
22
|
+
require 'sentry-rails'
|
20
23
|
|
21
|
-
|
22
|
-
config.
|
24
|
+
Sentry.init do |config|
|
25
|
+
config.breadcrumbs_logger = [:active_support_logger]
|
26
|
+
config.dsn = Sentrylink.sentry_dsn
|
23
27
|
config.release = ENV['RAILS_COMMIT'] if ENV.key?('RAILS_COMMIT')
|
28
|
+
config.send_default_pii = true
|
29
|
+
config.traces_sample_rate = 1.0
|
24
30
|
end
|
25
31
|
|
26
32
|
ActiveSupport.on_load :action_controller do
|
27
33
|
include Controller
|
28
34
|
end
|
29
35
|
elsif Rails.env.production? && !defined?(Rake)
|
30
|
-
throw
|
36
|
+
throw 'This application cannot run in production without setting SENTRY_DSN'
|
31
37
|
end
|
32
38
|
end
|
33
39
|
|
34
40
|
module Helpers
|
35
41
|
def sentry_include_tag
|
36
|
-
return unless
|
42
|
+
return unless Sentrylink.sentry_dsn.present?
|
37
43
|
|
38
|
-
script = 'https://browser.sentry-cdn.com/5.
|
44
|
+
script = 'https://browser.sentry-cdn.com/5.11.0/bundle.min.js'
|
39
45
|
|
40
|
-
[
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
].join("\n").html_safe
|
46
|
+
[javascript_include_tag(script, crossorigin: :anonymous),
|
47
|
+
javascript_tag(nonce: true) do
|
48
|
+
%{Sentry.init({ dsn: "#{Sentrylink.sentry_dsn}" });}.html_safe
|
49
|
+
end].join("\n").html_safe
|
45
50
|
end
|
46
51
|
end
|
47
52
|
|
@@ -49,12 +54,12 @@ module Kubelink
|
|
49
54
|
extend ActiveSupport::Concern
|
50
55
|
|
51
56
|
included do
|
52
|
-
before_action :
|
57
|
+
before_action :set_sentry_context
|
53
58
|
end
|
54
59
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
60
|
+
def set_sentry_context
|
61
|
+
Sentry.set_extras(params: params.dup.permit!.to_hash, url: request.url)
|
62
|
+
Sentry.set_user(ip_address: request.remote_ip)
|
58
63
|
end
|
59
64
|
end
|
60
65
|
end
|
data/lib/kubelink/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubelink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martino di Filippo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.7.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.7.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rails
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,33 +79,47 @@ dependencies:
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '7'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name: sentry-
|
82
|
+
name: sentry-rails
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 4.5.1
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: 4.5.1
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: sentry-ruby
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 4.5.1
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 4.5.1
|
95
109
|
- !ruby/object:Gem::Dependency
|
96
110
|
name: bundler
|
97
111
|
requirement: !ruby/object:Gem::Requirement
|
98
112
|
requirements:
|
99
113
|
- - "~>"
|
100
114
|
- !ruby/object:Gem::Version
|
101
|
-
version: 2.
|
115
|
+
version: '2.2'
|
102
116
|
type: :development
|
103
117
|
prerelease: false
|
104
118
|
version_requirements: !ruby/object:Gem::Requirement
|
105
119
|
requirements:
|
106
120
|
- - "~>"
|
107
121
|
- !ruby/object:Gem::Version
|
108
|
-
version: 2.
|
122
|
+
version: '2.2'
|
109
123
|
- !ruby/object:Gem::Dependency
|
110
124
|
name: rake
|
111
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +134,7 @@ dependencies:
|
|
120
134
|
- - "~>"
|
121
135
|
- !ruby/object:Gem::Version
|
122
136
|
version: '12.3'
|
123
|
-
description:
|
137
|
+
description:
|
124
138
|
email: difilippo@shaman.xyz
|
125
139
|
executables: []
|
126
140
|
extensions: []
|
@@ -147,7 +161,7 @@ licenses:
|
|
147
161
|
- MIT
|
148
162
|
metadata:
|
149
163
|
source_code_uri: https://git.shaman.xyz/shaman/kubelink/tree/master
|
150
|
-
post_install_message:
|
164
|
+
post_install_message:
|
151
165
|
rdoc_options: []
|
152
166
|
require_paths:
|
153
167
|
- lib
|
@@ -162,8 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
176
|
- !ruby/object:Gem::Version
|
163
177
|
version: '0'
|
164
178
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
179
|
+
rubygems_version: 3.2.15
|
180
|
+
signing_key:
|
167
181
|
specification_version: 4
|
168
182
|
summary: Integrate a Rails app with our Kubernetes environment
|
169
183
|
test_files: []
|