bugsnag 6.5.0 → 6.6.0

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
  SHA1:
3
- metadata.gz: 75340d844c86f98e0ef2519d4ca1416bf9de8ab8
4
- data.tar.gz: 7a384090af717661a8acdcd2e2b3184b138b77e9
3
+ metadata.gz: 4c03a7b5fcc7e028efedba3fa34ec2e212ac51a6
4
+ data.tar.gz: 5be7d2ae911cde691ff88655a8bc6d44647b3119
5
5
  SHA512:
6
- metadata.gz: eb256344706e647174e3dc9abac3376b7b3966c6f706fdb77dbaf2ae9c50527490d4ee591265a14a0787678f018affde73a0b3a5c7a30ea676da27bc7731612f
7
- data.tar.gz: 71b8138725c4b11278eafef1e9a02c61977fe4a6f0460684e582ca9276b1bc4d7841cd0130b643882e0fc7e640e0eb33df7456c6004f6bb5d3b1ee3c031bac0d
6
+ metadata.gz: 8fe2cf08fafd1828e2bc0d9cf80e1e2bd63268ec529f3cab6e5153502354cb6404b315215c2573f76db6bf54cc5a688dcd4a66c8d14f19cd5d7588099acf56f0
7
+ data.tar.gz: 107e95f0ee4f2d7a78cff8ec7d9907f5a70cda75cd3c833c0d2c135800ec5885ae2396a7c6506a371d1b8b055a30e9c1c8c6700bfc78e25c67b3ce46d031ceca
@@ -1,12 +1,24 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 6.6.0 (09 Jan 2018)
5
+
6
+ ### Enhancements
7
+
8
+ * Session tracking update:
9
+ * Refactor of session tracking to adhere to a common interface, and simplify usage.
10
+ * Includes several performance enhancements.
11
+ * Reverts potentially breaking change of json body sanitation within delivery function.
12
+ | [#412](https://github.com/bugsnag/bugsnag-ruby/pull/412)
13
+ * Maintains backwards compatibility with previous session-tracking changes.
14
+ | [#413](https://github.com/bugsnag/bugsnag-ruby/pull/413)
15
+
4
16
  ## 6.5.0 (04 Jan 2018)
5
17
 
6
18
  ### Enhancements
7
19
 
8
- * Adds support for tracking sessions and crash rate by setting the configuration option `configuration.track_sessions` to `true`.
9
- Sessions can be manually created using `Bugsnag.start_session`, and manually delivered using `Bugsnag.send_sessions`.
20
+ * Adds support for tracking sessions and crash rate by setting the configuration option `configuration.auto_capture_sessions` to `true`.
21
+ Sessions can be manually created using `Bugsnag.start_session`.
10
22
  | [#411](https://github.com/bugsnag/bugsnag-ruby/pull/411)
11
23
 
12
24
  ## 6.4.0 (21 Dec 2017)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.5.0
1
+ 6.6.0
@@ -18,4 +18,5 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.require_paths = ["lib"]
20
20
  s.required_ruby_version = '>= 1.9.2'
21
+ s.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
21
22
  end
@@ -39,8 +39,6 @@ module Bugsnag
39
39
  configuration.warn("No valid API key has been set, notifications will not be sent")
40
40
  @key_warning = true
41
41
  end
42
-
43
- session_tracker.config = configuration
44
42
  end
45
43
 
46
44
  # Explicitly notify of an exception
@@ -116,8 +114,9 @@ module Bugsnag
116
114
 
117
115
  # Deliver
118
116
  configuration.info("Notifying #{configuration.endpoint} of #{report.exceptions.last[:errorClass]}")
119
- options = {:headers => report.headers, :trim_payload => true}
120
- Bugsnag::Delivery[configuration.delivery_method].deliver(configuration.endpoint, report.as_json, configuration, options)
117
+ options = {:headers => report.headers}
118
+ payload = ::JSON.dump(Bugsnag::Helpers.trim_if_needed(report.as_json))
119
+ Bugsnag::Delivery[configuration.delivery_method].deliver(configuration.endpoint, payload, configuration, options)
121
120
  end
122
121
  end
123
122
 
@@ -127,9 +126,14 @@ module Bugsnag
127
126
  @configuration || LOCK.synchronize { @configuration ||= Bugsnag::Configuration.new }
128
127
  end
129
128
 
129
+ # Session tracking
130
130
  def session_tracker
131
131
  @session_tracker = nil unless defined?(@session_tracker)
132
- @session_tracker || LOCK.synchronize { @session_tracker ||= Bugsnag::SessionTracker.new(configuration)}
132
+ @session_tracker || LOCK.synchronize { @session_tracker ||= Bugsnag::SessionTracker.new}
133
+ end
134
+
135
+ def start_session
136
+ session_tracker.start_session
133
137
  end
134
138
 
135
139
  # Allow access to "before notify" callbacks
@@ -23,7 +23,7 @@ module Bugsnag
23
23
  attr_accessor :app_type
24
24
  attr_accessor :meta_data_filters
25
25
  attr_accessor :endpoint
26
- attr_accessor :logger
26
+ attr_accessor :logger
27
27
  attr_accessor :middleware
28
28
  attr_accessor :internal_middleware
29
29
  attr_accessor :proxy_host
@@ -33,6 +33,7 @@ module Bugsnag
33
33
  attr_accessor :timeout
34
34
  attr_accessor :hostname
35
35
  attr_accessor :ignore_classes
36
+ attr_accessor :auto_capture_sessions
36
37
  attr_accessor :track_sessions
37
38
  attr_accessor :session_endpoint
38
39
 
@@ -49,6 +50,9 @@ module Bugsnag
49
50
  "rack.request.form_vars"
50
51
  ].freeze
51
52
 
53
+ alias :track_sessions :auto_capture_sessions
54
+ alias :track_sessions= :auto_capture_sessions=
55
+
52
56
  def initialize
53
57
  @mutex = Mutex.new
54
58
 
@@ -61,7 +65,7 @@ module Bugsnag
61
65
  self.hostname = default_hostname
62
66
  self.timeout = 15
63
67
  self.notify_release_stages = nil
64
- self.track_sessions = false
68
+ self.auto_capture_sessions = false
65
69
  self.session_endpoint = DEFAULT_SESSION_ENDPOINT
66
70
 
67
71
  # SystemExit and Interrupt are common Exception types seen with successful
@@ -4,18 +4,13 @@ require "uri"
4
4
  module Bugsnag
5
5
  module Delivery
6
6
  class Synchronous
7
- BACKOFF_THREADS = {}
8
- BACKOFF_REQUESTS = {}
9
- BACKOFF_LOCK = Mutex.new
10
-
11
7
  class << self
12
8
  def deliver(url, body, configuration, options={})
13
9
  begin
14
10
  response = request(url, body, configuration, options)
15
11
  configuration.debug("Request to #{url} completed, status: #{response.code}")
16
- success = options[:success] || '200'
17
- if options[:backoff] && !(response.code == success)
18
- backoff(url, body, configuration, options)
12
+ if response.code[0] != "2"
13
+ configuration.warn("Notifications to #{url} was reported unsuccessful with code #{response.code}")
19
14
  end
20
15
  rescue StandardError => e
21
16
  # KLUDGE: Since we don't re-raise http exceptions, this breaks rspec
@@ -31,11 +26,6 @@ module Bugsnag
31
26
  def request(url, body, configuration, options)
32
27
  uri = URI.parse(url)
33
28
 
34
- if options[:trim_payload]
35
- body = Bugsnag::Helpers.trim_if_needed(body)
36
- end
37
- payload = ::JSON.dump(body)
38
-
39
29
  if configuration.proxy_host
40
30
  http = Net::HTTP.new(uri.host, uri.port, configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password)
41
31
  else
@@ -54,90 +44,11 @@ module Bugsnag
54
44
  headers.merge!(default_headers)
55
45
 
56
46
  request = Net::HTTP::Post.new(path(uri), headers)
57
- request.body = payload
47
+ request.body = body
58
48
 
59
49
  http.request(request)
60
50
  end
61
51
 
62
- def backoff(url, body, configuration, options)
63
- # Ensure we have the latest configuration for making these requests
64
- @latest_configuration = configuration
65
-
66
- BACKOFF_LOCK.lock
67
- begin
68
- # Define an exit function once to handle outstanding requests
69
- @registered_at_exit = false unless defined?(@registered_at_exit)
70
- if !@registered_at_exit
71
- @registered_at_exit = true
72
- at_exit do
73
- backoff_exit
74
- end
75
- end
76
- if BACKOFF_REQUESTS[url] && !BACKOFF_REQUESTS[url].empty?
77
- last_request = BACKOFF_REQUESTS[url].last
78
- new_body_length = ::JSON.dump(body).length
79
- old_body_length = ::JSON.dump(last_request[:body]).length
80
- if new_body_length + old_body_length >= Bugsnag::Helpers::MAX_PAYLOAD_LENGTH
81
- BACKOFF_REQUESTS[url].push({:body => body, :options => options})
82
- else
83
- Bugsnag::Helpers::deep_merge!(last_request, {:body => body, :options => options})
84
- end
85
- else
86
- BACKOFF_REQUESTS[url] = [{:body => body, :options => options}]
87
- end
88
- if !(BACKOFF_THREADS[url] && BACKOFF_THREADS[url].status)
89
- spawn_backoff_thread(url)
90
- end
91
- ensure
92
- BACKOFF_LOCK.unlock
93
- end
94
- end
95
-
96
- def backoff_exit
97
- # Kill existing threads
98
- BACKOFF_THREADS.each do |url, thread|
99
- thread.exit
100
- end
101
- # Retry outstanding requests once, then exit
102
- BACKOFF_REQUESTS.each do |url, requests|
103
- requests.map! do |req|
104
- response = request(url, req[:body], @latest_configuration, req[:options])
105
- success = req[:options][:success] || '200'
106
- response.code == success
107
- end
108
- requests.reject! { |i| i }
109
- @latest_configuration.warn("Requests to #{url} finished, #{requests.size} failed")
110
- end
111
- end
112
-
113
- def spawn_backoff_thread(url)
114
- new_thread = Thread.new(url) do |url|
115
- interval = 2
116
- while BACKOFF_REQUESTS[url].size > 0
117
- sleep(interval)
118
- interval = interval * 2
119
- interval = 600 if interval > 600
120
- BACKOFF_LOCK.lock
121
- begin
122
- BACKOFF_REQUESTS[url].map! do |req|
123
- response = request(url, req[:body], @latest_configuration, req[:options])
124
- success = req[:options][:success] || '200'
125
- if response.code == success
126
- @latest_configuration.debug("Request to #{url} completed, status: #{response.code}")
127
- false
128
- else
129
- req
130
- end
131
- end
132
- BACKOFF_REQUESTS[url].reject! { |i| !i }
133
- ensure
134
- BACKOFF_LOCK.unlock
135
- end
136
- end
137
- end
138
- BACKOFF_THREADS[url] = new_thread
139
- end
140
-
141
52
  def path(uri)
142
53
  uri.path == "" ? "/" : uri.path
143
54
  end
@@ -34,7 +34,9 @@ module Bugsnag
34
34
  def call(env)
35
35
  # Set the request data for bugsnag middleware to use
36
36
  Bugsnag.configuration.set_request_data(:rack_env, env)
37
- Bugsnag.session_tracker.create_session
37
+ if Bugsnag.configuration.auto_capture_sessions
38
+ Bugsnag.start_session
39
+ end
38
40
 
39
41
  begin
40
42
  response = @app.call(env)
@@ -1,18 +1,16 @@
1
1
  require 'thread'
2
2
  require 'time'
3
3
  require 'securerandom'
4
+ require 'concurrent'
4
5
 
5
6
  module Bugsnag
6
7
  class SessionTracker
7
8
 
8
9
  THREAD_SESSION = "bugsnag_session"
9
- TIME_THRESHOLD = 60
10
- FALLBACK_TIME = 300
11
- MAXIMUM_SESSION_COUNT = 50
12
10
  SESSION_PAYLOAD_VERSION = "1.0"
11
+ MUTEX = Mutex.new
13
12
 
14
13
  attr_reader :session_counts
15
- attr_writer :config
16
14
 
17
15
  def self.set_current_session(session)
18
16
  Thread.current[THREAD_SESSION] = session
@@ -22,15 +20,12 @@ module Bugsnag
22
20
  Thread.current[THREAD_SESSION]
23
21
  end
24
22
 
25
- def initialize(configuration)
26
- @session_counts = {}
27
- @config = configuration
28
- @mutex = Mutex.new
29
- @last_sent = Time.now
23
+ def initialize
24
+ @session_counts = Concurrent::Hash.new(0)
30
25
  end
31
26
 
32
- def create_session
33
- return unless @config.track_sessions
27
+ def start_session
28
+ start_delivery_thread
34
29
  start_time = Time.now().utc().strftime('%Y-%m-%dT%H:%M:00')
35
30
  new_session = {
36
31
  :id => SecureRandom.uuid,
@@ -41,117 +36,93 @@ module Bugsnag
41
36
  }
42
37
  }
43
38
  SessionTracker.set_current_session(new_session)
44
- add_thread = Thread.new { add_session(start_time) }
45
- add_thread.join()
39
+ add_session(start_time)
46
40
  end
47
41
 
48
- def send_sessions
49
- @mutex.lock
50
- begin
51
- deliver_sessions
52
- ensure
53
- @mutex.unlock
54
- end
55
- end
56
-
57
- private
58
- def add_session(min)
59
- @mutex.lock
60
- begin
61
- @registered_at_exit = false unless defined?(@registered_at_exit)
62
- if !@registered_at_exit
63
- @registered_at_exit = true
64
- at_exit do
65
- if !@deliver_fallback.nil? && @deliver_fallback.status == 'sleep'
66
- @deliver_fallback.terminate
67
- end
68
- deliver_sessions
69
- end
70
- end
71
- @session_counts[min] ||= 0
72
- @session_counts[min] += 1
73
- if Time.now() - @last_sent > TIME_THRESHOLD
74
- deliver_sessions
75
- end
76
- ensure
77
- @mutex.unlock
78
- end
79
- end
42
+ alias_method :create_session, :start_session
80
43
 
81
- def deliver_sessions
82
- return unless @config.track_sessions
44
+ def send_sessions
83
45
  sessions = []
84
- @session_counts.each do |min, count|
46
+ counts = @session_counts
47
+ @session_counts = Concurrent::Hash.new(0)
48
+ counts.each do |min, count|
85
49
  sessions << {
86
50
  :startedAt => min,
87
51
  :sessionsStarted => count
88
52
  }
89
- if sessions.size >= MAXIMUM_SESSION_COUNT
90
- deliver(sessions)
91
- sessions = []
92
- end
93
53
  end
94
- @session_counts = {}
95
- reset_delivery_thread
96
54
  deliver(sessions)
97
55
  end
98
56
 
99
- def reset_delivery_thread
100
- if !@deliver_fallback.nil? && @deliver_fallback.status == 'sleep'
101
- @deliver_fallback.terminate
102
- end
103
- @deliver_fallback = Thread.new do
104
- sleep(FALLBACK_TIME)
105
- deliver_sessions
57
+ def start_delivery_thread
58
+ MUTEX.synchronize do
59
+ @started = nil unless defined?(@started)
60
+ return if @started == Process.pid
61
+ @started = Process.pid
62
+ at_exit do
63
+ if !@delivery_thread.nil?
64
+ @delivery_thread.execute
65
+ @delivery_thread.shutdown
66
+ else
67
+ if @session_counts.size > 0
68
+ send_sessions
69
+ end
70
+ end
71
+ end
72
+ @delivery_thread = Concurrent::TimerTask.new(execution_interval: 30) do
73
+ if @session_counts.size > 0
74
+ send_sessions
75
+ end
76
+ end
106
77
  end
107
78
  end
108
79
 
109
- def deliver(sessionCounts)
110
- if sessionCounts.length == 0
111
- @config.debug("No sessions to deliver")
112
- return
113
- end
114
-
115
- if !@config.valid_api_key?
116
- @config.debug("Not delivering sessions due to an invalid api_key")
80
+ private
81
+ def add_session(min)
82
+ @session_counts[min] += 1
83
+ end
84
+
85
+ def deliver(session_payload)
86
+ if session_payload.length == 0
87
+ Bugsnag.configuration.debug("No sessions to deliver")
117
88
  return
118
89
  end
119
-
120
- if !@config.should_notify_release_stage?
121
- @config.debug("Not delivering sessions due to notify_release_stages :#{@config.notify_release_stages.inspect}")
90
+
91
+ if !Bugsnag.configuration.valid_api_key?
92
+ Bugsnag.configuration.debug("Not delivering sessions due to an invalid api_key")
122
93
  return
123
94
  end
124
95
 
125
- if @config.delivery_method != :thread_queue
126
- @config.debug("Not delivering sessions due to asynchronous delivery being disabled")
96
+ if !Bugsnag.configuration.should_notify_release_stage?
97
+ Bugsnag.configuration.debug("Not delivering sessions due to notify_release_stages :#{Bugsnag.configuration.notify_release_stages.inspect}")
127
98
  return
128
99
  end
129
-
130
- payload = {
100
+
101
+ body = {
131
102
  :notifier => {
132
103
  :name => Bugsnag::Report::NOTIFIER_NAME,
133
104
  :url => Bugsnag::Report::NOTIFIER_URL,
134
105
  :version => Bugsnag::Report::NOTIFIER_VERSION
135
106
  },
136
107
  :device => {
137
- :hostname => @config.hostname
108
+ :hostname => Bugsnag.configuration.hostname
138
109
  },
139
110
  :app => {
140
- :version => @config.app_version,
141
- :releaseStage => @config.release_stage,
142
- :type => @config.app_type
111
+ :version => Bugsnag.configuration.app_version,
112
+ :releaseStage => Bugsnag.configuration.release_stage,
113
+ :type => Bugsnag.configuration.app_type
143
114
  },
144
- :sessionCounts => sessionCounts
115
+ :sessionCounts => session_payload
145
116
  }
117
+ payload = ::JSON.dump(body)
146
118
 
147
119
  headers = {
148
- "Bugsnag-Api-Key" => @config.api_key,
120
+ "Bugsnag-Api-Key" => Bugsnag.configuration.api_key,
149
121
  "Bugsnag-Payload-Version" => SESSION_PAYLOAD_VERSION
150
122
  }
151
123
 
152
- options = {:headers => headers, :backoff => true, :success => '202'}
153
- @last_sent = Time.now
154
- Bugsnag::Delivery[@config.delivery_method].deliver(@config.session_endpoint, payload, @config, options)
124
+ options = {:headers => headers}
125
+ Bugsnag::Delivery[Bugsnag.configuration.delivery_method].deliver(Bugsnag.configuration.session_endpoint, payload, Bugsnag.configuration, options)
155
126
  end
156
127
  end
157
128
  end
@@ -25,7 +25,7 @@ describe Bugsnag::Configuration do
25
25
 
26
26
  it "should have sensible defaults for session tracking" do
27
27
  expect(subject.session_endpoint).to eq("https://sessions.bugsnag.com")
28
- expect(subject.track_sessions).to be false
28
+ expect(subject.auto_capture_sessions).to be false
29
29
  end
30
30
  end
31
31
 
@@ -1006,7 +1006,7 @@ describe Bugsnag::Report do
1006
1006
  Bugsnag.notify(exception)
1007
1007
  expect(Bugsnag).not_to have_sent_notification
1008
1008
  end
1009
-
1009
+
1010
1010
 
1011
1011
  if defined?(JRUBY_VERSION)
1012
1012
 
@@ -8,8 +8,6 @@ describe Bugsnag::SessionTracker do
8
8
  queue = Queue.new
9
9
 
10
10
  before do
11
- @config = Bugsnag::Configuration.new
12
- @config.track_sessions = true
13
11
  server = WEBrick::HTTPServer.new :Port => 0, :Logger => WEBrick::Log.new("/dev/null"), :AccessLog => []
14
12
  server.mount_proc '/' do |req, res|
15
13
  headers = []
@@ -21,26 +19,18 @@ describe Bugsnag::SessionTracker do
21
19
  Thread.new{ server.start }
22
20
  end
23
21
 
24
- after do
22
+ after do
25
23
  Bugsnag.configure do |conf|
26
- conf.track_sessions = false
24
+ conf.auto_capture_sessions = false
27
25
  conf.delivery_method = :synchronous
28
26
  end
29
27
  server.stop
30
28
  queue.clear
31
29
  end
32
30
 
33
- it 'does not create session object if disabled' do
34
- config = Bugsnag::Configuration.new
35
- config.track_sessions = false
36
- tracker = Bugsnag::SessionTracker.new(config)
37
- tracker.create_session
38
- expect(tracker.session_counts.size).to eq(0)
39
- end
40
-
41
31
  it 'adds session object to queue' do
42
- tracker = Bugsnag::SessionTracker.new(@config)
43
- tracker.create_session
32
+ tracker = Bugsnag::SessionTracker.new
33
+ tracker.start_session
44
34
  expect(tracker.session_counts.size).to eq(1)
45
35
  time = tracker.session_counts.keys.last
46
36
  count = tracker.session_counts[time]
@@ -49,8 +39,8 @@ describe Bugsnag::SessionTracker do
49
39
  end
50
40
 
51
41
  it 'stores session in thread' do
52
- tracker = Bugsnag::SessionTracker.new(@config)
53
- tracker.create_session
42
+ tracker = Bugsnag::SessionTracker.new
43
+ tracker.start_session
54
44
  session = Thread.current[Bugsnag::SessionTracker::THREAD_SESSION]
55
45
  expect(session.include? :id).to be true
56
46
  expect(session.include? :startedAt).to be true
@@ -62,28 +52,25 @@ describe Bugsnag::SessionTracker do
62
52
  end
63
53
 
64
54
  it 'gives unique ids to each session' do
65
- tracker = Bugsnag::SessionTracker.new(@config)
66
- tracker.create_session
55
+ tracker = Bugsnag::SessionTracker.new
56
+ tracker.start_session
67
57
  session_one = Thread.current[Bugsnag::SessionTracker::THREAD_SESSION]
68
- tracker.create_session
58
+ tracker.start_session
69
59
  session_two = Thread.current[Bugsnag::SessionTracker::THREAD_SESSION]
70
60
  expect(session_one[:id]).to_not eq(session_two[:id])
71
61
  end
72
62
 
73
63
  it 'sends sessions when send_sessions is called' do
74
64
  Bugsnag.configure do |conf|
75
- conf.track_sessions = true
76
- conf.delivery_method = :thread_queue
65
+ conf.auto_capture_sessions = true
66
+ conf.delivery_method = :synchronous
77
67
  conf.session_endpoint = "http://localhost:#{server.config[:Port]}"
78
68
  end
79
69
  WebMock.allow_net_connect!
80
- Bugsnag.session_tracker.create_session
70
+ Bugsnag.start_session
81
71
  expect(Bugsnag.session_tracker.session_counts.size).to eq(1)
82
72
  Bugsnag.session_tracker.send_sessions
83
73
  expect(Bugsnag.session_tracker.session_counts.size).to eq(0)
84
- while queue.empty?
85
- sleep(0.05)
86
- end
87
74
  payload, headers = queue.pop
88
75
  expect(payload.include?("app")).to be true
89
76
  expect(payload.include?("notifier")).to be true
@@ -94,19 +81,16 @@ describe Bugsnag::SessionTracker do
94
81
 
95
82
  it 'sets details from config' do
96
83
  Bugsnag.configure do |conf|
97
- conf.track_sessions = true
84
+ conf.auto_capture_sessions = true
98
85
  conf.release_stage = "test_stage"
99
- conf.delivery_method = :thread_queue
86
+ conf.delivery_method = :synchronous
100
87
  conf.session_endpoint = "http://localhost:#{server.config[:Port]}"
101
88
  end
102
89
  WebMock.allow_net_connect!
103
- Bugsnag.session_tracker.create_session
90
+ Bugsnag.start_session
104
91
  expect(Bugsnag.session_tracker.session_counts.size).to eq(1)
105
92
  Bugsnag.session_tracker.send_sessions
106
93
  expect(Bugsnag.session_tracker.session_counts.size).to eq(0)
107
- while queue.empty?
108
- sleep(0.05)
109
- end
110
94
  payload, headers = queue.pop
111
95
  notifier = payload["notifier"]
112
96
  expect(notifier.include?("name")).to be true
@@ -131,10 +115,10 @@ describe Bugsnag::SessionTracker do
131
115
 
132
116
  it 'uses middleware to attach session to notification' do
133
117
  Bugsnag.configure do |conf|
134
- conf.track_sessions = true
118
+ conf.auto_capture_sessions = true
135
119
  conf.release_stage = "test_stage"
136
120
  end
137
- Bugsnag.session_tracker.create_session
121
+ Bugsnag.start_session
138
122
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
139
123
  expect(Bugsnag).to have_sent_notification{ |payload, headers|
140
124
  event = payload["events"][0]
@@ -23,10 +23,6 @@ def get_event_from_payload(payload)
23
23
  payload["events"].first
24
24
  end
25
25
 
26
- def get_headers_from_payload(payload)
27
-
28
- end
29
-
30
26
  def get_exception_from_payload(payload)
31
27
  event = get_event_from_payload(payload)
32
28
  expect(event["exceptions"].size).to eq(1)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.0
4
+ version: 6.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-04 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: concurrent-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
13
27
  description: Ruby notifier for bugsnag.com
14
28
  email: james@bugsnag.com
15
29
  executables: []