nexus_semantic_logger 1.12.1 → 1.12.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 027f845d9e52d9f2b489fdee4322de8da733d3d8b6b61164a26b7e65752cbd80
|
4
|
+
data.tar.gz: f3bab4633d763ea390e36347171b003bc046c452ffaa3c9bf2cec0c1d1ed0cdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 888523a95588e73193a0e25bf788a4c1345815f67ad2815de793579394834be50ec3630a89d848a8b4b1d150deefdaad23b8be2d487863e97935c7f9f9b06e68
|
7
|
+
data.tar.gz: 13b686749756c64fa5011e5260da75ddacd991c38b1d944104ae3843ef606347e8b05300f485a62b3512922e5b8bd212f8917bcd1ede6b610ffaf5d100fb1a06
|
@@ -7,7 +7,7 @@ module NexusSemanticLogger
|
|
7
7
|
# own statsd instance.
|
8
8
|
class DatadogSingleton
|
9
9
|
include Singleton
|
10
|
-
attr_accessor :statsd
|
10
|
+
attr_accessor :statsd
|
11
11
|
|
12
12
|
def flush
|
13
13
|
statsd&.flush(sync: Rails.env.development?) # Force flush sync in development, speed up checks.
|
@@ -58,10 +58,9 @@ module NexusSemanticLogger
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
-
# Safely combine the
|
61
|
+
# Safely combine the supplied tags.
|
62
62
|
def combine_tags(tags)
|
63
63
|
final_tags = []
|
64
|
-
final_tags += global_tags unless global_tags.nil?
|
65
64
|
final_tags += tags unless tags.nil?
|
66
65
|
final_tags
|
67
66
|
end
|
@@ -7,6 +7,22 @@ module NexusSemanticLogger
|
|
7
7
|
def initialize(service)
|
8
8
|
Datadog.configure do |c|
|
9
9
|
if ENV['DD_AGENT_HOST'].present?
|
10
|
+
|
11
|
+
# Container and pod names should be set as env vars via the helm chart. Tagging metrics from the app
|
12
|
+
# with these values helps correlation with metrics from the kubernetes cluster.
|
13
|
+
container_name = ENV.fetch('CONTAINER_NAME') { '' }
|
14
|
+
pod_name = ENV.fetch('POD_NAME') { '' }
|
15
|
+
|
16
|
+
# Configure tags to be sent on all metrics.
|
17
|
+
# Note that 'env' is NOT sent- that is set as the default on the agent e.g. staging, canary, production.
|
18
|
+
# It does not necessarily align with the Rails env, and we do not want to double tag the env.
|
19
|
+
global_tags = [
|
20
|
+
"railsenv:#{Rails.env}",
|
21
|
+
"service:#{service}",
|
22
|
+
"container_name:#{container_name}",
|
23
|
+
"pod_name:#{pod_name}",
|
24
|
+
]
|
25
|
+
|
10
26
|
# To enable runtime metrics collection, set `true`. Defaults to `false`
|
11
27
|
# You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
|
12
28
|
c.runtime_metrics.enabled = true
|
@@ -16,20 +32,19 @@ module NexusSemanticLogger
|
|
16
32
|
datadog_singleton = DatadogSingleton.instance
|
17
33
|
datadog_statsd_socket_path = ENV.fetch('DD_STATSD_SOCKET_PATH') { '' }
|
18
34
|
datadog_singleton.statsd = if datadog_statsd_socket_path.to_s.strip.empty?
|
19
|
-
Datadog::Statsd.new(ENV['DD_AGENT_HOST'], 8125)
|
35
|
+
Datadog::Statsd.new(ENV['DD_AGENT_HOST'], 8125, tags: global_tags)
|
20
36
|
else
|
21
|
-
Datadog::Statsd.new(socket_path: datadog_statsd_socket_path)
|
37
|
+
Datadog::Statsd.new(socket_path: datadog_statsd_socket_path, tags: global_tags)
|
22
38
|
end
|
23
39
|
c.runtime_metrics.statsd = datadog_singleton.statsd
|
24
40
|
|
25
|
-
# Configure tags to be sent on all metrics.
|
26
|
-
# Note that 'env' is NOT sent- that is set as the default on the agent e.g. staging, canary, production.
|
27
|
-
# It does not necessarily align with the Rails env, and we do not want to double tag the env.
|
28
|
-
datadog_singleton.global_tags = ["railsenv:#{Rails.env}", "service:#{service}"]
|
29
41
|
# Trace tags API is Hash<String,String>, see https://www.rubydoc.info/gems/ddtrace/Datadog/Tracing
|
42
|
+
# Should match the global tags, but as a Hash.
|
30
43
|
c.tags = {
|
31
44
|
railsenv: Rails.env,
|
32
45
|
service: service,
|
46
|
+
container_name: container_name,
|
47
|
+
pod_name: pod_name,
|
33
48
|
}
|
34
49
|
|
35
50
|
# Tracer requires configuration to a datadog agent via DD_AGENT_HOST.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module NexusSemanticLogger
|
3
|
-
# Leave this as 1.12.
|
4
|
-
VERSION = '1.12.
|
3
|
+
# Leave this as 1.12.2 in order for CI process to replace with the tagged version.
|
4
|
+
VERSION = '1.12.2'
|
5
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus_semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johnathon Harris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.4.
|
140
|
+
rubygems_version: 3.4.17
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: semantic_logger usage for nexus
|