-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump sentry-ruby from 5.21.0 to 5.22.0 #697
Open
dependabot
wants to merge
1
commit into
main
Choose a base branch
from
dependabot/bundler/sentry-ruby-5.22.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [sentry-ruby](https://github.com/getsentry/sentry-ruby) from 5.21.0 to 5.22.0. - [Release notes](https://github.com/getsentry/sentry-ruby/releases) - [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md) - [Commits](getsentry/sentry-ruby@5.21.0...5.22.0) --- updated-dependencies: - dependency-name: sentry-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
gem compare sentry-ruby 5.21.0 5.22.0 Compared versions: ["5.21.0", "5.22.0"]
DIFFERENT date:
5.21.0: 2024-10-07 00:00:00 UTC
5.22.0: 2024-12-04 00:00:00 UTC
DIFFERENT homepage:
5.21.0: https://github.com/getsentry/sentry-ruby/tree/5.21.0/sentry-ruby
5.22.0: https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-ruby
DIFFERENT metadata:
5.21.0: {"homepage_uri"=>"https://github.com/getsentry/sentry-ruby/tree/5.21.0/sentry-ruby", "source_code_uri"=>"https://github.com/getsentry/sentry-ruby/tree/5.21.0/sentry-ruby", "changelog_uri"=>"https://github.com/getsentry/sentry-ruby/blob/5.21.0/CHANGELOG.md", "bug_tracker_uri"=>"https://github.com/getsentry/sentry-ruby/issues", "documentation_uri"=>"http://www.rubydoc.info/gems/sentry-ruby/5.21.0"}
5.22.0: {"homepage_uri"=>"https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-ruby", "source_code_uri"=>"https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-ruby", "changelog_uri"=>"https://github.com/getsentry/sentry-ruby/blob/5.22.0/CHANGELOG.md", "bug_tracker_uri"=>"https://github.com/getsentry/sentry-ruby/issues", "documentation_uri"=>"http://www.rubydoc.info/gems/sentry-ruby/5.22.0"}
DIFFERENT rubygems_version:
5.21.0: 3.5.16
5.22.0: 3.5.22
DIFFERENT version:
5.21.0: 5.21.0
5.22.0: 5.22.0
DIFFERENT files:
5.21.0->5.22.0:
* Added:
lib/sentry/excon.rb +10/-0
lib/sentry/excon/middleware.rb +77/-0
lib/sentry/rspec.rb +91/-0
* Changed:
Gemfile +1/-0
lib/sentry-ruby.rb +8/-3
lib/sentry/session_flusher.rb +8/-4
lib/sentry/utils/http_tracing.rb +20/-1
lib/sentry/vernier/profiler.rb +7/-2
lib/sentry/version.rb +1/-1
DIFFERENT Gemfile dependencies
5.21.0->5.22.0:
* Added:
excon [">= 0"] (runtime) |
gem compare --diff sentry-ruby 5.21.0 5.22.0 Compared versions: ["5.21.0", "5.22.0"]
DIFFERENT files:
5.21.0->5.22.0:
* Added:
lib/sentry/excon.rb
--- /tmp/20241205-2248-hzkmd7 2024-12-05 03:55:37.844828323 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/excon.rb 2024-12-05 03:55:37.836828271 +0000
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+Sentry.register_patch(:excon) do
+ if defined?(::Excon)
+ require "sentry/excon/middleware"
+ if Excon.defaults[:middlewares]
+ Excon.defaults[:middlewares] << Sentry::Excon::Middleware unless Excon.defaults[:middlewares].include?(Sentry::Excon::Middleware)
+ end
+ end
+end
lib/sentry/excon/middleware.rb
--- /tmp/20241205-2248-oi901p 2024-12-05 03:55:37.848828348 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/excon/middleware.rb 2024-12-05 03:55:37.836828271 +0000
@@ -0,0 +1,77 @@
+# frozen_string_literal: true
+
+module Sentry
+ module Excon
+ OP_NAME = "http.client"
+
+ class Middleware < ::Excon::Middleware::Base
+ def initialize(stack)
+ super
+ @instrumenter = Instrumenter.new
+ end
+
+ def request_call(datum)
+ @instrumenter.start_transaction(datum)
+ @stack.request_call(datum)
+ end
+
+ def response_call(datum)
+ @instrumenter.finish_transaction(datum)
+ @stack.response_call(datum)
+ end
+ end
+
+ class Instrumenter
+ SPAN_ORIGIN = "auto.http.excon"
+ BREADCRUMB_CATEGORY = "http"
+
+ include Utils::HttpTracing
+
+ def start_transaction(env)
+ return unless Sentry.initialized?
+
+ current_span = Sentry.get_current_scope&.span
+ @span = current_span&.start_child(op: OP_NAME, start_timestamp: Sentry.utc_now.to_f, origin: SPAN_ORIGIN)
+
+ request_info = extract_request_info(env)
+
+ if propagate_trace?(request_info[:url])
+ set_propagation_headers(env[:headers])
+ end
+ end
+
+ def finish_transaction(response)
+ return unless @span
+
+ response_status = response[:response][:status]
+ request_info = extract_request_info(response)
+
+ if record_sentry_breadcrumb?
+ record_sentry_breadcrumb(request_info, response_status)
+ end
+
+ set_span_info(@span, request_info, response_status)
+ ensure
+ @span&.finish
+ end
+
+ private
+
+ def extract_request_info(env)
+ url = env[:scheme] + "://" + env[:hostname] + env[:path]
+ result = { method: env[:method].to_s.upcase, url: url }
+
+ if Sentry.configuration.send_default_pii
+ result[:query] = env[:query]
+
+ # Handle excon 1.0.0+
+ result[:query] = build_nested_query(result[:query]) unless result[:query].is_a?(String)
+
+ result[:body] = env[:body]
+ end
+
+ result
+ end
+ end
+ end
+end
lib/sentry/rspec.rb
--- /tmp/20241205-2248-9zzo9z 2024-12-05 03:55:37.848828348 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/rspec.rb 2024-12-05 03:55:37.840828297 +0000
@@ -0,0 +1,91 @@
+# frozen_string_literal: true
+
+RSpec::Matchers.define :include_sentry_event do |event_message = "", **opts|
+ match do |sentry_events|
+ @expected_exception = expected_exception(**opts)
+ @context = context(**opts)
+ @tags = tags(**opts)
+
+ @expected_event = expected_event(event_message)
+ @matched_event = find_matched_event(event_message, sentry_events)
+
+ return false unless @matched_event
+
+ [verify_context(), verify_tags()].all?
+ end
+
+ chain :with_context do |context|
+ @context = context
+ end
+
+ chain :with_tags do |tags|
+ @tags = tags
+ end
+
+ failure_message do |sentry_events|
+ info = ["Failed to find event matching:\n"]
+ info << " message: #{@expected_event.message.inspect}"
+ info << " exception: #{@expected_exception.inspect}"
+ info << " context: #{@context.inspect}"
+ info << " tags: #{@tags.inspect}"
+ info << "\n"
+ info << "Captured events:\n"
+ info << dump_events(sentry_events)
+ info.join("\n")
+ end
+
+ def expected_event(event_message)
+ if @expected_exception
+ Sentry.get_current_client.event_from_exception(@expected_exception)
+ else
+ Sentry.get_current_client.event_from_message(event_message)
+ end
+ end
+
+ def expected_exception(**opts)
+ opts[:exception].new(opts[:message]) if opts[:exception]
+ end
+
+ def context(**opts)
+ opts.fetch(:context, @context || {})
+ end
+
+ def tags(**opts)
+ opts.fetch(:tags, @tags || {})
+ end
+
+ def find_matched_event(event_message, sentry_events)
+ @matched_event ||= sentry_events
+ .find { |event|
+ if @expected_exception
+ # Is it OK that we only compare the first exception?
+ event_exception = event.exception.values.first
+ expected_event_exception = @expected_event.exception.values.first
+
+ event_exception.type == expected_event_exception.type && event_exception.value == expected_event_exception.value
+ else
+ event.message == @expected_event.message
+ end
+ }
+ end
+
+ def dump_events(sentry_events)
+ sentry_events.map(&Kernel.method(:Hash)).map do |hash|
+ hash.select { |k, _| [:message, :contexts, :tags, :exception].include?(k) }
+ end.map do |hash|
+ JSON.pretty_generate(hash)
+ end.join("\n\n")
+ end
+
+ def verify_context
+ return true if @context.empty?
+
+ @matched_event.contexts.any? { |key, value| value == @context[key] }
+ end
+
+ def verify_tags
+ return true if @tags.empty?
+
+ @tags.all? { |key, value| @matched_event.tags.include?(key) && @matched_event.tags[key] == value }
+ end
+end
* Changed:
Gemfile
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/Gemfile 2024-12-05 03:55:37.700827387 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/Gemfile 2024-12-05 03:55:37.832828244 +0000
@@ -30,0 +31 @@
+gem "excon"
lib/sentry-ruby.rb
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/lib/sentry-ruby.rb 2024-12-05 03:55:37.704827413 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry-ruby.rb 2024-12-05 03:55:37.832828244 +0000
@@ -52,0 +53,2 @@
+ MUTEX = Mutex.new
+
@@ -278,2 +280,4 @@
- @main_hub = nil
- Thread.current.thread_variable_set(THREAD_LOCAL, nil)
+ MUTEX.synchronize do
+ @main_hub = nil
+ Thread.current.thread_variable_set(THREAD_LOCAL, nil)
+ end
@@ -306 +310 @@
- @main_hub
+ MUTEX.synchronize { @main_hub }
@@ -612,0 +617 @@
+require "sentry/excon"
lib/sentry/session_flusher.rb
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/lib/sentry/session_flusher.rb 2024-12-05 03:55:37.828828219 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/session_flusher.rb 2024-12-05 03:55:37.840828297 +0000
@@ -12,0 +13 @@
+ @mutex = Mutex.new
@@ -21 +21,0 @@
- @pending_aggregates = {}
@@ -45 +45,5 @@
- envelope = Envelope.new
+ aggregates = @mutex.synchronize do
+ aggregates = @pending_aggregates.values
+ @pending_aggregates = {}
+ aggregates
+ end
@@ -46,0 +51 @@
+ envelope = Envelope.new
@@ -48,2 +53 @@
- payload = { attrs: attrs, aggregates: @pending_aggregates.values }
-
+ payload = { attrs: attrs, aggregates: aggregates }
lib/sentry/utils/http_tracing.rb
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/lib/sentry/utils/http_tracing.rb 2024-12-05 03:55:37.828828219 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/utils/http_tracing.rb 2024-12-05 03:55:37.844828323 +0000
@@ -22 +22 @@
- type: :info,
+ type: "info",
@@ -37,0 +38,19 @@
+ end
+
+ # Kindly borrowed from Rack::Utils
+ def build_nested_query(value, prefix = nil)
+ case value
+ when Array
+ value.map { |v|
+ build_nested_query(v, "#{prefix}[]")
+ }.join("&")
+ when Hash
+ value.map { |k, v|
+ build_nested_query(v, prefix ? "#{prefix}[#{k}]" : k)
+ }.delete_if(&:empty?).join("&")
+ when nil
+ URI.encode_www_form_component(prefix)
+ else
+ raise ArgumentError, "value must be a Hash" if prefix.nil?
+ "#{URI.encode_www_form_component(prefix)}=#{URI.encode_www_form_component(value)}"
+ end
lib/sentry/vernier/profiler.rb
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/lib/sentry/vernier/profiler.rb 2024-12-05 03:55:37.832828244 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/vernier/profiler.rb 2024-12-05 03:55:37.844828323 +0000
@@ -58,2 +58 @@
- ::Vernier.start_profile
- @started = true
+ @started = ::Vernier.start_profile
@@ -79,0 +79,6 @@
+ rescue RuntimeError => e
+ if e.message.include?("Profile not started")
+ log("Not stopped since not started")
+ else
+ log("Failed to stop Vernier: #{e.message}")
+ end
lib/sentry/version.rb
--- /tmp/d20241205-2248-ze1501/sentry-ruby-5.21.0/lib/sentry/version.rb 2024-12-05 03:55:37.832828244 +0000
+++ /tmp/d20241205-2248-ze1501/sentry-ruby-5.22.0/lib/sentry/version.rb 2024-12-05 03:55:37.844828323 +0000
@@ -4 +4 @@
- VERSION = "5.21.0"
+ VERSION = "5.22.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps sentry-ruby from 5.21.0 to 5.22.0.
Changelog
Sourced from sentry-ruby's changelog.
Commits
2932e83
release: 5.22.0f225138
Add mutex sync to SessionFlusher aggregates (#2469)a9b3687
Add Excon instrumentation (#2383)5de4ebc
Fix the build (#2463)957c8d6
Make Sentry.{close,get_main_hub} thread-safe (#2436)f3ed31e
Fix issues with stopping Vernier (#2429)499cbac
RSpec matchers (#2424)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)