Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Oct 22, 2025

Bumps sentry-ruby from 5.26.0 to 5.28.1.

Changelog

Sourced from sentry-ruby's changelog.

5.28.1

Bug Fixes

  • The sentry.origin log event attribute is now correctly prefixed with auto.log (#2749)

5.28.0

Features

  • Auto-enable Rails structured logging when enable_logs is true (#2721)

Miscellaneous

  • Deprecate all Metrics related APIs #2726

    Sentry no longer has the Metrics Beta offering so all the following APIs linked to Metrics have been deprecated and will be removed in the next major.

    Sentry.init do |config|
      # ...
      config.metrics.enabled = true
      config.metrics.enable_code_locations = true
      config.metrics.before_emit = lambda {}
    end
    Sentry::Metrics.increment('button_click')
    Sentry::Metrics.distribution('page_load', 15.0, unit: 'millisecond')
    Sentry::Metrics.gauge('page_load', 15.0, unit: 'millisecond')
    Sentry::Metrics.set('user_view', 'jane')
    Sentry::Metrics.timing('how_long') { sleep(1) }

Internal

  • Fix leftover config.logger call in graphql patch (#2722
  • Add Configuration.before and Configuration.after to run hooks before and after given event (#2724)

5.27.1

Features

  • Support for :origin attribute in log events (#2712)

Bug Fixes

  • Skip including sentry.message.template in the log event attributes if there are no interpolation parameters provided (#2700)
  • Respect log_level when logging via :std_lib_logger patch (#2709)
  • Add sentry.origin attribute to log events (#2712)

... (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.28.1.
- [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.28.1)

---
updated-dependencies:
- dependency-name: sentry-ruby
  dependency-version: 5.28.1
  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 Oct 22, 2025
@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

gem compare bigdecimal 3.2.2 3.3.1

Compared versions: ["3.2.2", "3.3.1"]
  DIFFERENT require_paths:
    3.2.2: ["/opt/hostedtoolcache/Ruby/3.4.7/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-3.2.2", "lib"]
    3.3.1: ["/opt/hostedtoolcache/Ruby/3.4.7/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-3.3.1", "lib"]
  DIFFERENT version:
    3.2.2: 3.2.2
    3.3.1: 3.3.1
  DIFFERENT files:
    3.2.2->3.3.1:
      * Changed:
            ext/bigdecimal/bigdecimal.c +731/-2254
            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 +351/-0
            lib/bigdecimal/math.rb +88/-70
            lib/bigdecimal/util.rb +15/-14

@github-actions
Copy link
Contributor

gem compare --diff bigdecimal 3.2.2 3.3.1

Diff too large (189551 chars)

@github-actions
Copy link
Contributor

gem compare sentry-ruby 5.26.0 5.28.1

Compared versions: ["5.26.0", "5.28.1"]
  DIFFERENT homepage:
    5.26.0: https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby
    5.28.1: https://github.com/getsentry/sentry-ruby/tree/5.28.1/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.28.1: {"homepage_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.28.1/sentry-ruby", "source_code_uri" => "https://github.com/getsentry/sentry-ruby/tree/5.28.1/sentry-ruby", "changelog_uri" => "https://github.com/getsentry/sentry-ruby/blob/5.28.1/CHANGELOG.md", "bug_tracker_uri" => "https://github.com/getsentry/sentry-ruby/issues", "documentation_uri" => "http://www.rubydoc.info/gems/sentry-ruby/5.28.1"}
  DIFFERENT rubygems_version:
    5.26.0: 3.6.7
    5.28.1: 3.6.9
  DIFFERENT version:
    5.26.0: 5.26.0
    5.28.1: 5.28.1
  DIFFERENT files:
    5.26.0->5.28.1:
      * 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 +8/-4
            lib/sentry/client.rb +3/-2
            lib/sentry/configuration.rb +54/-6
            lib/sentry/dsn.rb +32/-0
            lib/sentry/graphql.rb +1/-1
            lib/sentry/hub.rb +3/-1
            lib/sentry/log_event.rb +18/-5
            lib/sentry/metrics.rb +12/-0
            lib/sentry/metrics/configuration.rb +12/-2
            lib/sentry/propagation_context.rb +55/-18
            lib/sentry/std_lib_logger.rb +6/-1
            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

gem compare --diff sentry-ruby 5.26.0 5.28.1

Compared versions: ["5.26.0", "5.28.1"]
  DIFFERENT files:
    5.26.0->5.28.1:
      * Added:
        lib/sentry/debug_structured_logger.rb
                --- /tmp/20251022-2833-2uhm3z	2025-10-22 02:02:53.037327116 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/debug_structured_logger.rb	2025-10-22 02:02:53.026327162 +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/20251022-2833-onn3g8	2025-10-22 02:02:53.040327103 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/transport/debug_transport.rb	2025-10-22 02:02:53.034327128 +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/20251022-2833-jfafvv	2025-10-22 02:02:53.041327099 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/utils/sample_rand.rb	2025-10-22 02:02:53.036327120 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/Gemfile	2025-10-22 02:02:53.007327241 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/Gemfile	2025-10-22 02:02:53.022327178 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry-ruby.rb	2025-10-22 02:02:53.008327237 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry-ruby.rb	2025-10-22 02:02:53.023327174 +0000
                @@ -12,0 +13 @@
                +require "sentry/utils/sample_rand"
                @@ -14,0 +16 @@
                +require "sentry/debug_structured_logger"
                @@ -240,2 +242 @@
                -      config = Configuration.new
                -      yield(config) if block_given?
                +      config = Configuration.new(&block)
                @@ -500,0 +502 @@
                +    # @option options [String] origin The origin of the log event (e.g., "auto.db.rails", "manual")
                @@ -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/client.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/client.rb	2025-10-22 02:02:53.009327233 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/client.rb	2025-10-22 02:02:53.025327166 +0000
                @@ -198 +198,2 @@
                -      attributes = options.reject { |k, _| k == :level || k == :severity }
                +      attributes = options.reject { |k, _| k == :level || k == :severity || k == :origin }
                +      origin = options[:origin]
                @@ -200 +201 @@
                -      LogEvent.new(level: level, body: message, attributes: attributes)
                +      LogEvent.new(level: level, body: message, attributes: attributes, origin: origin)
        lib/sentry/configuration.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/configuration.rb	2025-10-22 02:02:53.009327233 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/configuration.rb	2025-10-22 02:02:53.025327166 +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
                +
                @@ -393 +403,17 @@
                -        post_initialization_callbacks << block
                +        callbacks[:initialize][:after] << block
                +      end
                +
                +      def before(event, &block)
                +        callbacks[event.to_sym][:before] << block
                +      end
                +
                +      def after(event, &block)
                +        callbacks[event.to_sym][:after] << block
                +      end
                +
                +      # @!visibility private
                +      def callbacks
                +        @callbacks ||= {
                +          initialize: { before: [], after: [] },
                +          configured: { before: [], after: [] }
                +        }
                @@ -436,0 +463,2 @@
                +      run_callbacks(:before, :initialize)
                +
                @@ -487 +515,2 @@
                -      @metrics = Metrics::Configuration.new
                +      @metrics = Metrics::Configuration.new(self.sdk_logger)
                +      @structured_logging = StructuredLoggingConfiguration.new
                @@ -490,2 +518,0 @@
                -      run_post_initialization_callbacks
                -
                @@ -492,0 +520,6 @@
                +
                +      run_callbacks(:after, :initialize)
                +
                +      yield(self) if block_given?
                +
                +      run_callbacks(:after, :configured)
                @@ -776,2 +809,2 @@
                -    def run_post_initialization_callbacks
                -      self.class.post_initialization_callbacks.each do |hook|
                +    def run_callbacks(hook, event)
                +      self.class.callbacks[event][hook].each do |hook|
                @@ -784,0 +818,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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/dsn.rb	2025-10-22 02:02:53.011327224 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/dsn.rb	2025-10-22 02:02:53.026327162 +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/graphql.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/graphql.rb	2025-10-22 02:02:53.012327220 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/graphql.rb	2025-10-22 02:02:53.027327157 +0000
                @@ -7 +7 @@
                -    config.logger.warn(Sentry::LOGGER_PROGNAME) { "You tried to enable the GraphQL integration but no GraphQL gem was detected. Make sure you have the `graphql` gem (>= 2.2.6) in your Gemfile." }
                +    config.sdk_logger.warn(Sentry::LOGGER_PROGNAME) { "You tried to enable the GraphQL integration but no GraphQL gem was detected. Make sure you have the `graphql` gem (>= 2.2.6) in your Gemfile." }
        lib/sentry/hub.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/hub.rb	2025-10-22 02:02:53.012327220 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/hub.rb	2025-10-22 02:02:53.027327157 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/log_event.rb	2025-10-22 02:02:53.014327212 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/log_event.rb	2025-10-22 02:02:53.029327149 +0000
                @@ -32 +32,2 @@
                -      "sentry.message.template" => :template
                +      "sentry.message.template" => :template,
                +      "sentry.origin" => :origin
                @@ -34,0 +36,2 @@
                +    PARAMETER_PREFIX = "sentry.message.parameter"
                +
                @@ -43 +46 @@
                -    attr_accessor :level, :body, :template, :attributes, :user
                +    attr_accessor :level, :body, :template, :attributes, :user, :origin
                @@ -45 +48 @@
                -    attr_reader :configuration, *SERIALIZEABLE_ATTRIBUTES
                +    attr_reader :configuration, *(SERIALIZEABLE_ATTRIBUTES - %i[level body attributes])
                @@ -53,0 +57 @@
                +      template
                @@ -81,0 +86 @@
                +      @origin = options[:origin]
                @@ -148,0 +154,4 @@
                +    def serialize_template
                +      template if has_parameters?
                +    end
                +
                @@ -188 +197 @@
                -            attributes["sentry.message.parameter.#{key}"] = value
                +            attributes["#{PARAMETER_PREFIX}.#{key}"] = value
                @@ -192 +201 @@
                -            attributes["sentry.message.parameter.#{index}"] = param
                +            attributes["#{PARAMETER_PREFIX}.#{index}"] = param
                @@ -203,0 +213,4 @@
                +    end
                +
                +    def has_parameters?
                +      attributes.keys.any? { |key| key.start_with?(PARAMETER_PREFIX) }
        lib/sentry/metrics.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/metrics.rb	2025-10-22 02:02:53.014327212 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/metrics.rb	2025-10-22 02:02:53.029327149 +0000
                @@ -21,0 +22 @@
                +        log_deprecation
                @@ -25,0 +27 @@
                +        log_deprecation
                @@ -29,0 +32 @@
                +        log_deprecation
                @@ -33,0 +37 @@
                +        log_deprecation
                @@ -37,0 +42,2 @@
                +        log_deprecation
                +
                @@ -52,0 +59,6 @@
                +      end
                +
                +      def log_deprecation
                +        Sentry.sdk_logger.warn(LOGGER_PROGNAME) do
                +          "`Sentry::Metrics` is now deprecated and will be removed in the next major."
                +        end
        lib/sentry/metrics/configuration.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/metrics/configuration.rb	2025-10-22 02:02:53.014327212 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/metrics/configuration.rb	2025-10-22 02:02:53.030327145 +0000
                @@ -6,0 +7 @@
                +      include LoggingHelper
                @@ -12 +13 @@
                -      attr_accessor :enabled
                +      attr_reader :enabled
                @@ -35 +36,2 @@
                -      def initialize
                +      def initialize(sdk_logger)
                +        @sdk_logger = sdk_logger
                @@ -37,0 +40,8 @@
                +      end
                +
                +      def enabled=(value)
                +        log_warn <<~MSG
                +          `config.metrics` is now deprecated and will be removed in the next major.
                +        MSG
                +
                +        @enabled = value
        lib/sentry/propagation_context.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/propagation_context.rb	2025-10-22 02:02:53.016327204 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/propagation_context.rb	2025-10-22 02:02:53.031327141 +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/std_lib_logger.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/std_lib_logger.rb	2025-10-22 02:02:53.018327195 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/std_lib_logger.rb	2025-10-22 02:02:53.033327132 +0000
                @@ -14,0 +15,2 @@
                +    ORIGIN = "auto.log.ruby.std_logger"
                +
                @@ -19,0 +22,3 @@
                +      # Only process logs that meet or exceed the logger's level
                +      return result if severity < level
                +
                @@ -35 +40 @@
                -          Sentry.logger.send(method, message)
                +          Sentry.logger.send(method, message, origin: ORIGIN)
        lib/sentry/test_helper.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/test_helper.rb	2025-10-22 02:02:53.018327195 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/test_helper.rb	2025-10-22 02:02:53.033327132 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/transaction.rb	2025-10-22 02:02:53.018327195 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/transaction.rb	2025-10-22 02:02:53.034327128 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/transport.rb	2025-10-22 02:02:53.019327191 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/transport.rb	2025-10-22 02:02:53.034327128 +0000
                @@ -225,0 +226 @@
                +require "sentry/transport/debug_transport"
        lib/sentry/transport/dummy_transport.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/transport/dummy_transport.rb	2025-10-22 02:02:53.019327191 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/transport/dummy_transport.rb	2025-10-22 02:02:53.034327128 +0000
                @@ -14,0 +15 @@
                +      super
        lib/sentry/transport/http_transport.rb
                --- /tmp/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/transport/http_transport.rb	2025-10-22 02:02:53.019327191 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/transport/http_transport.rb	2025-10-22 02:02:53.035327124 +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/d20251022-2833-33bdm1/sentry-ruby-5.26.0/lib/sentry/version.rb	2025-10-22 02:02:53.021327183 +0000
                +++ /tmp/d20251022-2833-33bdm1/sentry-ruby-5.28.1/lib/sentry/version.rb	2025-10-22 02:02:53.037327116 +0000
                @@ -4 +4 @@
                -  VERSION = "5.26.0"
                +  VERSION = "5.28.1"

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Oct 23, 2025

Superseded by #816.

@dependabot dependabot bot closed this Oct 23, 2025
@dependabot dependabot bot deleted the dependabot/bundler/sentry-ruby-5.28.1 branch October 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