diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-16 18:08:12 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-29 17:13:03 +0300 |
commit | 62ef34cb400eeacdd5d1da0d8edee97d6f742ecc (patch) | |
tree | 67e8b2b2ac0bba5992e286395aed1fa1cb496da3 /lib/gitlab/metrics/subscribers | |
parent | 66c1acba0bada535cedcdc4d8e62ff966b4d0374 (diff) |
Put View instrumentation and transaction memory use behind feature
Diffstat (limited to 'lib/gitlab/metrics/subscribers')
-rw-r--r-- | lib/gitlab/metrics/subscribers/action_view.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/metrics/subscribers/action_view.rb b/lib/gitlab/metrics/subscribers/action_view.rb index 5c390a077c2..2e3beb05294 100644 --- a/lib/gitlab/metrics/subscribers/action_view.rb +++ b/lib/gitlab/metrics/subscribers/action_view.rb @@ -4,9 +4,11 @@ module Gitlab # Class for tracking the rendering timings of views. class ActionView < ActiveSupport::Subscriber include Gitlab::Metrics::Concern - histogram :gitlab_view_rendering_duration_seconds, 'View rendering time', - base_labels: Transaction::BASE_LABELS.merge({ path: nil }), - buckets: [0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.500, 2.0, 10.0] + define_histogram :gitlab_view_rendering_duration_seconds, + docstring: 'View rendering time', + base_labels: Transaction::BASE_LABELS.merge({ path: nil }), + buckets: [0.001, 0.01, 0.1, 10.0], + with_feature: :prometheus_metrics_view_instrumentation attach_to :action_view @@ -24,7 +26,7 @@ module Gitlab values = values_for(event) tags = tags_for(event) - gitlab_view_rendering_duration_seconds.observe(current_transaction.labels.merge(tags), event.duration) + self.class.gitlab_view_rendering_duration_seconds.observe(current_transaction.labels.merge(tags), event.duration) current_transaction.increment(:view_duration, event.duration) current_transaction.add_metric(SERIES, values, tags) |