Skip to content

Commit a9458c4

Browse files
authored
Merge pull request #179 from hennevogel/release/1.0.3
Release 1.0.3
2 parents 860a6d4 + 6c5001a commit a9458c4

File tree

8 files changed

+22
-7
lines changed

8 files changed

+22
-7
lines changed

.rubocop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ AllCops:
1111
- 'vendor/bundle/**/*'
1212
DisplayCopNames: true
1313
StyleGuideCopsOnly: false
14-
TargetRubyVersion: 2.4
14+
TargetRubyVersion: 2.5
15+
NewCops: enable
1516

1617
Layout/EmptyLinesAroundArguments:
1718
Enabled: false

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

5+
## v1.0.3, released 2021-09-15
6+
7+
- In case of unhandled exceptions, set status in measurements like Rails.logger does
8+
- Require Ruby 2.5
9+
510
## v1.0.2, released 2021-04-13
611

712
Fix passing booleans to custom tags.

influxdb-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
2222
spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
2323
spec.require_paths = ["lib"]
2424

25-
spec.required_ruby_version = ">= 2.4.0"
25+
spec.required_ruby_version = ">= 2.5.0"
2626

2727
spec.add_runtime_dependency "influxdb", "~> 0.6", ">= 0.6.4"
2828
spec.add_runtime_dependency "railties", ">= 5.0"

lib/influxdb/rails/middleware/request_subscriber.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def tags
1616
{
1717
method: "#{payload[:controller]}##{payload[:action]}",
1818
hook: "process_action",
19-
status: payload[:status],
19+
status: status,
2020
format: payload[:format],
2121
http_method: payload[:method],
2222
exception: payload[:exception]&.first,
@@ -38,6 +38,14 @@ def started
3838
configuration.client.time_precision
3939
)
4040
end
41+
42+
def status
43+
if payload[:exception] && ::Rails::VERSION::MAJOR < 7
44+
ActionDispatch::ExceptionWrapper.status_code_for_exception(payload[:exception].first)
45+
else
46+
payload[:status]
47+
end
48+
end
4149
end
4250
end
4351
end

lib/influxdb/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module InfluxDB
22
module Rails
3-
VERSION = "1.0.2".freeze
3+
VERSION = "1.0.3".freeze
44
end
55
end

spec/requests/action_controller_metrics_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
tags: a_hash_including(
9090
method: "ExceptionsController#index",
9191
hook: "process_action",
92-
exception: "ZeroDivisionError"
92+
exception: "ActiveRecord::RecordNotFound",
93+
status: 404
9394
)
9495
)
9596
end

spec/support/rails5/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def show
7676

7777
class ExceptionsController < ApplicationController
7878
def index
79-
1 / 0
79+
raise ActiveRecord::RecordNotFound
8080
end
8181
end
8282

spec/support/rails6/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def show
7676

7777
class ExceptionsController < ApplicationController
7878
def index
79-
1 / 0
79+
raise ActiveRecord::RecordNotFound
8080
end
8181
end
8282

0 commit comments

Comments
 (0)