nexus_semantic_logger 1.2.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/nexus_semantic_logger/datadog_singleton.rb +14 -3
- data/lib/nexus_semantic_logger/version.rb +2 -2
- data/lib/nexus_semantic_logger.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e650ec4b4c57cb7d85a5abde066ef34219502ff5d995e37fdf2b431833b2a086
|
4
|
+
data.tar.gz: 6285058765fa7ff89bf071714bcdd1978c83b4f64dfd17c2ddffc5a3843e190b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfbe1816ddd0f82a9009e863b94d4efe76551a35511df893a74ef328b1fee41964b2b0bdeaa219355da3e3fa03e00e9e2fb3b129d2459bbea1332ba37069c6f4
|
7
|
+
data.tar.gz: 70bc5a9ba7bc1d24b8dbac2fc84afbf7bb94c39a48d34036ca6b59446d1293778802984268f38ef7b80adcb74397a04225edfc3173be481d830d0180c79b2e25
|
data/README.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
Configures a [semantic_logger](https://rubygems.org/gems/rails_semantic_logger) as required for NexusMods components.
|
4
4
|
|
5
|
+
## Telemetry
|
6
|
+
|
7
|
+
As well as providing a semantic logger, this gem handles datadog telemetry associated with the logging approach:
|
8
|
+
|
9
|
+
* logs
|
10
|
+
* traces
|
11
|
+
* metrics
|
12
|
+
* statsd is automatically attached to datadog runtime metrics and may also be used for custom metrics.
|
13
|
+
|
14
|
+
### Sending metrics
|
15
|
+
|
16
|
+
Ensure the metric name is in the format: `nexus.{component}.{major}.{minor}`
|
17
|
+
|
18
|
+
Where _major and minor_ are specific to the component logic e.g. `nexus.uploads.clamscan.pass`
|
19
|
+
|
20
|
+
For example, to increment a count:
|
21
|
+
|
22
|
+
```
|
23
|
+
NexusSemanticLogger.metrics.increment('nexus.users.registration.complete')
|
24
|
+
```
|
25
|
+
|
5
26
|
# Local gem development
|
6
27
|
|
7
28
|
Steps to run this gem from local sources in one the nexus 'staged build' rails components:
|
@@ -3,7 +3,8 @@ require 'singleton'
|
|
3
3
|
|
4
4
|
module NexusSemanticLogger
|
5
5
|
# Application wide location to get datadog objects.
|
6
|
-
#
|
6
|
+
# dogstatsd-ruby maintains its own queue and thread for flushing, so the client code should never create its
|
7
|
+
# own statsd instance.
|
7
8
|
class DatadogSingleton
|
8
9
|
include Singleton
|
9
10
|
attr_accessor :statsd, :tags
|
@@ -12,8 +13,18 @@ module NexusSemanticLogger
|
|
12
13
|
statsd&.flush(sync: Rails.env.development?) # Force flush sync in development, speed up checks.
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
# Delegate to statsd (if available).
|
17
|
+
# @param [String] metric Metric name.
|
18
|
+
def increment(metric)
|
19
|
+
statsd&.increment(metric, tags: tags)
|
20
|
+
flush
|
21
|
+
end
|
22
|
+
|
23
|
+
# Delegate to statsd (if available).
|
24
|
+
# @param [String] metric Metric name.
|
25
|
+
# @param [Integer] ms Timing in milliseconds.
|
26
|
+
def timing(metric, ms)
|
27
|
+
statsd&.timing(metric, ms, tags: tags)
|
17
28
|
flush
|
18
29
|
end
|
19
30
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module NexusSemanticLogger
|
3
|
-
# Leave this as 1.2
|
4
|
-
VERSION = '1.2
|
3
|
+
# Leave this as 1.3.2 in order for CI process to replace with the tagged version.
|
4
|
+
VERSION = '1.3.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.2
|
4
|
+
version: 1.3.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: 2022-
|
11
|
+
date: 2022-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.3.
|
105
|
+
rubygems_version: 3.3.21
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: semantic_logger usage for nexus
|