dogstatsd-ruby 4.3.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/datadog/statsd.rb +21 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0a17784b24e078a39ee2717d1b7b25d1879e067a5e356db6f98eb012d2bbef2
4
- data.tar.gz: 9559cb5d04e7b8dee34becbd0adb9182fb1cbda48ae5de13a470cd1d843d4d8d
3
+ metadata.gz: fde2be6b614574c2555c8cbbd2ca16ef33bcd09837502f482f5f6baf582fd67b
4
+ data.tar.gz: cc1523c5aa78643d93fc891116c46bb5322dda297f1676cd73d201c9beee2a26
5
5
  SHA512:
6
- metadata.gz: 652f8010045d42ae2fe2056d6c97f645d54c430b491a1e878cdf85abd22fda2dfbeae74022fb71faa51f5ce636c1bb6dcef60e172ba15c4b74fcd3eded1d9b05
7
- data.tar.gz: 42f8763913be88f9871568ac966403f19437c4e477792a771b4b10d9645e2e73f6a588f89c4ba8bd218feb44842f1f6a491434eb0cdc64a2e0a47b30287da8f2
6
+ metadata.gz: 9c96177f1ea0ab2288712cf9829cb8408687e12ce0f22f06ddbb1433447a3a4eaf05fe13f0fda8746b9f0e8fad71ea3b0b50ba7d8a028e464db334349951c64b
7
+ data.tar.gz: 11e23d434a7e88925e049484dfbb252d5c78ce12a4a07fd3c09edca57835db30224cba202f86f57352357acdf2073b8c8e93f20bd403975242b201321bef8ecc
data/README.md CHANGED
@@ -4,7 +4,7 @@ dogstatsd-ruby
4
4
 
5
5
  A client for DogStatsD, an extension of the StatsD metric server for Datadog.
6
6
 
7
- [![Build Status](https://secure.travis-ci.org/DataDog/dogstatsd-ruby.png)](http://travis-ci.org/DataDog/dogstatsd-ruby)
7
+ [![Build Status](https://secure.travis-ci.org/DataDog/dogstatsd-ruby.svg)](http://travis-ci.org/DataDog/dogstatsd-ruby)
8
8
 
9
9
  Quick Start Guide
10
10
  -----------------
@@ -44,8 +44,10 @@ module Datadog
44
44
  rescue StandardError => boom
45
45
  # Try once to reconnect if the socket has been closed
46
46
  retries ||= 1
47
- if retries <= 1 && boom.is_a?(Errno::ENOTCONN) or
48
- retries <= 1 && boom.is_a?(IOError) && boom.message =~ /closed stream/i
47
+ if retries <= 1 &&
48
+ (boom.is_a?(Errno::ENOTCONN) or
49
+ boom.is_a?(Errno::ECONNREFUSED) or
50
+ boom.is_a?(IOError) && boom.message =~ /closed stream/i)
49
51
  retries += 1
50
52
  begin
51
53
  @socket = connect
@@ -192,7 +194,7 @@ module Datadog
192
194
  DISTRIBUTION_TYPE = 'd'.freeze
193
195
  TIMING_TYPE = 'ms'.freeze
194
196
  SET_TYPE = 's'.freeze
195
- VERSION = "4.3.0".freeze
197
+ VERSION = "4.5.0".freeze
196
198
 
197
199
  # A namespace to prepend to all statsd calls. Defaults to no namespace.
198
200
  attr_reader :namespace
@@ -407,8 +409,8 @@ module Datadog
407
409
  # @param [String] name Service check name
408
410
  # @param [String] status Service check status.
409
411
  # @param [Hash] opts the additional data about the service check
410
- # @option opts [Integer, nil] :timestamp (nil) Assign a timestamp to the event. Default is now when none
411
- # @option opts [String, nil] :hostname (nil) Assign a hostname to the event.
412
+ # @option opts [Integer, String, nil] :timestamp (nil) Assign a timestamp to the service check. Default is now when none
413
+ # @option opts [String, nil] :hostname (nil) Assign a hostname to the service check.
412
414
  # @option opts [Array<String>, nil] :tags (nil) An array of tags
413
415
  # @option opts [String, nil] :message (nil) A message to associate with this service check status
414
416
  # @example Report a critical service check status
@@ -426,7 +428,7 @@ module Datadog
426
428
  # @param [String] title Event title
427
429
  # @param [String] text Event text. Supports newlines (+\n+)
428
430
  # @param [Hash] opts the additional data about the event
429
- # @option opts [Integer, nil] :date_happened (nil) Assign a timestamp to the event. Default is now when none
431
+ # @option opts [Integer, String, nil] :date_happened (nil) Assign a timestamp to the event. Default is now when none
430
432
  # @option opts [String, nil] :hostname (nil) Assign a hostname to the event.
431
433
  # @option opts [String, nil] :aggregation_key (nil) Assign an aggregation key to the event, to group it with some others
432
434
  # @option opts [String, nil] :priority ('normal') Can be "normal" or "low"
@@ -486,7 +488,11 @@ module Datadog
486
488
  escaped_message = escape_service_check_message(message)
487
489
  sc_string << "|m:#{escaped_message}"
488
490
  else
489
- value = remove_pipes(opts[key])
491
+ if key == :timestamp && opts[key].is_a?(Integer)
492
+ value = opts[key]
493
+ else
494
+ value = remove_pipes(opts[key])
495
+ end
490
496
  sc_string << "|#{shorthand_key}#{value}"
491
497
  end
492
498
  end
@@ -502,7 +508,14 @@ module Datadog
502
508
  # All pipes ('|') in the metadata are removed. Title and Text can keep theirs
503
509
  OPTS_KEYS.each do |key, shorthand_key|
504
510
  if key != :tags && opts[key]
505
- value = remove_pipes(opts[key])
511
+ # :date_happened is the only key where the value is an Integer
512
+ # To not break backwards compatibility, we still accept a String
513
+ if key == :date_happened && opts[key].is_a?(Integer)
514
+ value = opts[key]
515
+ # All other keys only have String values
516
+ else
517
+ value = remove_pipes(opts[key])
518
+ end
506
519
  event_string_data << "|#{shorthand_key}:#{value}"
507
520
  end
508
521
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogstatsd-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rein Henrichs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby DogStastd client
14
14
  email: code@datadoghq.com