opentelemetry-common 0.9.0 → 0.14.0

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: 587b53220950907af83bf14a90427c8833fc9ef32364d1403e7851e0095d8f0d
4
- data.tar.gz: 38b1ce3db0d3897e98c6393920dad4068c4ecf7b4beedc7b131f5582e0db45d9
3
+ metadata.gz: 1dcc91a5cff7866e5f3a083305bf12db4853c15c907e7e46644045cd1fc8578c
4
+ data.tar.gz: 35261314130175ed09723633373238b1c9718e6e603e9c98aeec728416075b57
5
5
  SHA512:
6
- metadata.gz: f5be23ec636f5765a1673b64718fb8d9eb40f5314141bcf64707b2c8d1c5603e076be218562abc93a8a4937135bf0cbe9aebad1478ada4b33c7fba5411716b99
7
- data.tar.gz: 32db70b707f353d6aabce6542c0f537935c26b49c2274d47f319cbc533888647e3e7e065477df36270077a4ade0ea345550f0672cba314af475a0c9815fc448d
6
+ metadata.gz: 40e5f48d5576429a3f8dd3d777de7039bcc94ca20298d6be7d8daac766fa7b992ff05db367ff9cfb8b53de95f8078e72673fa63411bd86cab869bd7fde851c05
7
+ data.tar.gz: c09f7152fda0d8c260e426356f5ee3200a075736b2091b408341eddbec42443f8dc23f1f9696d59c690ea767c6313572594c822b5d914af1cc07321b59f986ef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
 
2
2
 
3
+ ### v0.14.0 / 2021-02-03
4
+
5
+ * (No significant changes)
6
+
7
+ ### v0.13.0 / 2021-01-29
8
+
9
+ * ADDED: Add untraced wrapper to common utils
10
+
11
+ ### v0.12.0 / 2020-12-24
12
+
13
+ * (No significant changes)
14
+
15
+ ### v0.11.0 / 2020-12-11
16
+
17
+ * ADDED: Move utf8 encoding to common utils
18
+ * FIXED: Copyright comments to not reference year
19
+
20
+ ### v0.10.0 / 2020-12-03
21
+
22
+ * FIXED: Common gem should depend on api gem
23
+
3
24
  ### v0.9.0 / 2020-11-27
4
25
 
5
26
  * Initial release.
data/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2020 OpenTelemetry Authors
189
+ Copyright The OpenTelemetry Authors
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -10,15 +10,45 @@ module OpenTelemetry
10
10
  module Utilities
11
11
  extend self
12
12
 
13
- # @api private
14
- #
15
- # Returns nil if timeout is nil, 0 if timeout has expired, or the remaining (positive) time left in seconds.
13
+ STRING_PLACEHOLDER = ''.encode(::Encoding::UTF_8).freeze
14
+
15
+ # Returns nil if timeout is nil, 0 if timeout has expired,
16
+ # or the remaining (positive) time left in seconds.
16
17
  def maybe_timeout(timeout, start_time)
17
18
  return nil if timeout.nil?
18
19
 
19
20
  timeout -= (Time.now - start_time)
20
21
  timeout.positive? ? timeout : 0
21
22
  end
23
+
24
+ # Encodes a string in utf8
25
+ #
26
+ # @param [String] string The string to be utf8 encoded
27
+ # @param [optional boolean] binary This option is for displaying binary data
28
+ # @param [optional String] placeholder The fallback string to be used if encoding fails
29
+ #
30
+ # @return [String]
31
+ def utf8_encode(string, binary: false, placeholder: STRING_PLACEHOLDER)
32
+ string = string.to_s
33
+
34
+ if binary
35
+ # This option is useful for "gracefully" displaying binary data that
36
+ # often contains text such as marshalled objects
37
+ string.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
38
+ elsif string.encoding == ::Encoding::UTF_8
39
+ string
40
+ else
41
+ string.encode(::Encoding::UTF_8)
42
+ end
43
+ rescue StandardError => e
44
+ OpenTelemetry.logger.debug("Error encoding string in UTF-8: #{e}")
45
+
46
+ placeholder
47
+ end
48
+
49
+ def untraced
50
+ OpenTelemetry::Trace.with_span(OpenTelemetry::Trace::Span.new) { yield }
51
+ end
22
52
  end
23
53
  end
24
54
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
7
  module OpenTelemetry
8
8
  module Common
9
- VERSION = '0.9.0'
9
+ VERSION = '0.14.0'
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-28 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: opentelemetry-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.14.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.14.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -129,10 +143,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
129
143
  licenses:
130
144
  - Apache-2.0
131
145
  metadata:
132
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.9.0/file.CHANGELOG.html
133
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/common
146
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.14.0/file.CHANGELOG.html
147
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/common
134
148
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
135
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.9.0
149
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.14.0
136
150
  post_install_message:
137
151
  rdoc_options: []
138
152
  require_paths: