Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ end
```
`append_info_to_payload` is a method from [ActionController::Instrumentation](https://api.rubyonrails.org/classes/ActionController/Instrumentation.html#method-i-append_info_to_payload)

## Configuration

Configuration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_RAILS_`), YAML files, and other sources. See [anyway_config] docs for details.

| Config key | Type | Default | Description |
| ---------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apdex_target` | integer | nil | Tolerable time for Apdex in seconds, exposed as gauge if set. |
| `controller_name_case` | symbol | :snake | Defines whether controller name is reported in camel case (:camel) or snake case (:snake). |
| `ignore_actions` | array | [] | array of controller#action strings that should be ignored, controller should be in camel case, example `['HealthCheck::HealthCheckController#index']` |

## Development

Expand Down
2 changes: 2 additions & 0 deletions lib/yabeda/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def install!
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
event = Yabeda::Rails::Event.new(*args)

next if event.controller_action.in?(config.ignore_actions)

rails_requests_total.increment(event.labels)
rails_request_duration.measure(event.labels, event.duration)
rails_view_runtime.measure(event.labels, event.view_runtime)
Expand Down
1 change: 1 addition & 0 deletions lib/yabeda/rails/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Config < ::Anyway::Config

attr_config :apdex_target
attr_config controller_name_case: :snake
attr_config ignore_actions: []
end
end
end
4 changes: 4 additions & 0 deletions lib/yabeda/rails/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def db_runtime
ms2s payload[:db_runtime]
end

def controller_action
"#{payload[:controller]}##{payload[:action]}"
end

private

def controller
Expand Down