inst_statsd 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inst_statsd/distribution.rb +10 -3
- data/lib/inst_statsd/version.rb +1 -1
- data/spec/inst_statsd/distribution_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e7d5fbbb438dc387efee59fe23c96d65d8c6d15b68bf08e3bacfaf1f05c9ac0
|
4
|
+
data.tar.gz: 27f3a13b0e1fe8910a9330b88adac40545e397500dc6d901f8bbcad0014f4cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz: '
|
7
|
-
data.tar.gz:
|
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
|
data/lib/inst_statsd/version.rb
CHANGED
@@ -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.
|
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:
|
12
|
+
date: 2025-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aroi
|