Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 9, 2025

Bumps sentry-ruby from 5.26.0 to 5.27.0.

Changelog

Sourced from sentry-ruby's changelog.

5.27.0

Feature

  • Propagated sampling rates as specified in Traces docs (#2671)

  • Support for Rails ActiveSupport log subscribers (#2690)

  • Support for defining custom Rails log subscribers that work with Sentry Structured Logging (#2689)

    Rails applications can now define custom log subscribers that integrate with Sentry's structured logging system. The feature includes built-in subscribers for ActionController, ActiveRecord, ActiveJob, and ActionMailer events, with automatic parameter filtering that respects Rails' config.filter_parameters configuration.

    To enable structured logging with Rails log subscribers:

    Sentry.init do |config|
      # ... your setup ...
    Make sure structured logging is enabled
    config.enable_logs = true
    Enable default Rails log subscribers (ActionController and ActiveRecord)
    config.rails.structured_logging.enabled = true
    end

    To configure all subscribers:

    Sentry.init do |config|
      # ... your setup ...
    Make sure structured logging is enabled
    config.enable_logs = true
    Enable Rails log subscribers
    config.rails.structured_logging.enabled = true
    Add ActionMailer and ActiveJob subscribers
    config.rails.structured_logging.subscribers.update(
    action_mailer: Sentry::Rails::LogSubscribers::ActionMailerSubscriber,
    active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber
    )
    end

    You can also define custom log subscribers by extending the base class:

    class MyCustomSubscriber < Sentry::Rails::LogSubscriber
      attach_to :my_component

... (truncated)

Commits

Dependabot compatibility score

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)

Bumps [sentry-ruby](https://github.com/getsentry/sentry-ruby) from 5.26.0 to 5.27.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.26.0...5.27.0)

---
updated-dependencies:
- dependency-name: sentry-ruby
  dependency-version: 5.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies ruby Pull requests that update Ruby code labels Sep 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

gem compare bigdecimal 3.2.2 3.2.3

Compared versions: ["3.2.2", "3.2.3"]
  DIFFERENT require_paths:
    3.2.2: ["/opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-3.2.2", "lib"]
    3.2.3: ["/opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-3.2.3", "lib"]
  DIFFERENT version:
    3.2.2: 3.2.2
    3.2.3: 3.2.3
  DIFFERENT files:
    3.2.2->3.2.3:
      * Changed:
            ext/bigdecimal/bigdecimal.c +704/-2252
            ext/bigdecimal/bigdecimal.h +4/-25
            ext/bigdecimal/bits.h +3/-0
            ext/bigdecimal/extconf.rb +3/-7
            ext/bigdecimal/missing.h +1/-93
            lib/bigdecimal.rb +324/-0
            lib/bigdecimal/math.rb +9/-6

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

gem compare --diff bigdecimal 3.2.2 3.2.3

Diff too large (175486 chars)

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

gem compare sentry-ruby 5.26.0 5.27.0

Compared versions: ["5.26.0", "5.27.0"]
  DIFFERENT homepage:
    5.26.0: https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby
    5.27.0: https://github.com/getsentry/sentry-ruby/tree/5.27.0/sentry-ruby
  DIFFERENT metadata:
    5.26.0: {"homepage_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby", "source_code_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby", "changelog_uri" => "https://github.com/getsentry/sentry-ruby/blob/5.26.0/CHANGELOG.md", "bug_tracker_uri" => "https://github.com/getsentry/sentry-ruby/issues", "documentation_uri" => "http://www.rubydoc.info/gems/sentry-ruby/5.26.0"}
    5.27.0: {"homepage_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.27.0/sentry-ruby", "source_code_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.27.0/sentry-ruby", "changelog_uri" => "https://github.com/getsentry/sentry-ruby/blob/5.27.0/CHANGELOG.md", "bug_tracker_uri" => "https://github.com/getsentry/sentry-ruby/issues", "documentation_uri" => "http://www.rubydoc.info/gems/sentry-ruby/5.27.0"}
  DIFFERENT rubygems_version:
    5.26.0: 3.6.7
    5.27.0: 3.6.9
  DIFFERENT version:
    5.26.0: 5.26.0
    5.27.0: 5.27.0
  DIFFERENT files:
    5.26.0->5.27.0:
      * Added:
            lib/sentry/debug_structured_logger.rb +94/-0
            lib/sentry/transport/debug_transport.rb +70/-0
            lib/sentry/utils/sample_rand.rb +97/-0
      * Changed:
            Gemfile +1/-3
            lib/sentry-ruby.rb +6/-2
            lib/sentry/configuration.rb +26/-0
            lib/sentry/dsn.rb +32/-0
            lib/sentry/hub.rb +3/-1
            lib/sentry/log_event.rb +1/-1
            lib/sentry/propagation_context.rb +55/-18
            lib/sentry/test_helper.rb +22/-0
            lib/sentry/transaction.rb +29/-1
            lib/sentry/transport.rb +1/-0
            lib/sentry/transport/dummy_transport.rb +1/-0
            lib/sentry/transport/http_transport.rb +9/-5
            lib/sentry/version.rb +1/-1

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

gem compare --diff sentry-ruby 5.26.0 5.27.0

Compared versions: ["5.26.0", "5.27.0"]
  DIFFERENT files:
    5.26.0->5.27.0:
      * Added:
        lib/sentry/debug_structured_logger.rb
                --- /tmp/20250909-2813-42h9q9	2025-09-09 02:02:14.034594875 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/debug_structured_logger.rb	2025-09-09 02:02:14.023594918 +0000
                @@ -0,0 +1,94 @@
                +# frozen_string_literal: true
                +
                +require "json"
                +require "fileutils"
                +require "pathname"
                +require "delegate"
                +
                +module Sentry
                +  # DebugStructuredLogger is a logger that captures structured log events to a file for debugging purposes.
                +  #
                +  # It can optionally also send log events to Sentry via the normal structured logger if logging
                +  # is enabled.
                +  class DebugStructuredLogger < SimpleDelegator
                +    DEFAULT_LOG_FILE_PATH = File.join("log", "sentry_debug_logs.log")
                +
                +    attr_reader :log_file, :backend
                +
                +    def initialize(configuration)
                +      @log_file = initialize_log_file(
                +        configuration.structured_logging.file_path || DEFAULT_LOG_FILE_PATH
                +      )
                +      @backend = initialize_backend(configuration)
                +
                +      super(@backend)
                +    end
                +
                +    # Override all log level methods to capture events
                +    %i[trace debug info warn error fatal].each do |level|
                +      define_method(level) do |message, parameters = [], **attributes|
                +        log_event = capture_log_event(level, message, parameters, **attributes)
                +        backend.public_send(level, message, parameters, **attributes)
                +        log_event
                +      end
                +    end
                +
                +    def log(level, message, parameters:, **attributes)
                +      log_event = capture_log_event(level, message, parameters, **attributes)
                +      backend.log(level, message, parameters: parameters, **attributes)
                +      log_event
                +    end
                +
                +    def capture_log_event(level, message, parameters, **attributes)
                +      log_event_json = {
                +        timestamp: Time.now.utc.iso8601,
                +        level: level.to_s,
                +        message: message,
                +        parameters: parameters,
                +        attributes: attributes
                +      }
                +
                +      File.open(log_file, "a") { |file| file << JSON.dump(log_event_json) << "\n" }
                +      log_event_json
                +    end
                +
                +    def logged_events
                +      File.readlines(log_file).map do |line|
                +        JSON.parse(line)
                +      end
                +    end
                +
                +    def clear
                +      File.write(log_file, "")
                +      if backend.respond_to?(:config)
                +        backend.config.sdk_logger.debug("DebugStructuredLogger: Cleared events from #{log_file}")
                +      end
                +    end
                +
                +    private
                +
                +    def initialize_backend(configuration)
                +      if configuration.enable_logs
                +        StructuredLogger.new(configuration)
                +      else
                +        # Create a no-op logger if logging is disabled
                +        NoOpLogger.new
                +      end
                +    end
                +
                +    def initialize_log_file(log_file_path)
                +      log_file = Pathname(log_file_path)
                +
                +      FileUtils.mkdir_p(log_file.dirname) unless log_file.dirname.exist?
                +
                +      log_file
                +    end
                +
                +    # No-op logger for when structured logging is disabled
                +    class NoOpLogger
                +      %i[trace debug info warn error fatal log].each do |method|
                +        define_method(method) { |*args, **kwargs| nil }
                +      end
                +    end
                +  end
                +end
        lib/sentry/transport/debug_transport.rb
                --- /tmp/20250909-2813-u25blh	2025-09-09 02:02:14.037594863 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/transport/debug_transport.rb	2025-09-09 02:02:14.031594887 +0000
                @@ -0,0 +1,70 @@
                +# frozen_string_literal: true
                +
                +require "json"
                +require "fileutils"
                +require "pathname"
                +require "delegate"
                +
                +module Sentry
                +  # DebugTransport is a transport that logs events to a file for debugging purposes.
                +  #
                +  # It can optionally also send events to Sentry via HTTP transport if a real DSN
                +  # is provided.
                +  class DebugTransport < SimpleDelegator
                +    DEFAULT_LOG_FILE_PATH = File.join("log", "sentry_debug_events.log")
                +
                +    attr_reader :log_file, :backend
                +
                +    def initialize(configuration)
                +      @log_file = initialize_log_file(configuration)
                +      @backend = initialize_backend(configuration)
                +
                +      super(@backend)
                +    end
                +
                +    def send_event(event)
                +      log_envelope(envelope_from_event(event))
                +      backend.send_event(event)
                +    end
                +
                +    def log_envelope(envelope)
                +      envelope_json = {
                +        timestamp: Time.now.utc.iso8601,
                +        envelope_headers: envelope.headers,
                +        items: envelope.items.map do |item|
                +          { headers: item.headers, payload: item.payload }
                +        end
                +      }
                +
                +      File.open(log_file, "a") { |file| file << JSON.dump(envelope_json) << "\n" }
                +    end
                +
                +    def logged_envelopes
                +      return [] unless File.exist?(log_file)
                +
                +      File.readlines(log_file).map do |line|
                +        JSON.parse(line)
                +      end
                +    end
                +
                +    def clear
                +      File.write(log_file, "")
                +      log_debug("DebugTransport: Cleared events from #{log_file}")
                +    end
                +
                +    private
                +
                +    def initialize_backend(configuration)
                +      backend = configuration.dsn.local? ? DummyTransport : HTTPTransport
                +      backend.new(configuration)
                +    end
                +
                +    def initialize_log_file(configuration)
                +      log_file = Pathname(configuration.sdk_debug_transport_log_file || DEFAULT_LOG_FILE_PATH)
                +
                +      FileUtils.mkdir_p(log_file.dirname) unless log_file.dirname.exist?
                +
                +      log_file
                +    end
                +  end
                +end
        lib/sentry/utils/sample_rand.rb
                --- /tmp/20250909-2813-op3xxt	2025-09-09 02:02:14.038594860 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/utils/sample_rand.rb	2025-09-09 02:02:14.033594879 +0000
                @@ -0,0 +1,97 @@
                +# frozen_string_literal: true
                +
                +module Sentry
                +  module Utils
                +    class SampleRand
                +      PRECISION = 1_000_000.0
                +      FORMAT_PRECISION = 6
                +
                +      attr_reader :trace_id
                +
                +      def self.valid?(value)
                +        return false unless value
                +        value >= 0.0 && value < 1.0
                +      end
                +
                +      def self.format(value)
                +        return unless value
                +
                +        truncated = (value * PRECISION).floor / PRECISION
                +        "%.#{FORMAT_PRECISION}f" % truncated
                +      end
                +
                +      def initialize(trace_id: nil)
                +        @trace_id = trace_id
                +      end
                +
                +      def generate_from_trace_id
                +        (random_from_trace_id * PRECISION).floor / PRECISION
                +      end
                +
                +      def generate_from_sampling_decision(sampled, sample_rate)
                +        if invalid_sample_rate?(sample_rate)
                +          fallback_generation
                +        else
                +          generate_based_on_sampling(sampled, sample_rate)
                +        end
                +      end
                +
                +      def generate_from_value(sample_rand_value)
                +        parsed_value = parse_value(sample_rand_value)
                +
                +        if self.class.valid?(parsed_value)
                +          parsed_value
                +        else
                +          fallback_generation
                +        end
                +      end
                +
                +      private
                +
                +      def random_from_trace_id
                +        if @trace_id
                +          Random.new(@trace_id[0, 16].to_i(16))
                +        else
                +          Random.new
                +        end.rand(1.0)
                +      end
                +
                +      def invalid_sample_rate?(sample_rate)
                +        sample_rate.nil? || sample_rate <= 0.0 || sample_rate > 1.0
                +      end
                +
                +      def fallback_generation
                +        if @trace_id
                +          (random_from_trace_id * PRECISION).floor / PRECISION
                +        else
                +          format_random(Random.rand(1.0))
                +        end
                +      end
                +
                +      def generate_based_on_sampling(sampled, sample_rate)
                +        random = random_from_trace_id
                +
                +        result = if sampled
                +          random * sample_rate
                +        elsif sample_rate == 1.0
                +          random
                +        else
                +          sample_rate + random * (1.0 - sample_rate)
                +        end
                +
                +        format_random(result)
                +      end
                +
                +      def format_random(value)
                +        truncated = (value * PRECISION).floor / PRECISION
                +        ("%.#{FORMAT_PRECISION}f" % truncated).to_f
                +      end
                +
                +      def parse_value(sample_rand_value)
                +        Float(sample_rand_value)
                +      rescue ArgumentError
                +        nil
                +      end
                +    end
                +  end
                +end
      * Changed:
        Gemfile
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/Gemfile	2025-09-09 02:02:14.004594992 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/Gemfile	2025-09-09 02:02:14.019594933 +0000
                @@ -6 +6 @@
                -eval_gemfile "../Gemfile"
                +eval_gemfile "../Gemfile.dev"
                @@ -13,2 +12,0 @@
                -
                -gem "ostruct" if RUBY_VERSION >= "3.4"
        lib/sentry-ruby.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry-ruby.rb	2025-09-09 02:02:14.005594988 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry-ruby.rb	2025-09-09 02:02:14.020594929 +0000
                @@ -12,0 +13 @@
                +require "sentry/utils/sample_rand"
                @@ -14,0 +16 @@
                +require "sentry/debug_structured_logger"
                @@ -641 +643 @@
                -          # This creates a StructuredLogger instance that implements Sentry's SDK telemetry logs protocol
                +          # Use configured structured logger class or default to StructuredLogger
                @@ -643 +645 @@
                -          StructuredLogger.new(configuration)
                +          configuration.structured_logging.logger_class.new(configuration)
                @@ -647,0 +650,2 @@
                +
                +                    Caller: #{caller.first}
        lib/sentry/configuration.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/configuration.rb	2025-09-09 02:02:14.007594980 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/configuration.rb	2025-09-09 02:02:14.022594922 +0000
                @@ -15,0 +16 @@
                +require "sentry/structured_logger"
                @@ -198,0 +200,5 @@
                +    # File path for DebugTransport to log events to. If not set, defaults to a temporary file.
                +    # This is useful for debugging and testing purposes.
                +    # @return [String, nil]
                +    attr_accessor :sdk_debug_transport_log_file
                +
                @@ -291,0 +298,4 @@
                +    # Structured logging configuration.
                +    # @return [StructuredLoggingConfiguration]
                +    attr_reader :structured_logging
                +
                @@ -487,0 +498 @@
                +      @structured_logging = StructuredLoggingConfiguration.new
                @@ -784,0 +796,15 @@
                +    end
                +  end
                +
                +  class StructuredLoggingConfiguration
                +    # File path for DebugStructuredLogger to log events to
                +    # @return [String, Pathname, nil]
                +    attr_accessor :file_path
                +
                +    # The class to use as a structured logger.
                +    # @return [Class]
                +    attr_accessor :logger_class
                +
                +    def initialize
                +      @file_path = nil
                +      @logger_class = Sentry::StructuredLogger
        lib/sentry/dsn.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/dsn.rb	2025-09-09 02:02:14.008594976 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/dsn.rb	2025-09-09 02:02:14.023594918 +0000
                @@ -3,0 +4,2 @@
                +require "ipaddr"
                +require "resolv"
                @@ -8,0 +11,2 @@
                +    LOCALHOST_NAMES = %w[localhost 127.0.0.1 ::1 [::1]].freeze
                +    LOCALHOST_PATTERN = /\.local(host|domain)?$/i
                @@ -50,0 +55,28 @@
                +    end
                +
                +    def local?
                +      @local ||= (localhost? || private_ip? || resolved_ips_private?)
                +    end
                +
                +    def localhost?
                +      LOCALHOST_NAMES.include?(host.downcase) || LOCALHOST_PATTERN.match?(host)
                +    end
                +
                +    def private_ip?
                +      @private_ip ||= begin
                +        begin
                +          IPAddr.new(host).private?
                +        rescue IPAddr::InvalidAddressError
                +          false
                +        end
                +      end
                +    end
                +
                +    def resolved_ips_private?
                +      @resolved_ips_private ||= begin
                +        begin
                +          Resolv.getaddresses(host).any? { |ip| IPAddr.new(ip).private? }
                +        rescue Resolv::ResolvError, IPAddr::InvalidAddressError
                +          false
                +        end
                +      end
        lib/sentry/hub.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/hub.rb	2025-09-09 02:02:14.009594972 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/hub.rb	2025-09-09 02:02:14.024594914 +0000
                @@ -123 +123,2 @@
                -        parent_sampled: transaction.parent_sampled
                +        parent_sampled: transaction.parent_sampled,
                +        parent_sample_rate: transaction.parent_sample_rate
                @@ -359,0 +361 @@
                +        sample_rand: propagation_context.sample_rand,
        lib/sentry/log_event.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/log_event.rb	2025-09-09 02:02:14.010594968 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/log_event.rb	2025-09-09 02:02:14.026594906 +0000
                @@ -45 +45 @@
                -    attr_reader :configuration, *SERIALIZEABLE_ATTRIBUTES
                +    attr_reader :configuration, *(SERIALIZEABLE_ATTRIBUTES - %i[level body attributes])
        lib/sentry/propagation_context.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/propagation_context.rb	2025-09-09 02:02:14.013594957 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/propagation_context.rb	2025-09-09 02:02:14.028594898 +0000
                @@ -5,0 +6 @@
                +require "sentry/utils/sample_rand"
                @@ -10,2 +11 @@
                -      "^[ \t]*" +  # whitespace
                -      "([0-9a-f]{32})?" +  # trace_id
                +      "\\A([0-9a-f]{32})?" + # trace_id
                @@ -13,2 +13 @@
                -      "-?([01])?" +  # sampled
                -      "[ \t]*$"  # whitespace
                +      "-?([01])?\\z"         # sampled
                @@ -35,0 +35,47 @@
                +    # The propagated random value used for sampling decisions.
                +    # @return [Float, nil]
                +    attr_reader :sample_rand
                +
                +    # Extract the trace_id, parent_span_id and parent_sampled values from a sentry-trace header.
                +    #
                +    # @param sentry_trace [String] the sentry-trace header value from the previous transaction.
                +    # @return [Array, nil]
                +    def self.extract_sentry_trace(sentry_trace)
                +      value = sentry_trace.to_s.strip
                +      return if value.empty?
                +
                +      match = SENTRY_TRACE_REGEXP.match(value)
                +      return if match.nil?
                +
                +      trace_id, parent_span_id, sampled_flag = match[1..3]
                +      parent_sampled = sampled_flag.nil? ? nil : sampled_flag != "0"
                +
                +      [trace_id, parent_span_id, parent_sampled]
                +    end
                +
                +    def self.extract_sample_rand_from_baggage(baggage, trace_id = nil)
                +      return unless baggage&.items
                +
                +      sample_rand_str = baggage.items["sample_rand"]
                +      return unless sample_rand_str
                +
                +      generator = Utils::SampleRand.new(trace_id: trace_id)
                +      generator.generate_from_value(sample_rand_str)
                +    end
                +
                +    def self.generate_sample_rand(baggage, trace_id, parent_sampled)
                +      generator = Utils::SampleRand.new(trace_id: trace_id)
                +
                +      if baggage&.items && !parent_sampled.nil?
                +        sample_rate_str = baggage.items["sample_rate"]
                +        sample_rate = sample_rate_str&.to_f
                +
                +        if sample_rate && !parent_sampled.nil?
                +          generator.generate_from_sampling_decision(parent_sampled, sample_rate)
                +        else
                +          generator.generate_from_trace_id
                +        end
                +      else
                +        generator.generate_from_trace_id
                +      end
                +    end
                @@ -42,0 +89 @@
                +      @sample_rand = nil
                @@ -63,0 +111,2 @@
                +            @sample_rand = self.class.extract_sample_rand_from_baggage(@baggage, @trace_id)
                +
                @@ -72,14 +121 @@
                -    end
                -
                -    # Extract the trace_id, parent_span_id and parent_sampled values from a sentry-trace header.
                -    #
                -    # @param sentry_trace [String] the sentry-trace header value from the previous transaction.
                -    # @return [Array, nil]
                -    def self.extract_sentry_trace(sentry_trace)
                -      match = SENTRY_TRACE_REGEXP.match(sentry_trace)
                -      return nil if match.nil?
                -
                -      trace_id, parent_span_id, sampled_flag = match[1..3]
                -      parent_sampled = sampled_flag.nil? ? nil : sampled_flag != "0"
                -
                -      [trace_id, parent_span_id, parent_sampled]
                +      @sample_rand ||= self.class.generate_sample_rand(@baggage, @trace_id, @parent_sampled)
                @@ -125,0 +162 @@
                +        "sample_rand" => Utils::SampleRand.format(@sample_rand),
        lib/sentry/test_helper.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/test_helper.rb	2025-09-09 02:02:14.015594949 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/test_helper.rb	2025-09-09 02:02:14.030594891 +0000
                @@ -4,0 +5,2 @@
                +    module_function
                +
                @@ -6,0 +9,3 @@
                +    # Not really real, but it will be resolved as a non-local for testing needs
                +    REAL_DSN = "https://user:pass@getsentry.io/project/42"
                +
                @@ -48,0 +54,2 @@
                +      clear_sentry_events
                +
                @@ -55,0 +63,15 @@
                +    end
                +
                +    def clear_sentry_events
                +      return unless Sentry.initialized?
                +
                +      sentry_transport.clear if sentry_transport.respond_to?(:clear)
                +
                +      if Sentry.configuration.enable_logs && sentry_logger.respond_to?(:clear)
                +        sentry_logger.clear
                +      end
                +    end
                +
                +    # @return [Sentry::StructuredLogger, Sentry::DebugStructuredLogger]
                +    def sentry_logger
                +      Sentry.logger
        lib/sentry/transaction.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/transaction.rb	2025-09-09 02:02:14.015594949 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/transaction.rb	2025-09-09 02:02:14.030594891 +0000
                @@ -4,0 +5 @@
                +require "sentry/utils/sample_rand"
                @@ -59,0 +61,4 @@
                +    # Sample rand value generated from trace_id
                +    # @return [String]
                +    attr_reader :sample_rand
                +
                @@ -65,0 +71 @@
                +      sample_rand: nil,
                @@ -84,0 +91 @@
                +      @sample_rand = sample_rand
                @@ -90,0 +98,5 @@
                +
                +      unless @sample_rand
                +        generator = Utils::SampleRand.new(trace_id: @trace_id)
                +        @sample_rand = generator.generate_from_trace_id
                +      end
                @@ -125,0 +138,2 @@
                +      sample_rand = extract_sample_rand_from_baggage(baggage, trace_id, parent_sampled)
                +
                @@ -131,0 +146 @@
                +        sample_rand: sample_rand,
                @@ -141,0 +157,5 @@
                +    def self.extract_sample_rand_from_baggage(baggage, trace_id, parent_sampled)
                +      PropagationContext.extract_sample_rand_from_baggage(baggage, trace_id) ||
                +        PropagationContext.generate_sample_rand(baggage, trace_id, parent_sampled)
                +    end
                +
                @@ -155,0 +176,7 @@
                +    def parent_sample_rate
                +      return unless @baggage&.items
                +
                +      sample_rate_str = @baggage.items["sample_rate"]
                +      sample_rate_str&.to_f
                +    end
                +
                @@ -228 +255 @@
                -        @sampled = Random.rand < @effective_sample_rate
                +        @sampled = @sample_rand < @effective_sample_rate
                @@ -333,0 +361 @@
                +        "sample_rand" => Utils::SampleRand.format(@sample_rand),
        lib/sentry/transport.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/transport.rb	2025-09-09 02:02:14.015594949 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/transport.rb	2025-09-09 02:02:14.031594887 +0000
                @@ -225,0 +226 @@
                +require "sentry/transport/debug_transport"
        lib/sentry/transport/dummy_transport.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/transport/dummy_transport.rb	2025-09-09 02:02:14.016594945 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/transport/dummy_transport.rb	2025-09-09 02:02:14.031594887 +0000
                @@ -14,0 +15 @@
                +      super
        lib/sentry/transport/http_transport.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/transport/http_transport.rb	2025-09-09 02:02:14.016594945 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/transport/http_transport.rb	2025-09-09 02:02:14.031594887 +0000
                @@ -48,5 +48 @@
                -      response = conn.start do |http|
                -        request = ::Net::HTTP::Post.new(endpoint, headers)
                -        request.body = data
                -        http.request(request)
                -      end
                +      response = do_request(endpoint, headers, data)
                @@ -111,0 +108,8 @@
                +    end
                +
                +    def do_request(endpoint, headers, body)
                +      conn.start do |http|
                +        request = ::Net::HTTP::Post.new(endpoint, headers)
                +        request.body = body
                +        http.request(request)
                +      end
        lib/sentry/version.rb
                --- /tmp/d20250909-2813-jfdhce/sentry-ruby-5.26.0/lib/sentry/version.rb	2025-09-09 02:02:14.018594937 +0000
                +++ /tmp/d20250909-2813-jfdhce/sentry-ruby-5.27.0/lib/sentry/version.rb	2025-09-09 02:02:14.033594879 +0000
                @@ -4 +4 @@
                -  VERSION = "5.26.0"
                +  VERSION = "5.27.0"

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Sep 23, 2025

Superseded by #799.

@dependabot dependabot bot closed this Sep 23, 2025
@dependabot dependabot bot deleted the dependabot/bundler/sentry-ruby-5.27.0 branch September 23, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant