Put View instrumentation and transaction memory use behind feature
This commit is contained in:
		
							parent
							
								
									66c1acba0b
								
							
						
					
					
						commit
						62ef34cb40
					
				|  | @ -4,9 +4,11 @@ module Gitlab | ||||||
|       # Class for tracking the rendering timings of views. |       # Class for tracking the rendering timings of views. | ||||||
|       class ActionView < ActiveSupport::Subscriber |       class ActionView < ActiveSupport::Subscriber | ||||||
|         include Gitlab::Metrics::Concern |         include Gitlab::Metrics::Concern | ||||||
|         histogram :gitlab_view_rendering_duration_seconds, 'View rendering time', |         define_histogram :gitlab_view_rendering_duration_seconds, | ||||||
|  |                          docstring: 'View rendering time', | ||||||
|                          base_labels: Transaction::BASE_LABELS.merge({ path: nil }), |                          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] |                          buckets: [0.001, 0.01, 0.1, 10.0], | ||||||
|  |                          with_feature: :prometheus_metrics_view_instrumentation | ||||||
| 
 | 
 | ||||||
|         attach_to :action_view |         attach_to :action_view | ||||||
| 
 | 
 | ||||||
|  | @ -24,7 +26,7 @@ module Gitlab | ||||||
|           values = values_for(event) |           values = values_for(event) | ||||||
|           tags   = tags_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.increment(:view_duration, event.duration) | ||||||
|           current_transaction.add_metric(SERIES, values, tags) |           current_transaction.add_metric(SERIES, values, tags) | ||||||
|  |  | ||||||
|  | @ -140,13 +140,13 @@ module Gitlab | ||||||
|       define_histogram :gitlab_transaction_duration_seconds, |       define_histogram :gitlab_transaction_duration_seconds, | ||||||
|                        docstring: 'Transaction duration', |                        docstring: 'Transaction duration', | ||||||
|                        base_labels: BASE_LABELS, |                        base_labels: BASE_LABELS, | ||||||
|                        buckets: [0.001, 0.01, 0.1, 0.5, 10.0], |                        buckets: [0.001, 0.01, 0.1, 0.5, 10.0] | ||||||
|                        with_feature: :prometheus_metrics_method_instrumentation |  | ||||||
| 
 | 
 | ||||||
|       define_histogram :gitlab_transaction_allocated_memory_bytes, |       define_histogram :gitlab_transaction_allocated_memory_bytes, | ||||||
|                        docstring: 'Transaction allocated memory bytes', |                        docstring: 'Transaction allocated memory bytes', | ||||||
|                        base_labels: BASE_LABELS, |                        base_labels: BASE_LABELS, | ||||||
|                        buckets: [100, 1000, 10000, 100000, 1000000, 10000000] |                        buckets: [100, 1000, 10000, 100000, 1000000, 10000000], | ||||||
|  |                        with_feature: :prometheus_metrics_transaction_allocated_memory | ||||||
| 
 | 
 | ||||||
|       def self.transaction_metric(name, type, prefix: nil, tags: {}) |       def self.transaction_metric(name, type, prefix: nil, tags: {}) | ||||||
|         metric_name = "gitlab_transaction_#{prefix}#{name}_total".to_sym |         metric_name = "gitlab_transaction_#{prefix}#{name}_total".to_sym | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue