Skip to content

Commit

Permalink
Don't record 'start_timestamp' attribute in breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Sep 17, 2021
1 parent 644c5e7 commit f66b336
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sentry-rails/lib/sentry/rails.rb
@@ -1,10 +1,10 @@
require "rails"
require "sentry-ruby"
require "sentry/integrable"
require "sentry/rails/tracing"
require "sentry/rails/configuration"
require "sentry/rails/engine"
require "sentry/rails/railtie"
require "sentry/rails/tracing"

module Sentry
module Rails
Expand Down
@@ -1,7 +1,7 @@
module Sentry
module Rails
module InstrumentPayloadCleanupHelper
IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object]
IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object, Tracing::START_TIMESTAMP_NAME]

def cleanup_data(data)
IGNORED_DATA_TYPES.each do |key|
Expand Down
4 changes: 3 additions & 1 deletion sentry-rails/lib/sentry/rails/tracing.rb
@@ -1,6 +1,8 @@
module Sentry
module Rails
module Tracing
START_TIMESTAMP_NAME = :sentry_start_timestamp

def self.register_subscribers(subscribers)
@subscribers = subscribers
end
Expand Down Expand Up @@ -37,7 +39,7 @@ def self.patch_active_support_notifications
def instrument(name, payload = {}, &block)
is_public_event = name[0] != "!"

payload[:start_timestamp] = Time.now.utc.to_f if is_public_event
payload[START_TIMESTAMP_NAME] = Time.now.utc.to_f if is_public_event

super(name, payload, &block)
end
Expand Down
Expand Up @@ -16,7 +16,7 @@ def self.subscribe!

record_on_current_span(
op: event_name,
start_timestamp: payload[:start_timestamp],
start_timestamp: payload[START_TIMESTAMP_NAME],
description: "#{controller}##{action}",
duration: duration
) do |span|
Expand Down
Expand Up @@ -8,7 +8,7 @@ class ActionViewSubscriber < AbstractSubscriber

def self.subscribe!
subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:identifier], duration: duration)
record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:identifier], duration: duration)
end
end
end
Expand Down
Expand Up @@ -11,7 +11,7 @@ def self.subscribe!
subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
next if EXCLUDED_EVENTS.include? payload[:name]

record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:sql], duration: duration) do |span|
record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:sql], duration: duration) do |span|
span.set_data(:connection_id, payload[:connection_id])
end
end
Expand Down

0 comments on commit f66b336

Please sign in to comment.