lib/semantic_logger/metrics/statsd.rb in semantic_logger-3.3.0 vs lib/semantic_logger/metrics/statsd.rb in semantic_logger-3.4.0
- old
+ new
@@ -5,24 +5,20 @@
raise 'Gem statsd-ruby is required for logging metrics. Please add the gem "statsd-ruby" to your Gemfile.'
end
module SemanticLogger
module Metrics
- class Statsd < Subscriber
+ class Statsd
# Create Statsd metrics subscriber
#
# Parameters:
# url: [String]
# Valid URL to post to.
# Example:
# udp://localhost:8125
# Example, send all metrics to a particular namespace:
# udp://localhost:8125/namespace
# Default: udp://localhost:8125
- #
- # Example:
- # subscriber = SemanticLogger::Metrics::Statsd.new(url: 'udp://localhost:8125')
- # SemanticLogger.on_metric(subscriber)
def initialize(options = {})
options = options.dup
@url = options.delete(:url) || 'udp://localhost:8125'
uri = URI.parse(@url)
raise('Statsd only supports udp. Example: "udp://localhost:8125"') if uri.scheme != 'udp'