sentry-rails 4.7.2 → 4.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 601a533a33e665e2a7b470eead7e2598827189e985903fb78c0391d9a446ddeb
4
- data.tar.gz: e33f1dae2e5d5305432f8fcec69bd26daef8217adf582e6d6747ab1bdb79b112
3
+ metadata.gz: cec5336b01a20ec1922a32d103bd4dcf1587e8bf53288bd58520ba76aaa181a3
4
+ data.tar.gz: e38495a0f02aa5d1293167cb8894671948d0eaf1d4c1eac987e7bb74a28f3b0d
5
5
  SHA512:
6
- metadata.gz: e459f55b49f1b468ee151f5094e3e2bcc28ba6289f86ec83e69c00b2205c37982f34f4922c3c97af72a02902379c61b3a7bb2cb30cf6f6d8972fc2dbba70eeb2
7
- data.tar.gz: 794f8644fe6499cdeeb7bba75e9bf899629afe77ebbd0daca6dd587b8270b53c386f5bbcdae393d747341d3c758983520546e519aecfe23f6c31d94371e76375
6
+ metadata.gz: a2a44a181625827c72a1393c96c3f783a9b0eb8317d626baa44ebd1a91f099e0fc135fba8270f45dab649b3bf8e87a65b0f79aa865fb400e52c0e1ecba961f62
7
+ data.tar.gz: f6e5fd836f4b7e9cdaabd776b0f2b2918fcc422f0e170b75dce77b32f36f230e1046d02cd437aa59fb1017239a829032cb78daf0f1af20668786897555467ecc
@@ -1,7 +1,7 @@
1
1
  module Sentry
2
2
  module Rails
3
3
  module InstrumentPayloadCleanupHelper
4
- IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object]
4
+ IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object, Tracing::START_TIMESTAMP_NAME]
5
5
 
6
6
  def cleanup_data(data)
7
7
  IGNORED_DATA_TYPES.each do |key|
@@ -16,7 +16,7 @@ module Sentry
16
16
 
17
17
  record_on_current_span(
18
18
  op: event_name,
19
- start_timestamp: payload[:start_timestamp],
19
+ start_timestamp: payload[START_TIMESTAMP_NAME],
20
20
  description: "#{controller}##{action}",
21
21
  duration: duration
22
22
  ) do |span|
@@ -8,7 +8,7 @@ module Sentry
8
8
 
9
9
  def self.subscribe!
10
10
  subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
11
- record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:identifier], duration: duration)
11
+ record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:identifier], duration: duration)
12
12
  end
13
13
  end
14
14
  end
@@ -11,7 +11,7 @@ module Sentry
11
11
  subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
12
12
  next if EXCLUDED_EVENTS.include? payload[:name]
13
13
 
14
- record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:sql], duration: duration) do |span|
14
+ record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:sql], duration: duration) do |span|
15
15
  span.set_data(:connection_id, payload[:connection_id])
16
16
  end
17
17
  end
@@ -1,6 +1,8 @@
1
1
  module Sentry
2
2
  module Rails
3
3
  module Tracing
4
+ START_TIMESTAMP_NAME = :sentry_start_timestamp
5
+
4
6
  def self.register_subscribers(subscribers)
5
7
  @subscribers = subscribers
6
8
  end
@@ -9,11 +11,18 @@ module Sentry
9
11
  @subscribers
10
12
  end
11
13
 
14
+ def self.subscribed_tracing_events
15
+ @subscribed_tracing_events ||= []
16
+ end
17
+
12
18
  def self.subscribe_tracing_events
13
19
  # need to avoid duplicated subscription
14
20
  return if @subscribed
15
21
 
16
- subscribers.each(&:subscribe!)
22
+ subscribers.each do |subscriber|
23
+ subscriber.subscribe!
24
+ subscribed_tracing_events << subscriber::EVENT_NAME
25
+ end
17
26
 
18
27
  @subscribed = true
19
28
  end
@@ -22,6 +31,7 @@ module Sentry
22
31
  return unless @subscribed
23
32
 
24
33
  subscribers.each(&:unsubscribe!)
34
+ subscribed_tracing_events.clear
25
35
 
26
36
  @subscribed = false
27
37
  end
@@ -35,9 +45,10 @@ module Sentry
35
45
 
36
46
  SentryNotificationExtension.module_eval do
37
47
  def instrument(name, payload = {}, &block)
38
- is_public_event = name[0] != "!"
39
-
40
- payload[:start_timestamp] = Time.now.utc.to_f if is_public_event
48
+ # only inject timestamp to the events the SDK subscribes to
49
+ if Tracing.subscribed_tracing_events.include?(name)
50
+ payload[START_TIMESTAMP_NAME] = Time.now.utc.to_f if name[0] != "!" && payload.is_a?(Hash)
51
+ end
41
52
 
42
53
  super(name, payload, &block)
43
54
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "4.7.2"
3
+ VERSION = "4.7.3"
4
4
  end
5
5
  end
data/lib/sentry/rails.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "rails"
2
2
  require "sentry-ruby"
3
3
  require "sentry/integrable"
4
+ require "sentry/rails/tracing"
4
5
  require "sentry/rails/configuration"
5
6
  require "sentry/rails/engine"
6
7
  require "sentry/rails/railtie"
7
- require "sentry/rails/tracing"
8
8
 
9
9
  module Sentry
10
10
  module Rails
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.2
4
+ version: 4.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties