inst_statsd 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70725525a856b43a9d37075d6bdf74fdeac3a7c3a306545bca25e41e3011ca9a
4
- data.tar.gz: e7fcf1593bf7186c877be71fbd38f86c285fa852294ee08e00d90049076cb0b6
3
+ metadata.gz: 4e7d5fbbb438dc387efee59fe23c96d65d8c6d15b68bf08e3bacfaf1f05c9ac0
4
+ data.tar.gz: 27f3a13b0e1fe8910a9330b88adac40545e397500dc6d901f8bbcad0014f4cdc
5
5
  SHA512:
6
- metadata.gz: '02963b466ff709d44a2e7ed69f8a060263d0a66b87cf856d1bf9a8f75814441dda10692fb7184096c36e7365865e94d2d322cc2a04863fe66183a21e97085e0e'
7
- data.tar.gz: f24f390b747d2a86e81a45bde5e9160e86375dd565798da7e9bd037977b6be4cc71c4c29621fe3c87bade029c2884ee74b02382f2a100770563811edd3171ac8
6
+ metadata.gz: '09adfd59ec9e74f78a0af260d339f7db562a1e281e8b514650d5259a2f6ac85529cecb73b8b5a8e42f0d9f193c3aec8a1049de813280b5b8b2ceca12df261fad'
7
+ data.tar.gz: 697e4ef4dcd88dc71c7ff550433992dedf39b942bc21298cc45d623c55f223507370ceb6d8ed465cdc01e7a2c0d1719c5672dc338e1a73b777f8f8cf3c291bf2
@@ -18,6 +18,12 @@ module InstStatsd
18
18
  def distribution(metric, value, tags: {})
19
19
  return unless instance && data_dog?
20
20
 
21
+ metric = if append_hostname?
22
+ "#{metric}.#{hostname}"
23
+ else
24
+ metric.to_s
25
+ end
26
+
21
27
  instance.distribution(metric, value, { tags: tags.merge(dog_tags) }.compact)
22
28
  end
23
29
 
@@ -25,14 +31,15 @@ module InstStatsd
25
31
  #
26
32
  # @param metric [String] The name of the metric to increment.
27
33
  # @param tags [Hash] Optional tags to associate with the metric.
34
+ # @param short_stat [String, nil] Stat name to use instead of `metric` if backed by DataDog.
28
35
  #
29
36
  # @example Increment the error count:
30
37
  # InstStatsd::Statsd.distributed_increment('client.request.failed', tags: { status: '500' })
31
- def distributed_increment(metric, tags: {})
38
+ def distributed_increment(metric, tags: {}, short_stat: nil)
32
39
  # Non-Datadog clients don't support distribution metrics, so we use fall back to increment
33
- return increment(metric, tags: tags) if instance && !data_dog?
40
+ return increment(metric, tags: tags, short_stat: short_stat) if instance && !data_dog?
34
41
 
35
- distribution(metric, 1, tags: tags)
42
+ distribution(short_stat || metric, 1, tags: tags)
36
43
  end
37
44
  end
38
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstStatsd
4
- VERSION = "3.3.0"
4
+ VERSION = "3.3.1"
5
5
  end
@@ -67,7 +67,7 @@ RSpec.describe InstStatsd::Distribution do
67
67
  let(:is_datadog) { false }
68
68
 
69
69
  it 'invokes "increment" on InstStatsd::Statsd with metric and tags' do
70
- expect(InstStatsd::Statsd).to receive(:increment).with(metric, tags: tags)
70
+ expect(InstStatsd::Statsd).to receive(:increment).with(metric, tags: tags, short_stat: nil)
71
71
 
72
72
  subject
73
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst_statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Cloward
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-12-09 00:00:00.000000000 Z
12
+ date: 2025-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aroi