yabeda-datadog 0.3.1 → 0.3.2

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: 651b614460ad3fbb136abd049623f7d7fc66a853c0a0ea28ceb0b0e0d996c453
4
- data.tar.gz: c36b5413fb880de21b89b9ff7f22c63a1500e8a834f47fa24a4b8f2ce1158964
3
+ metadata.gz: d19ca4de5083d19647d70c84ac48e8192c30107f704de5e884605184566878de
4
+ data.tar.gz: aad24d5f83a5431a47f561402bcbf1f0dc3671169b6e21d9b2fa3fce1dfbed09
5
5
  SHA512:
6
- metadata.gz: 19fe55d75d1ab7f3dabe2b2f410c1dd8b0e36eab05edf9289ed7c51c123b424e22cb6920b53ed721826c6b90fe0a303f9ac95ee97e3839d4ef3d57ec009a79b5
7
- data.tar.gz: 7b527fe8982935d83f2023b8408bc0564673726e35c074b8749b6392bb6be82c77f25941cfb5f6ba71f6088b1eeba71b23a3a31b45c31e569306703875c08006
6
+ metadata.gz: 9120fe159229915dd474c9f1dcda45b84874a6652e85c743b704590dcac6912a34d4e91cb519e322ab413645ede4f3642af8a37ce76c3066e5349103b02b2130
7
+ data.tar.gz: bc3b9ba60f41c04e621014dc6d808101846cad8e4274d63940a627c48e3a9e14dba27d217f1ff3d26ba643910ca7057f3b4587c645c9f8d0b28f7233d0b35a36
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yabeda-datadog (0.3.1)
4
+ yabeda-datadog (0.3.2)
5
5
  anyway_config (~> 1.0)
6
6
  dogapi
7
7
  dogstatsd-ruby
@@ -10,11 +10,11 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- anyway_config (1.4.2)
13
+ anyway_config (1.4.4)
14
14
  coderay (1.1.2)
15
15
  concurrent-ruby (1.1.4)
16
16
  diff-lcs (1.3)
17
- dogapi (1.32.0)
17
+ dogapi (1.33.0)
18
18
  multi_json
19
19
  dogstatsd-ruby (4.0.0)
20
20
  dry-initializer (2.5.0)
@@ -4,31 +4,44 @@ module Yabeda
4
4
  module Datadog
5
5
  # = The logic of working with Datadog units
6
6
  class Unit
7
+ # Datadog whitelist of units
7
8
  # source: https://docs.datadoghq.com/developers/metrics/#units
8
- AVAILABLE = ["bit", "byte", "kibibyte", "mebibyte", "gibibyte", "tebibyte",
9
- "pebibyte", "exbibyte", "nanosecond", "microsecond", "millisecond",
10
- "second", "minute", "hour", "day", "week", "percent_nano", "percent",
11
- "apdex", "fraction", "connection", "request", "packet", "segment",
12
- "response", "message", "payload", "timeout", "datagram", "route",
13
- "session", "process", "thread", "host", "node", "fault", "service",
14
- "instance", "cpu", "file", "inode", "sector", "block", "buffer",
15
- "error", "read", "write", "occurrence", "event", "time", "unit",
16
- "operation", "item", "task", "worker", "resource", "garbage collection",
17
- "email", "sample", "stage", "monitor", "location", "check", "attempt",
18
- "device", "update", "method", "job", "container", "execution",
19
- "throttle", "invocation", "user", "success", "build", "prediction",
20
- "table", "index", "lock", "transaction", "query", "row", "key",
21
- "command", "offset", "record", "object", "cursor", "assertion", "scan",
22
- "document", "shard", "flush", "merge", "refresh", "fetch", "column",
23
- "commit", "wait", "ticket", "question", "hit", "miss", "eviction",
24
- "get", "set", "dollar", "cent", "page", "split", "hertz", "kilohertz",
25
- "megahertz", "gigahertz", "entry", "degree celsius", "degree fahrenheit",
26
- "nanocore", "microcore", "millicore", "core", "kilocore", "megacore",
27
- "gigacore", "teracore", "petacore", "exacore",].freeze
9
+ AVAILABLE = [
10
+ "bit", "byte", "kibibyte", "mebibyte", "gibibyte", "tebibyte",
11
+ "pebibyte", "exbibyte", "nanosecond", "microsecond", "millisecond",
12
+ "second", "minute", "hour", "day", "week", "percent_nano", "percent",
13
+ "apdex", "fraction", "connection", "request", "packet", "segment",
14
+ "response", "message", "payload", "timeout", "datagram", "route",
15
+ "session", "process", "thread", "host", "node", "fault", "service",
16
+ "instance", "cpu", "file", "inode", "sector", "block", "buffer",
17
+ "error", "read", "write", "occurrence", "event", "time", "unit",
18
+ "operation", "item", "task", "worker", "resource", "garbage collection",
19
+ "email", "sample", "stage", "monitor", "location", "check", "attempt",
20
+ "device", "update", "method", "job", "container", "execution",
21
+ "throttle", "invocation", "user", "success", "build", "prediction",
22
+ "table", "index", "lock", "transaction", "query", "row", "key",
23
+ "command", "offset", "record", "object", "cursor", "assertion", "scan",
24
+ "document", "shard", "flush", "merge", "refresh", "fetch", "column",
25
+ "commit", "wait", "ticket", "question", "hit", "miss", "eviction",
26
+ "get", "set", "dollar", "cent", "page", "split", "hertz", "kilohertz",
27
+ "megahertz", "gigahertz", "entry", "degree celsius", "degree fahrenheit",
28
+ "nanocore", "microcore", "millicore", "core", "kilocore", "megacore",
29
+ "gigacore", "teracore", "petacore", "exacore",
30
+ ].map { |unit| [unit, unit] }.to_h.freeze
28
31
 
29
- # Find valid unit
32
+ IRREGULAR_PLURALS = {
33
+ "queries" => "query",
34
+ "entries" => "entry",
35
+ "indices" => "index",
36
+ }.freeze
37
+
38
+ # Find an available unit of metric
30
39
  def self.find(unit)
31
- unit if unit && AVAILABLE.include?(unit)
40
+ unit_key = unit.to_s.downcase
41
+ AVAILABLE[unit_key] ||
42
+ AVAILABLE[unit_key.gsub(/s\z/, "")] ||
43
+ AVAILABLE[unit_key.gsub(/es\z/, "")] ||
44
+ IRREGULAR_PLURALS[unit_key]
32
45
  end
33
46
  end
34
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Datadog
5
- VERSION = "0.3.1"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
21
  spec.metadata["source_code_uri"] = spec.homepage
22
22
 
23
- spec.files = Dir.chdir(File.expand_path(__dir__, __FILE__)) do
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
  end
26
26
  spec.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Shvetsov <@shvetsovdm>
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-16 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -180,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.7.6
183
+ rubygems_version: 3.0.1
185
184
  signing_key:
186
185
  specification_version: 4
187
186
  summary: DataDog adapter for reporting metrics from Yabeda suite