nexus_semantic_logger 1.6.2 → 1.7.1

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: '09d61a00e5eabcdf0ff1457237b3188dc898e43d9c755cec9f74a3ddc2b9116d'
4
- data.tar.gz: fa804585ed8ac3ba6e9daeed91f61d410e0d4a5e26cab1136df6f06f20d9ffbe
3
+ metadata.gz: 1130bf8563ee797be7fdd03353edab98a7708c3ea15921a5f9a2e55a731d88b3
4
+ data.tar.gz: b12deda67b3bb270a4dfff3984a03bb01ab7cf6e70d43b9e6f21b1799bb8282c
5
5
  SHA512:
6
- metadata.gz: d78937db88ffea01512de0e0308e0733c7fb478ca91b77a0496a1fa768340ab63b3dae31a2c6f66e7d309bac80207012aac1a0457ad8a826368077f4b3ab3ef5
7
- data.tar.gz: 6a9d3f58aab2abe4d78f035b5258bcb9b4f7a67a3402d770f3ac9410038e6af375ec2b08f26dfc15ab8c23917462da4c93761e02765e465fe4897e836a955d1e
6
+ metadata.gz: 13efac602c61725f8dbcf9550747f2fd7941df5cf09e03726244fb5305ab54c085f6ad1c77406fb1a2c21fcd3e4ed839cba212b43a4303791400ba063f4743f2
7
+ data.tar.gz: 98682035351e5d9ca7fd46a619845d7e0111b1bb54033d87eb768b8d6e9166f0103580aa963d6078a0aaf01cf4c22392e26b5014bf02399b0df5a71e3497e6c8
@@ -32,6 +32,24 @@ module NexusSemanticLogger
32
32
  if named_tags.is_a?(Hash)
33
33
  hash.deep_merge!(named_tags)
34
34
  end
35
+ hash_to_json(hash)
36
+ end
37
+
38
+ # Serialise hash to json while ensuring we don't abort due to an infinite loop.
39
+ # SystemStackError while serialising indicates an infinite loop- determine which key is affected.
40
+ def hash_to_json(hash)
41
+ hash.to_json
42
+ rescue SystemStackError
43
+ as_json_serialise_errors = []
44
+ hash.keys.each do |key|
45
+ begin
46
+ hash[key].as_json
47
+ rescue SystemStackError
48
+ hash.delete(key)
49
+ as_json_serialise_errors << key
50
+ end
51
+ end
52
+ hash[:as_json_serialise_errors] = as_json_serialise_errors
35
53
  hash.to_json
36
54
  end
37
55
  end
@@ -37,5 +37,23 @@ module NexusSemanticLogger
37
37
  statsd&.timing(metric, ms, tags: global_tags + tags)
38
38
  flush
39
39
  end
40
+
41
+ # Delegate to statsd (if available).
42
+ # @param [String] metric Metric name.
43
+ # @param [Numeric] value Distribution value.
44
+ # @param [Array<String>] tags Additional tags.
45
+ def distribution(metric, value, tags: [])
46
+ statsd&.distribution(metric, value, tags: global_tags + tags)
47
+ flush
48
+ end
49
+
50
+ # Delegate to statsd (if available).
51
+ # @param [String] metric Metric name.
52
+ # @param [Numeric] value Gauge value.
53
+ # @param [Array<String>] tags Additional tags.
54
+ def gauge(metric, value, tags: [])
55
+ statsd&.gauge(metric, value, tags: global_tags + tags)
56
+ flush
57
+ end
40
58
  end
41
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module NexusSemanticLogger
3
- # Leave this as 1.6.2 in order for CI process to replace with the tagged version.
4
- VERSION = '1.6.2'
3
+ # Leave this as 1.7.1 in order for CI process to replace with the tagged version.
4
+ VERSION = '1.7.1'
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.6.2
4
+ version: 1.7.1
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-16 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.3.25
135
+ rubygems_version: 3.3.26
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: semantic_logger usage for nexus