Skip to content

Commit

Permalink
Merge pull request #179 from hennevogel/release/1.0.3
Browse files Browse the repository at this point in the history
Release 1.0.3
  • Loading branch information
hennevogel authored Sep 15, 2021
2 parents 860a6d4 + 6c5001a commit a9458c4
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ AllCops:
- 'vendor/bundle/**/*'
DisplayCopNames: true
StyleGuideCopsOnly: false
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5
NewCops: enable

Layout/EmptyLinesAroundArguments:
Enabled: false
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

For the full commit log, [see here](https://github.com/influxdata/influxdb-rails/commits/one-stable).

## v1.0.3, released 2021-09-15

- In case of unhandled exceptions, set status in measurements like Rails.logger does
- Require Ruby 2.5

## v1.0.2, released 2021-04-13

Fix passing booleans to custom tags.
Expand Down
2 changes: 1 addition & 1 deletion influxdb-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.4.0"
spec.required_ruby_version = ">= 2.5.0"

spec.add_runtime_dependency "influxdb", "~> 0.6", ">= 0.6.4"
spec.add_runtime_dependency "railties", ">= 5.0"
Expand Down
10 changes: 9 additions & 1 deletion lib/influxdb/rails/middleware/request_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def tags
{
method: "#{payload[:controller]}##{payload[:action]}",
hook: "process_action",
status: payload[:status],
status: status,
format: payload[:format],
http_method: payload[:method],
exception: payload[:exception]&.first,
Expand All @@ -38,6 +38,14 @@ def started
configuration.client.time_precision
)
end

def status
if payload[:exception] && ::Rails::VERSION::MAJOR < 7
ActionDispatch::ExceptionWrapper.status_code_for_exception(payload[:exception].first)
else
payload[:status]
end
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/influxdb/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module InfluxDB
module Rails
VERSION = "1.0.2".freeze
VERSION = "1.0.3".freeze
end
end
3 changes: 2 additions & 1 deletion spec/requests/action_controller_metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
tags: a_hash_including(
method: "ExceptionsController#index",
hook: "process_action",
exception: "ZeroDivisionError"
exception: "ActiveRecord::RecordNotFound",
status: 404
)
)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/rails5/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def show

class ExceptionsController < ApplicationController
def index
1 / 0
raise ActiveRecord::RecordNotFound
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/rails6/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def show

class ExceptionsController < ApplicationController
def index
1 / 0
raise ActiveRecord::RecordNotFound
end
end

Expand Down

0 comments on commit a9458c4

Please sign in to comment.