sentry-ruby-core 6.7.0 → 7.0.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/gemfiles/ruby-2.7_rack-2_redis-4.gemfile.lock +7 -7
- data/gemfiles/ruby-2.7_rack-3.1_redis-4.gemfile.lock +7 -7
- data/gemfiles/ruby-2.7_rack-3_redis-4.gemfile.lock +7 -7
- data/gemfiles/ruby-3.0_rack-2_redis-4.gemfile.lock +8 -8
- data/gemfiles/ruby-3.0_rack-3.1_redis-4.gemfile.lock +8 -8
- data/gemfiles/ruby-3.0_rack-3_redis-4.gemfile.lock +8 -8
- data/gemfiles/ruby-3.1_rack-2_redis-4.gemfile.lock +16 -16
- data/gemfiles/ruby-3.1_rack-3.1_redis-4.gemfile.lock +16 -16
- data/gemfiles/ruby-3.1_rack-3_redis-4.gemfile.lock +16 -16
- data/gemfiles/ruby-3.2_rack-0_redis-5.gemfile.lock +16 -16
- data/gemfiles/ruby-3.2_rack-2_redis-4.gemfile.lock +18 -18
- data/gemfiles/ruby-3.2_rack-2_redis-5.gemfile.lock +18 -18
- data/gemfiles/ruby-3.2_rack-3.1_redis-4.gemfile.lock +18 -18
- data/gemfiles/ruby-3.2_rack-3_redis-4.gemfile.lock +18 -18
- data/gemfiles/ruby-3.2_rack-3_redis-5.gemfile.lock +18 -18
- data/gemfiles/ruby-3.3_rack-2_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-3.3_rack-3.1_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-3.3_rack-3.1_redis-5.3.gemfile.lock +22 -22
- data/gemfiles/ruby-3.3_rack-3_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-3.4_rack-2_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-3.4_rack-3.1_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-3.4_rack-3.1_redis-5.3.gemfile.lock +22 -22
- data/gemfiles/ruby-3.4_rack-3_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-4.0_rack-2_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-4.0_rack-3.1_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-4.0_rack-3_redis-4.gemfile.lock +22 -22
- data/gemfiles/ruby-jruby-9.4.14.0_rack-2_redis-4.gemfile.lock +14 -14
- data/gemfiles/ruby-jruby-9.4.14.0_rack-3.1_redis-4.gemfile.lock +14 -14
- data/gemfiles/ruby-jruby-9.4.14.0_rack-3_redis-4.gemfile.lock +14 -14
- data/lib/sentry/client.rb +2 -6
- data/lib/sentry/configuration.rb +34 -12
- data/lib/sentry/data_collection/key_value_collection.rb +136 -0
- data/lib/sentry/data_collection.rb +203 -0
- data/lib/sentry/debug_structured_logger.rb +2 -15
- data/lib/sentry/error_event.rb +6 -1
- data/lib/sentry/event.rb +8 -4
- data/lib/sentry/excon/middleware.rb +3 -8
- data/lib/sentry/faraday.rb +3 -4
- data/lib/sentry/hub.rb +2 -2
- data/lib/sentry/interfaces/exception.rb +8 -2
- data/lib/sentry/interfaces/request.rb +42 -46
- data/lib/sentry/interfaces/single_exception.rb +2 -2
- data/lib/sentry/net/http.rb +3 -4
- data/lib/sentry/redis.rb +1 -1
- data/lib/sentry/std_lib_logger.rb +2 -6
- data/lib/sentry/test_helper.rb +2 -4
- data/lib/sentry/utils/http_tracing.rb +42 -26
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +4 -18
- metadata +5 -3
|
@@ -61,14 +61,9 @@ module Sentry
|
|
|
61
61
|
url = env[:scheme] + "://" + env[:hostname] + env[:path]
|
|
62
62
|
result = { method: env[:method].to_s.upcase, url: url }
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# Handle excon 1.0.0+
|
|
68
|
-
result[:query] = build_nested_query(result[:query]) unless result[:query].is_a?(String)
|
|
69
|
-
|
|
70
|
-
result[:body] = env[:body]
|
|
71
|
-
end
|
|
64
|
+
query = filter_query_params(env[:query])
|
|
65
|
+
result[:query] = query if query
|
|
66
|
+
result[:body] = env[:body] if Sentry.configuration.data_collection.collect_outgoing_http_body?
|
|
72
67
|
|
|
73
68
|
result
|
|
74
69
|
end
|
data/lib/sentry/faraday.rb
CHANGED
|
@@ -59,10 +59,9 @@ module Sentry
|
|
|
59
59
|
url = env[:url].scheme + "://" + env[:url].host + env[:url].path
|
|
60
60
|
result = { method: env[:method].to_s.upcase, url: url }
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
end
|
|
62
|
+
query = filter_query_params(env[:url].query)
|
|
63
|
+
result[:query] = query if query
|
|
64
|
+
result[:body] = env[:body] if Sentry.configuration.data_collection.collect_outgoing_http_body?
|
|
66
65
|
|
|
67
66
|
result
|
|
68
67
|
end
|
data/lib/sentry/hub.rb
CHANGED
|
@@ -224,7 +224,7 @@ module Sentry
|
|
|
224
224
|
end
|
|
225
225
|
|
|
226
226
|
def capture_log_event(message, **options)
|
|
227
|
-
return unless current_client
|
|
227
|
+
return unless current_client
|
|
228
228
|
|
|
229
229
|
event = current_client.event_from_log(message, **options)
|
|
230
230
|
|
|
@@ -242,7 +242,7 @@ module Sentry
|
|
|
242
242
|
# @param attributes [Hash, nil] (optional) additional attributes for the metric
|
|
243
243
|
# @return [void]
|
|
244
244
|
def capture_metric(name:, type:, value:, unit: nil, attributes: nil)
|
|
245
|
-
return unless current_client
|
|
245
|
+
return unless current_client
|
|
246
246
|
|
|
247
247
|
metric = MetricEvent.new(
|
|
248
248
|
name: name,
|
|
@@ -25,15 +25,21 @@ module Sentry
|
|
|
25
25
|
# @see SingleExceptionInterface#build_with_stacktrace
|
|
26
26
|
# @see SingleExceptionInterface#initialize
|
|
27
27
|
# @param mechanism [Mechanism]
|
|
28
|
+
# @param data_collection [DataCollection]
|
|
28
29
|
# @return [ExceptionInterface]
|
|
29
|
-
def self.build(exception:, stacktrace_builder:, mechanism:)
|
|
30
|
+
def self.build(exception:, stacktrace_builder:, mechanism:, data_collection:)
|
|
30
31
|
exceptions = Sentry::Utils::ExceptionCauseChain.exception_to_array(exception).reverse
|
|
31
32
|
processed_backtrace_ids = Set.new
|
|
32
33
|
|
|
33
34
|
exceptions = exceptions.map do |e|
|
|
34
35
|
if e.backtrace && !processed_backtrace_ids.include?(e.backtrace.object_id)
|
|
35
36
|
processed_backtrace_ids << e.backtrace.object_id
|
|
36
|
-
SingleExceptionInterface.build_with_stacktrace(
|
|
37
|
+
SingleExceptionInterface.build_with_stacktrace(
|
|
38
|
+
exception: e,
|
|
39
|
+
stacktrace_builder: stacktrace_builder,
|
|
40
|
+
mechanism: mechanism,
|
|
41
|
+
data_collection: data_collection
|
|
42
|
+
)
|
|
37
43
|
else
|
|
38
44
|
SingleExceptionInterface.new(exception: exception, mechanism: mechanism)
|
|
39
45
|
end
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
3
5
|
module Sentry
|
|
4
6
|
class RequestInterface < Interface
|
|
5
7
|
REQUEST_ID_HEADERS = %w[action_dispatch.request_id HTTP_X_REQUEST_ID].freeze
|
|
6
8
|
CONTENT_HEADERS = %w[CONTENT_TYPE CONTENT_LENGTH].freeze
|
|
7
|
-
IP_HEADERS = [
|
|
8
|
-
"REMOTE_ADDR",
|
|
9
|
-
"HTTP_CLIENT_IP",
|
|
10
|
-
"HTTP_X_REAL_IP",
|
|
11
|
-
"HTTP_X_FORWARDED_FOR"
|
|
12
|
-
].freeze
|
|
13
9
|
|
|
14
10
|
# Regex to detect lowercase chars — match? is allocation-free (no MatchData/String)
|
|
15
11
|
LOWERCASE_PATTERN = /[a-z]/.freeze
|
|
@@ -27,10 +23,10 @@ module Sentry
|
|
|
27
23
|
# @return [Hash]
|
|
28
24
|
attr_accessor :data
|
|
29
25
|
|
|
30
|
-
# @return [String]
|
|
26
|
+
# @return [String, Hash]
|
|
31
27
|
attr_accessor :query_string
|
|
32
28
|
|
|
33
|
-
# @return [
|
|
29
|
+
# @return [Hash]
|
|
34
30
|
attr_accessor :cookies
|
|
35
31
|
|
|
36
32
|
# @return [Hash]
|
|
@@ -40,33 +36,22 @@ module Sentry
|
|
|
40
36
|
attr_accessor :env
|
|
41
37
|
|
|
42
38
|
# @param env [Hash]
|
|
43
|
-
# @param
|
|
39
|
+
# @param data_collection [DataCollection]
|
|
44
40
|
# @param rack_env_whitelist [Array]
|
|
45
|
-
# @see Configuration#
|
|
41
|
+
# @see Configuration#data_collection
|
|
46
42
|
# @see Configuration#rack_env_whitelist
|
|
47
|
-
def initialize(env:,
|
|
43
|
+
def initialize(env:, data_collection:, rack_env_whitelist:)
|
|
48
44
|
env = env.dup
|
|
49
|
-
|
|
50
|
-
unless send_default_pii
|
|
51
|
-
# need to completely wipe out ip addresses
|
|
52
|
-
RequestInterface::IP_HEADERS.each do |header|
|
|
53
|
-
env.delete(header)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
45
|
request = ::Rack::Request.new(env)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
self.
|
|
66
|
-
self.
|
|
67
|
-
|
|
68
|
-
self.headers = filter_and_format_headers(env, send_default_pii)
|
|
69
|
-
self.env = filter_and_format_env(env, rack_env_whitelist)
|
|
46
|
+
query = data_collection.url_query_params.filter(request.GET) rescue nil
|
|
47
|
+
|
|
48
|
+
self.method = request.request_method
|
|
49
|
+
self.url = request.scheme && request.url.split("?").first
|
|
50
|
+
self.query_string = query unless query&.empty?
|
|
51
|
+
self.cookies = data_collection.cookies.filter(request.cookies, cookie: true)
|
|
52
|
+
self.data = read_data_from(request) if data_collection.collect_incoming_http_body?
|
|
53
|
+
self.headers = filter_and_format_headers(env, data_collection.http_headers.request)
|
|
54
|
+
self.env = filter_and_format_env(env, data_collection.http_headers.request, rack_env_whitelist)
|
|
70
55
|
end
|
|
71
56
|
|
|
72
57
|
private
|
|
@@ -75,25 +60,31 @@ module Sentry
|
|
|
75
60
|
return "Skipped non-rewindable request body" unless request.body.respond_to?(:rewind)
|
|
76
61
|
|
|
77
62
|
if request.form_data?
|
|
78
|
-
request.POST
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
DataCollection.filter(request.POST)
|
|
64
|
+
else
|
|
65
|
+
body = request.body.read(MAX_BODY_LIMIT)
|
|
66
|
+
body = Utils::EncodingHelper.encode_to_utf_8(body.to_s)
|
|
67
|
+
|
|
68
|
+
if request.media_type == "application/json" || request.media_type&.end_with?("+json")
|
|
69
|
+
parsed_body = JSON.parse(body)
|
|
70
|
+
parsed_body.is_a?(Hash) ? DataCollection.filter(parsed_body) : parsed_body
|
|
71
|
+
else
|
|
72
|
+
body
|
|
73
|
+
end
|
|
84
74
|
end
|
|
85
|
-
rescue IOError => e
|
|
75
|
+
rescue JSON::ParserError, IOError => e
|
|
86
76
|
e.message
|
|
77
|
+
ensure
|
|
78
|
+
request.body.rewind if request.body.respond_to?(:rewind)
|
|
87
79
|
end
|
|
88
80
|
|
|
89
|
-
def filter_and_format_headers(env,
|
|
81
|
+
def filter_and_format_headers(env, collection)
|
|
90
82
|
env.each_with_object({}) do |(key, value), memo|
|
|
91
83
|
begin
|
|
92
84
|
key = key.to_s # rack env can contain symbols
|
|
93
85
|
next memo["X-Request-Id"] ||= Utils::RequestId.read_from(env) if Utils::RequestId::REQUEST_ID_HEADERS.include?(key)
|
|
94
86
|
next if is_server_protocol?(key, value, env["SERVER_PROTOCOL"])
|
|
95
87
|
next if is_skippable_header?(key)
|
|
96
|
-
next if key == "HTTP_AUTHORIZATION" && !send_default_pii
|
|
97
88
|
|
|
98
89
|
# Rack stores headers as HTTP_WHAT_EVER, we need What-Ever
|
|
99
90
|
key = key.delete_prefix("HTTP_")
|
|
@@ -107,12 +98,13 @@ module Sentry
|
|
|
107
98
|
Sentry.sdk_logger.warn(LOGGER_PROGNAME) { "Error raised while formatting headers: #{e.message}" }
|
|
108
99
|
next
|
|
109
100
|
end
|
|
101
|
+
end.then do |e|
|
|
102
|
+
collection.filter(e)
|
|
110
103
|
end
|
|
111
104
|
end
|
|
112
105
|
|
|
113
106
|
def is_skippable_header?(key)
|
|
114
107
|
key.match?(LOWERCASE_PATTERN) || # lower-case envs aren't real http headers
|
|
115
|
-
key == "HTTP_COOKIE" || # Cookies don't go here, they go somewhere else
|
|
116
108
|
!(key.start_with?("HTTP_") || CONTENT_HEADERS.include?(key))
|
|
117
109
|
end
|
|
118
110
|
|
|
@@ -134,11 +126,15 @@ module Sentry
|
|
|
134
126
|
Gem::Version.new(::Rack.release) >= Gem::Version.new("3.0")
|
|
135
127
|
end
|
|
136
128
|
|
|
137
|
-
def filter_and_format_env(env, rack_env_whitelist)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
def filter_and_format_env(env, collection, rack_env_whitelist)
|
|
130
|
+
if rack_env_whitelist.empty?
|
|
131
|
+
env
|
|
132
|
+
else
|
|
133
|
+
env.select do |k, _v|
|
|
134
|
+
rack_env_whitelist.include? k.to_s
|
|
135
|
+
end
|
|
136
|
+
end.then do |e|
|
|
137
|
+
collection.filter(e)
|
|
142
138
|
end
|
|
143
139
|
end
|
|
144
140
|
end
|
|
@@ -41,7 +41,7 @@ module Sentry
|
|
|
41
41
|
|
|
42
42
|
# patch this method if you want to change an exception's stacktrace frames
|
|
43
43
|
# also see `StacktraceBuilder.build`.
|
|
44
|
-
def self.build_with_stacktrace(exception:, stacktrace_builder:, mechanism:)
|
|
44
|
+
def self.build_with_stacktrace(exception:, stacktrace_builder:, mechanism:, data_collection:)
|
|
45
45
|
stacktrace = stacktrace_builder.build(backtrace: exception.backtrace)
|
|
46
46
|
|
|
47
47
|
if locals = exception.instance_variable_get(:@sentry_locals)
|
|
@@ -60,7 +60,7 @@ module Sentry
|
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
stacktrace.frames.last&.vars = locals
|
|
63
|
+
stacktrace.frames.last&.vars = data_collection.stack_frame_variables.filter(locals)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
new(exception: exception, stacktrace: stacktrace, mechanism: mechanism)
|
data/lib/sentry/net/http.rb
CHANGED
|
@@ -72,10 +72,9 @@ module Sentry
|
|
|
72
72
|
|
|
73
73
|
result = { method: req.method, url: url }
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
end
|
|
75
|
+
query = filter_query_params(uri.query)
|
|
76
|
+
result[:query] = query if query
|
|
77
|
+
result[:body] = req.body if Sentry.configuration.data_collection.collect_outgoing_http_body?
|
|
79
78
|
|
|
80
79
|
result
|
|
81
80
|
end
|
data/lib/sentry/redis.rb
CHANGED
|
@@ -62,7 +62,7 @@ module Sentry
|
|
|
62
62
|
command_set = { command: command.to_s.upcase }
|
|
63
63
|
command_set[:key] = key if Utils::EncodingHelper.valid_utf_8?(key)
|
|
64
64
|
|
|
65
|
-
if Sentry.configuration.
|
|
65
|
+
if Sentry.configuration.data_collection.database_query_data
|
|
66
66
|
command_set[:arguments] = arguments
|
|
67
67
|
.select { |a| Utils::EncodingHelper.valid_utf_8?(a) }
|
|
68
68
|
.join(" ")
|
|
@@ -50,10 +50,6 @@ module Sentry
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
Sentry.register_patch(:logger) do
|
|
54
|
-
|
|
55
|
-
::Logger.prepend(Sentry::StdLibLogger)
|
|
56
|
-
else
|
|
57
|
-
config.sdk_logger.warn(":logger patch enabled but `enable_logs` is turned off - skipping applying patch")
|
|
58
|
-
end
|
|
53
|
+
Sentry.register_patch(:logger) do
|
|
54
|
+
::Logger.prepend(Sentry::StdLibLogger)
|
|
59
55
|
end
|
data/lib/sentry/test_helper.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Sentry
|
|
|
33
33
|
dummy_config.background_worker_threads = 0
|
|
34
34
|
|
|
35
35
|
# user can overwrite some of the configs, with a few exceptions like:
|
|
36
|
-
# -
|
|
36
|
+
# - data_collection
|
|
37
37
|
# - auto_session_tracking
|
|
38
38
|
block&.call(dummy_config)
|
|
39
39
|
|
|
@@ -90,9 +90,7 @@ module Sentry
|
|
|
90
90
|
transport.clear if transport.respond_to?(:clear)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
sentry_logger.clear
|
|
95
|
-
end
|
|
93
|
+
sentry_logger.clear if sentry_logger.respond_to?(:clear)
|
|
96
94
|
end
|
|
97
95
|
|
|
98
96
|
# @return [Sentry::StructuredLogger, Sentry::DebugStructuredLogger]
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "uri"
|
|
4
|
+
|
|
3
5
|
module Sentry
|
|
4
6
|
module Utils
|
|
5
7
|
module HttpTracing
|
|
8
|
+
def filter_query_params(query)
|
|
9
|
+
return nil unless query
|
|
10
|
+
return nil unless query.is_a?(String) || query.is_a?(Hash)
|
|
11
|
+
|
|
12
|
+
query_hash = if query.is_a?(String)
|
|
13
|
+
URI.decode_www_form(query).each_with_object({}) do |(key, value), params|
|
|
14
|
+
params[key] = params.key?(key) ? Array(params[key]) + [value] : value
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
query
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
filtered_query_hash = Sentry.configuration.data_collection.url_query_params.filter(query_hash)
|
|
21
|
+
return nil if filtered_query_hash.empty?
|
|
22
|
+
|
|
23
|
+
HttpTracing.format_query(filtered_query_hash)
|
|
24
|
+
rescue
|
|
25
|
+
nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.format_query(query)
|
|
29
|
+
query.flat_map do |key, value|
|
|
30
|
+
Array(value).map { |item| "#{key}=#{item}" }
|
|
31
|
+
end.join("&")
|
|
32
|
+
end
|
|
33
|
+
|
|
6
34
|
def set_span_info(sentry_span, request_info, response_status)
|
|
7
35
|
sentry_span.set_description("#{request_info[:method]} #{request_info[:url]}")
|
|
8
|
-
sentry_span.set_data(Span::DataConventions::URL, request_info
|
|
36
|
+
sentry_span.set_data(Span::DataConventions::URL, url_with_query(request_info))
|
|
9
37
|
sentry_span.set_data(Span::DataConventions::HTTP_METHOD, request_info[:method])
|
|
10
38
|
sentry_span.set_data(Span::DataConventions::HTTP_QUERY, request_info[:query]) if request_info[:query]
|
|
11
39
|
sentry_span.set_data(Span::DataConventions::HTTP_STATUS_CODE, response_status)
|
|
@@ -43,37 +71,25 @@ module Sentry
|
|
|
43
71
|
Sentry.configuration.trace_propagation_targets.any? { |target| url.match?(target) }
|
|
44
72
|
end
|
|
45
73
|
|
|
46
|
-
# Kindly borrowed from Rack::Utils
|
|
47
|
-
def build_nested_query(value, prefix = nil)
|
|
48
|
-
case value
|
|
49
|
-
when Array
|
|
50
|
-
value.map { |v|
|
|
51
|
-
build_nested_query(v, "#{prefix}[]")
|
|
52
|
-
}.join("&")
|
|
53
|
-
when Hash
|
|
54
|
-
value.map { |k, v|
|
|
55
|
-
build_nested_query(v, prefix ? "#{prefix}[#{k}]" : k)
|
|
56
|
-
}.delete_if(&:empty?).join("&")
|
|
57
|
-
when nil
|
|
58
|
-
URI.encode_www_form_component(prefix)
|
|
59
|
-
else
|
|
60
|
-
raise ArgumentError, "value must be a Hash" if prefix.nil?
|
|
61
|
-
"#{URI.encode_www_form_component(prefix)}=#{URI.encode_www_form_component(value)}"
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
74
|
|
|
65
75
|
private
|
|
66
76
|
|
|
77
|
+
def url_with_query(request_info)
|
|
78
|
+
return request_info[:url] unless request_info[:query]
|
|
79
|
+
|
|
80
|
+
"#{request_info[:url]}?#{request_info[:query]}"
|
|
81
|
+
end
|
|
82
|
+
|
|
67
83
|
def get_level(status)
|
|
68
84
|
return :info unless status && status.is_a?(Integer)
|
|
69
85
|
|
|
70
|
-
if status >= 500
|
|
71
|
-
|
|
72
|
-
elsif status >= 400
|
|
73
|
-
|
|
74
|
-
else
|
|
75
|
-
|
|
76
|
-
end
|
|
86
|
+
if status >= 500
|
|
87
|
+
:error
|
|
88
|
+
elsif status >= 400
|
|
89
|
+
:warning
|
|
90
|
+
else
|
|
91
|
+
:info
|
|
92
|
+
end
|
|
77
93
|
end
|
|
78
94
|
end
|
|
79
95
|
end
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
|
@@ -277,7 +277,7 @@ module Sentry
|
|
|
277
277
|
@background_worker = Sentry::BackgroundWorker.new(config)
|
|
278
278
|
@session_flusher = config.session_tracking? ? Sentry::SessionFlusher.new(config, client) : nil
|
|
279
279
|
@backpressure_monitor = config.enable_backpressure_handling ? Sentry::BackpressureMonitor.new(config, client) : nil
|
|
280
|
-
exception_locals_tp.enable if config.
|
|
280
|
+
exception_locals_tp.enable if config.data_collection.collect_stack_frame_variables?
|
|
281
281
|
at_exit { close }
|
|
282
282
|
end
|
|
283
283
|
|
|
@@ -301,7 +301,7 @@ module Sentry
|
|
|
301
301
|
client.configuration.run_after_close_callbacks
|
|
302
302
|
client.flush
|
|
303
303
|
|
|
304
|
-
if client.configuration.
|
|
304
|
+
if client.configuration.data_collection.collect_stack_frame_variables?
|
|
305
305
|
exception_locals_tp.disable
|
|
306
306
|
end
|
|
307
307
|
end
|
|
@@ -527,7 +527,7 @@ module Sentry
|
|
|
527
527
|
# Sentry.capture_log("User logged in", level: :info, user_id: 123)
|
|
528
528
|
#
|
|
529
529
|
# @see https://develop.sentry.dev/sdk/telemetry/logs/ Sentry SDK Telemetry Logs Protocol
|
|
530
|
-
# @return [LogEvent, nil] The created log event or nil if
|
|
530
|
+
# @return [LogEvent, nil] The created log event or nil if Sentry is not initialized
|
|
531
531
|
def capture_log(message, **options)
|
|
532
532
|
return unless initialized?
|
|
533
533
|
get_current_hub.capture_log_event(message, **options)
|
|
@@ -639,14 +639,6 @@ module Sentry
|
|
|
639
639
|
|
|
640
640
|
# Returns the structured logger instance that implements Sentry's SDK telemetry logs protocol.
|
|
641
641
|
#
|
|
642
|
-
# This logger is only available when logs are enabled in the configuration.
|
|
643
|
-
#
|
|
644
|
-
# @example Enable logs in configuration
|
|
645
|
-
# Sentry.init do |config|
|
|
646
|
-
# config.dsn = "YOUR_DSN"
|
|
647
|
-
# config.enable_logs = true
|
|
648
|
-
# end
|
|
649
|
-
#
|
|
650
642
|
# @example Basic usage
|
|
651
643
|
# Sentry.logger.info("User logged in successfully", user_id: 123)
|
|
652
644
|
# Sentry.logger.error("Failed to process payment",
|
|
@@ -656,19 +648,13 @@ module Sentry
|
|
|
656
648
|
#
|
|
657
649
|
# @see https://develop.sentry.dev/sdk/telemetry/logs/ Sentry SDK Telemetry Logs Protocol
|
|
658
650
|
#
|
|
659
|
-
# @return [StructuredLogger] The structured logger instance
|
|
651
|
+
# @return [StructuredLogger] The structured logger instance
|
|
660
652
|
def logger
|
|
661
653
|
@logger ||= configuration.structured_logging.logger_class.new(configuration)
|
|
662
654
|
end
|
|
663
655
|
|
|
664
656
|
# Returns the metrics API for capturing custom metrics.
|
|
665
657
|
#
|
|
666
|
-
# @example Enable metrics
|
|
667
|
-
# Sentry.init do |config|
|
|
668
|
-
# config.dsn = "YOUR_DSN"
|
|
669
|
-
# config.enable_metrics = true
|
|
670
|
-
# end
|
|
671
|
-
#
|
|
672
658
|
# @example Usage
|
|
673
659
|
# Sentry.metrics.count("button.click", 1, attributes: { button_id: "submit" })
|
|
674
660
|
# Sentry.metrics.distribution("response.time", 120.5, unit: "millisecond")
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sentry-ruby-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 7.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sentry Team
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 7.0.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 7.0.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: concurrent-ruby
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -105,6 +105,8 @@ files:
|
|
|
105
105
|
- lib/sentry/cron/monitor_check_ins.rb
|
|
106
106
|
- lib/sentry/cron/monitor_config.rb
|
|
107
107
|
- lib/sentry/cron/monitor_schedule.rb
|
|
108
|
+
- lib/sentry/data_collection.rb
|
|
109
|
+
- lib/sentry/data_collection/key_value_collection.rb
|
|
108
110
|
- lib/sentry/debug_structured_logger.rb
|
|
109
111
|
- lib/sentry/dsn.rb
|
|
110
112
|
- lib/sentry/envelope.rb
|