lib/statsd/instrument/legacy_client.rb in statsd-instrument-2.8.0 vs lib/statsd/instrument/legacy_client.rb in statsd-instrument-2.9.0
- old
+ new
@@ -118,11 +118,11 @@
# @!method set(name, value, sample_rate: nil, tags: nil)
#
# Emits a set metric, which counts the number of distinct values that have occurred.
#
- # @example Couning the number of unique visitors
+ # @example Counting the number of unique visitors
# StatsD.set('visitors.unique', Current.user.id)
#
# @param key [String] The name of the metric.
# @param value [Numeric] The value to record.
# @param sample_rate (see #increment)
@@ -220,11 +220,11 @@
# Emits an event.
#
# @param title [String] Title of the event. A configured prefix may be applied to this title.
# @param text [String] Body of the event. Can contain newlines.
# @param [String] hostname The hostname to associate with the event.
- # @param [Time] timestamp The moment the status of the service was checkes. Defaults to now.
+ # @param [Time] timestamp The moment the status of the service was checked. Defaults to now.
# @param [String] aggregation_key A key to aggregate similar events into groups.
# @param [String] priority The event's priority, either `"low"` or `"normal"` (default).
# @param [String] source_type_name The source type.
# @param [String] alert_type The type of alert. Either `"info"` (default), `"warning"`, `"error"`, or `"success"`.
# @param tags (see #increment)
@@ -252,11 +252,11 @@
# Emits a service check.
#
# @param [String] name Name of the service. A configured prefix may be applied to this title.
# @param [Symbol] status Current status of the service. Either `:ok`, `:warning`, `:critical`, or `:unknown`.
# @param [String] hostname The hostname to associate with the event.
- # @param [Time] timestamp The moment the status of the service was checkes. Defaults to now.
+ # @param [Time] timestamp The moment the status of the service was checked. Defaults to now.
# @param [String] message A message that describes the current status.
# @param tags (see #increment)
# @return [void]
#
# @note Supported by the Datadog implementation only.
@@ -271,11 +271,11 @@
collect_metric(:_sc, name, status, sample_rate: sample_rate, prefix: prefix, tags: tags, metadata: {
hostname: hostname, timestamp: timestamp, message: message
})
end
- private
+ protected
def measure_latency(type, key, sample_rate:, tags:, prefix:)
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
begin
yield
@@ -294,8 +294,8 @@
name = "#{prefix}.#{name}" if prefix
metric = StatsD::Instrument::Metric.new(type: type, name: name, value: value,
sample_rate: sample_rate, tags: tags, metadata: metadata)
backend.collect_metric(metric)
- metric # TODO: return `nil` in the next major version
+ metric
end
end