nexus_semantic_logger 1.12.1 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7230b1ecb5123370ea102ebc1493e87d95f9b799d2f30fa81607554ee2da525
|
4
|
+
data.tar.gz: 30d0937628ac86d86a368486d90870aa53ee2729fd07173d506fac0e61b4296b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9dfa19177746db2b0b306930714004af1fe1e342514daa0bb4047b30a003e8f1513dc05c846e6df2cc743f026bc705edc5a58f80753af1e5492ba4d31c141b4
|
7
|
+
data.tar.gz: 20190c0ddf14c08be12d3ea7cf4ebc56c43341057925400477d2dbfd977f7fd9300353f3f5efc2e1ec33f47801b7fd74fee84d23f32ed9b500946fe0a85c146a
|
@@ -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.3 in order for CI process to replace with the tagged version.
|
4
|
+
VERSION = '1.12.3'
|
5
5
|
end
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
end
|
15
15
|
spec.require_paths = ['lib']
|
16
16
|
spec.add_dependency('amazing_print', '~> 1.4.0')
|
17
|
-
spec.add_dependency('ddtrace', '~> 1.9
|
17
|
+
spec.add_dependency('ddtrace', '~> 1.9') # For datadog tracing/profiling.
|
18
18
|
spec.add_dependency('dogstatsd-ruby', '~> 5.4.0') # For custom application metrics.
|
19
19
|
spec.add_dependency('google-protobuf', '~> 3.22.0')
|
20
20
|
spec.add_dependency('net_tcp_client', '~> 2.2.0') # For TCP logging.
|
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.3
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.9
|
33
|
+
version: '1.9'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.9
|
40
|
+
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dogstatsd-ruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|