Class: Quilt::Performance::Client
- Inherits:
-
Object
- Object
- Quilt::Performance::Client
- Defined in:
- lib/quilt_rails/performance/client.rb
Class Method Summary collapse
Instance Method Summary collapse
- #distribution(metric_name, value, tags = {}) ⇒ Object
-
#initialize(report) ⇒ Client
constructor
A new instance of Client.
- #on_distribution(&block) ⇒ Object
- #on_event(&block) ⇒ Object
- #on_navigation(&block) ⇒ Object
Constructor Details
#initialize(report) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/quilt_rails/performance/client.rb', line 6 def initialize(report) @report = report @base_tags = { browser_connection_type: report.connection.effective_type, }.freeze @distribution_callback = proc { |_name, _value, | nil } @event_callback = proc { |_event, | {} } @navigation_callback = proc { |, | {} } end |
Class Method Details
Instance Method Details
#distribution(metric_name, value, tags = {}) ⇒ Object
28 29 30 31 |
# File 'lib/quilt_rails/performance/client.rb', line 28 def distribution(metric_name, value, = {}) @distribution_callback.call(metric_name, value, ) StatsD.distribution(metric_name, value, tags: ) unless Rails.env.dev? end |
#on_distribution(&block) ⇒ Object
41 42 43 |
# File 'lib/quilt_rails/performance/client.rb', line 41 def on_distribution(&block) @distribution_callback = block end |
#on_event(&block) ⇒ Object
37 38 39 |
# File 'lib/quilt_rails/performance/client.rb', line 37 def on_event(&block) @event_callback = block end |
#on_navigation(&block) ⇒ Object
33 34 35 |
# File 'lib/quilt_rails/performance/client.rb', line 33 def (&block) @navigation_callback = block end |