sapience 2.6.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f226140ba0d2f76e27b4dc192b5716b30bf2b8c0
4
- data.tar.gz: a6a211fa511f012cdbf2cfef2c715265700f0d52
3
+ metadata.gz: b73285e98f5fc0d1a47770f8a9aaa46ca9cdb392
4
+ data.tar.gz: 06904793b69382fff48e1cfdd8deaaa8b277f682
5
5
  SHA512:
6
- metadata.gz: dafce9efeff1f843fe91c1b1af13c76330662cd54a7e5bf812568da2a044b6478d5122b87c70ebe13e17b0df10ccf7eb412671c1b69b7dcd3808ea7a03e0f1c5
7
- data.tar.gz: 15cf8edc1204dd957784a31baca9c84fd5f730a544574e1261187b889d1ff4609c5c8b3aff66b53fac3240b04ad3eaae1f6e71f5323454111fbf3167df7e9fcf
6
+ metadata.gz: e97abc320690cbea9cbb02a8658ddaa4391f350c665b11122ce8a4b432d84c3def3b808b1ac2460447d96b6fd980e243f9342a749227145802918b7e54c9e30b
7
+ data.tar.gz: 8704dd5f928835b063eeb2fbd9fa24780cff06a6736db54335085acc4c056502d7ff8fb06810044b02f91140593c61337caa79a8578e18b9c89019fe02a9850c
@@ -1,3 +1,18 @@
1
+ ## v2.7.0
2
+ - Add ability to stop generating metrics for ActiveRecord::Notification with config option `silent_active_record`
3
+
4
+ ## v2.6.4
5
+ - Bugfix: don't auto-add tags for every application level exception
6
+
7
+ ## v2.6.3
8
+ - Include current environment in log entries
9
+
10
+ ## v2.6.2
11
+ - Bugfix: clear tags after pushing log to processing queue
12
+
13
+ ## v2.6.1
14
+ - Bugfix: Fix sentry logging when payload is nil
15
+
1
16
  ## v2.6.0
2
17
 
3
18
  - Add ability to reduce noise from default rails log subscribers with config option `silent_rails`
@@ -8,7 +8,7 @@ module Sapience
8
8
  attr_reader :default_level, :backtrace_level, :backtrace_level_index
9
9
  attr_writer :host
10
10
  attr_accessor :app_name, :ap_options, :appenders, :log_executor, :filter_parameters,
11
- :metrics, :error_handler, :silent_rails
11
+ :metrics, :error_handler, :silent_active_record, :silent_rails
12
12
 
13
13
  SUPPORTED_EXECUTORS = %i(single_thread_executor immediate_executor).freeze
14
14
  DEFAULT = {
@@ -20,6 +20,7 @@ module Sapience
20
20
  metrics: { datadog: { url: Sapience::DEFAULT_STATSD_URL } },
21
21
  error_handler: { silent: {} },
22
22
  filter_parameters: %w(password password_confirmation),
23
+ silent_active_record: false,
23
24
  silent_rails: false,
24
25
  }.freeze
25
26
 
@@ -39,7 +40,8 @@ module Sapience
39
40
  self.filter_parameters = @options[:filter_parameters]
40
41
  self.metrics = @options[:metrics]
41
42
  self.error_handler = @options[:error_handler]
42
- self.silent_rails = @options[:silent_rails]
43
+ self.silent_active_record = @options[:silent_active_record]
44
+ self.silent_rails = @options[:silent_rails]
43
45
  end
44
46
 
45
47
  # Sets the global default log level
@@ -55,14 +55,12 @@ module Sapience
55
55
  @logger.info(parameters)
56
56
  end
57
57
 
58
- def after_exception(exc)
59
- Sapience.push_tags(exc.class.name, exc.message)
58
+ def after_exception(exc) # rubocop:disable Lint/UnusedMethodArgument
60
59
  @status = 500
61
60
  after
62
61
  end
63
62
 
64
63
  def after_failure(error)
65
- Sapience.push_tags(error[:message])
66
64
  @status = error[:status]
67
65
  after
68
66
  end
@@ -172,7 +172,7 @@ module Sapience
172
172
  end
173
173
 
174
174
  # Returns [Hash] representation of this log entry
175
- def to_h(host = Sapience.config.host, app_name = Sapience.app_name) # rubocop:disable AbcSize, CyclomaticComplexity, PerceivedComplexity, LineLength
175
+ def to_h(host = Sapience.config.host, app_name = Sapience.app_name, environment = Sapience.environment) # rubocop:disable AbcSize, CyclomaticComplexity, PerceivedComplexity, LineLength
176
176
  # Header
177
177
  h = {
178
178
  name: name,
@@ -181,6 +181,7 @@ module Sapience
181
181
  time: time,
182
182
  level: level,
183
183
  level_index: level_index,
184
+ environment: environment,
184
185
  }
185
186
  h[:host] = host if host
186
187
  h[:app_name] = app_name if app_name
@@ -142,6 +142,7 @@ module Sapience
142
142
  $stderr.write("Appender thread: Failed to log to appender: #{appender.inspect}\n #{exc.inspect}")
143
143
  end
144
144
  end
145
+ Sapience.clear_tags!
145
146
  end
146
147
  end
147
148
  end
@@ -78,7 +78,9 @@ module Sapience
78
78
 
79
79
  Sapience::Extensions::ActionController::LogSubscriber.attach_to :action_controller
80
80
  # Sapience::Extensions::ActiveSupport::MailerLogSubscriber.attach_to :action_mailer
81
- Sapience::Extensions::ActiveRecord::Notifications.use if defined?(ActiveRecord)
81
+ if defined?(ActiveRecord) && !Sapience.config.silent_active_record
82
+ Sapience::Extensions::ActiveRecord::Notifications.use
83
+ end
82
84
  Sapience::Extensions::ActionView::LogSubscriber.attach_to :action_view
83
85
  # Sapience::Extensions::ActiveJob::LogSubscriber.attach_to :active_job
84
86
  Sapience::Extensions::ActionController::Notifications.use
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Sapience
3
- VERSION = "2.6.1"
3
+ VERSION = "2.7.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapience
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-09 00:00:00.000000000 Z
12
+ date: 2018-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby