Class: NexusSemanticLogger::DatadogSingleton
- Inherits:
-
Object
- Object
- NexusSemanticLogger::DatadogSingleton
- Includes:
- Singleton
- Defined in:
- lib/nexus_semantic_logger/datadog_singleton.rb
Overview
Application wide location to get datadog objects. dogstatsd-ruby maintains its own queue and thread for flushing, so the client code should never create its own statsd instance.
Instance Attribute Summary collapse
-
#statsd ⇒ Object
Returns the value of attribute statsd.
Instance Method Summary collapse
-
#count(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
-
#decrement(metric, tags: []) ⇒ Object
Delegate to statsd (if available).
-
#distribution(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
- #flush ⇒ Object
-
#gauge(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
-
#increment(metric, tags: []) ⇒ Object
Delegate to statsd (if available).
-
#timing(metric, ms, tags: []) ⇒ Object
Delegate to statsd (if available).
Instance Attribute Details
#statsd ⇒ Object
Returns the value of attribute statsd.
10 11 12 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 10 def statsd @statsd end |
Instance Method Details
#count(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
63 64 65 66 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 63 def count(metric, value, tags: []) statsd&.count(metric, value, tags: ()) flush end |
#decrement(metric, tags: []) ⇒ Object
Delegate to statsd (if available).
27 28 29 30 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 27 def decrement(metric, tags: []) statsd&.decrement(metric, tags: ()) flush end |
#distribution(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
45 46 47 48 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 45 def distribution(metric, value, tags: []) statsd&.distribution(metric, value, tags: ()) flush end |
#flush ⇒ Object
12 13 14 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 12 def flush statsd&.flush(sync: Rails.env.development?) # Force flush sync in development, speed up checks. end |
#gauge(metric, value, tags: []) ⇒ Object
Delegate to statsd (if available).
54 55 56 57 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 54 def gauge(metric, value, tags: []) statsd&.gauge(metric, value, tags: ()) flush end |
#increment(metric, tags: []) ⇒ Object
Delegate to statsd (if available).
19 20 21 22 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 19 def increment(metric, tags: []) statsd&.increment(metric, tags: ()) flush end |
#timing(metric, ms, tags: []) ⇒ Object
Delegate to statsd (if available).
36 37 38 39 |
# File 'lib/nexus_semantic_logger/datadog_singleton.rb', line 36 def timing(metric, ms, tags: []) statsd&.timing(metric, ms, tags: ()) flush end |