Skip to content

Commit 4deaf6e

Browse files
authored
Merge pull request #121 from hennevogel/feature/status_500
Record exception class name
2 parents 35b4f2b + fa151dc commit 4deaf6e

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-rails
1414
- Implement `perform_start.active_job` subscriber (https://guides.rubyonrails.org/active_support_instrumentation.html#perform-start-active-job)
1515
- Implement `perform.active_job` subscriber (https://guides.rubyonrails.org/active_support_instrumentation.html#perform-active-job)
1616
- Implement block instrumentation `InfluxDB::Rails.instrument do; 1 + 1; end`
17+
- Record unhandled exceptions as tags for process_action.action_controller
1718

1819
## v1.0.0, released 2019-10-23
1920
The Final release, no code changes.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,15 @@ Reported tags:
7171
method: "PostsController#index",
7272
http_method: "GET",
7373
format: "html",
74-
status: "200"
74+
status: ["200", ""]
75+
exception: ["", "ArgumentError"]
7576
}
7677
```
7778

79+
*Note*: If an exception happens during that particular instrumentation the
80+
`status` will be blank and the tag `exception` will contain the name of the
81+
exception class.
82+
7883
### Action View
7984

8085
Reported ActiveSupport instrumentation hooks:

lib/influxdb/rails/middleware/request_subscriber.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def tags
1919
status: payload[:status],
2020
format: payload[:format],
2121
http_method: payload[:method],
22+
exception: payload[:exception]&.first,
2223
}
2324
end
2425

spec/requests/action_controller_metrics_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474

7575
expect_metric(
7676
tags: a_hash_including(
77-
method: "ExceptionsController#index",
78-
hook: "process_action"
77+
method: "ExceptionsController#index",
78+
hook: "process_action",
79+
exception: "ZeroDivisionError"
7980
)
8081
)
8182
end

0 commit comments

Comments
 (0)