inst-jobs-statsd 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inst_jobs_statsd/naming.rb +21 -4
- data/lib/inst_jobs_statsd/version.rb +1 -1
- data/spec/factories/jobs.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: b3de8c2ebb6a0209eece2b69f072091c760908020c2957334e34303dcf209305
|
4
|
+
data.tar.gz: 5fb37614c812c728b8448f447597d1b4b6d9c7f6856cdb5052ea36ea3d47cb40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 912a311942077658bed03600aa01cc2c5fd114ec381a04b38173a1573d1c956f5a76fdebdc2ff5b26707fe1ba4b0039748b225ce4647c7b0291849dbd8d7f980
|
7
|
+
data.tar.gz: e1ee70af317c0a531fb005be42541b5cb4a1813afa5d1d275314eb7bd1873e00edd07989fa546453b86786034952f01cdb5eeeed77272e79d404b34afe007170
|
@@ -8,6 +8,10 @@ module InstJobsStatsd
|
|
8
8
|
BASENAME
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.configure(strand_filter: nil)
|
12
|
+
@strand_filter = strand_filter
|
13
|
+
end
|
14
|
+
|
11
15
|
def self.qualified_names(stat_name, job)
|
12
16
|
names = ["#{basename}.#{stat_name}"]
|
13
17
|
tagged = tagged_stat(names[0], job)
|
@@ -31,14 +35,22 @@ module InstJobsStatsd
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def self.dd_job_tags(job)
|
34
|
-
|
35
|
-
return
|
36
|
-
|
38
|
+
tags = dd_region_tags
|
39
|
+
return tags unless job
|
40
|
+
tags = custom_tags(job, tags)
|
41
|
+
return tags unless job.tag
|
42
|
+
return tags if job.tag =~ /Class:0x/
|
37
43
|
|
38
44
|
method_tag, obj_tag = split_to_tag(job)
|
39
45
|
tag = obj_tag
|
40
46
|
tag = [obj_tag, method_tag].join('.') if method_tag.present?
|
41
|
-
|
47
|
+
tags[:tag] = tag
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.custom_tags(job, tags)
|
51
|
+
tags[:jobshard] = job.shard.id if job.respond_to?(:shard)
|
52
|
+
tags[:strand] = job.strand if job&.strand && @strand_filter&.call(job)
|
53
|
+
tags
|
42
54
|
end
|
43
55
|
|
44
56
|
# this converts Foo#bar" or "Foo.bar" into "Foo and "bar",
|
@@ -67,6 +79,11 @@ module InstJobsStatsd
|
|
67
79
|
end
|
68
80
|
end
|
69
81
|
|
82
|
+
def self.dd_region_tags
|
83
|
+
return {} unless ENV['INST_JOBS_STATSD_NAMESPACE']
|
84
|
+
{namespace: ENV['INST_JOBS_STATSD_NAMESPACE']}
|
85
|
+
end
|
86
|
+
|
70
87
|
private
|
71
88
|
|
72
89
|
def self.split_to_tag(job)
|
data/spec/factories/jobs.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inst-jobs-statsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Slade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inst-jobs
|