class Statsby::Context
This is meant to be used as a thin layer over a client or another context as a way to organize tags.
Attributes
client[RW]
Public Class Methods
new(client, tags = {})
click to toggle source
# File lib/statsby/context.rb, line 10 def initialize(client, tags = {}) self.client = client self.tags = Statsby::TagSet.from_hash(tags) end
Public Instance Methods
counter(metric_name, value, local_tags = {})
click to toggle source
# File lib/statsby/context.rb, line 15 def counter(metric_name, value, local_tags = {}) combined_tags = tags.merge(local_tags) client.counter(metric_name, value, combined_tags) end
format_message(metric_name, value, type, message_tags = {})
click to toggle source
# File lib/statsby/context.rb, line 39 def format_message(metric_name, value, type, message_tags = {}) combined_tags = tags.merge(message_tags) client.format_message(metric_name, value, type, combined_tags) end
gauge(metric_name, value, local_tags = {})
click to toggle source
# File lib/statsby/context.rb, line 20 def gauge(metric_name, value, local_tags = {}) combined_tags = tags.merge(local_tags) client.gauge(metric_name, value, combined_tags) end
set(metric_name, value, local_tags = {})
click to toggle source
# File lib/statsby/context.rb, line 30 def set(metric_name, value, local_tags = {}) combined_tags = tags.merge(local_tags) client.set(metric_name, value, combined_tags) end
subcontext(tags = {})
click to toggle source
# File lib/statsby/context.rb, line 44 def subcontext(tags = {}) Statsby::Context.new(self, tags) end
timing(metric_name, value, local_tags = {})
click to toggle source
# File lib/statsby/context.rb, line 25 def timing(metric_name, value, local_tags = {}) combined_tags = tags.merge(local_tags) client.timing(metric_name, value, combined_tags) end