Skip to content

Commit 4e44bc4

Browse files
authored
Ability to customize the bucket sizing for histograms (#32)
1 parent 3874b3c commit 4e44bc4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/yabeda/rails.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def on_controller_action(&block)
2929
def install!
3030
Yabeda.configure do
3131
config = ::Yabeda::Rails.config
32+
buckets = config.buckets || LONG_RUNNING_REQUEST_BUCKETS
3233

3334
group :rails
3435

@@ -37,14 +38,14 @@ def install!
3738

3839
histogram :request_duration, tags: %i[controller action status format method],
3940
unit: :seconds,
40-
buckets: LONG_RUNNING_REQUEST_BUCKETS,
41+
buckets: buckets,
4142
comment: "A histogram of the response latency."
4243

43-
histogram :view_runtime, unit: :seconds, buckets: LONG_RUNNING_REQUEST_BUCKETS,
44+
histogram :view_runtime, unit: :seconds, buckets: buckets,
4445
comment: "A histogram of the view rendering time.",
4546
tags: %i[controller action status format method]
4647

47-
histogram :db_runtime, unit: :seconds, buckets: LONG_RUNNING_REQUEST_BUCKETS,
48+
histogram :db_runtime, unit: :seconds, buckets: buckets,
4849
comment: "A histogram of the activerecord execution time.",
4950
tags: %i[controller action status format method]
5051

lib/yabeda/rails/config.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Config < ::Anyway::Config
99
config_name :yabeda_rails
1010

1111
attr_config :apdex_target
12+
attr_config :buckets
1213
attr_config controller_name_case: :snake
1314
end
1415
end

0 commit comments

Comments
 (0)