opentelemetry-common 0.16.0 → 0.19.1

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: 1ee78fc28e90a03769b0858f5ce6d76eaf4bb76398a23af5d38157d215a41fd9
4
- data.tar.gz: 513f927073900521cfb7352ef971c6ffe7770dd2bff43b4a8255a5eee370e6e8
3
+ metadata.gz: ec9e692d58a21b093de31eaea17d7ec972cf3716efb580658fd0f8a284addc0d
4
+ data.tar.gz: d6ecdd5414c4e8edea8acd1efb21ceb0dbc1d749beddeb29ec5143bad7b5b161
5
5
  SHA512:
6
- metadata.gz: 53d48f43eb60c90aeb185f5a2aad5538ae9bd3e9f98cb04d0225e9e6124e2e021b8b40e43cd495b1571f11e61711143c24d7c23dcf279adfcad2479d9abcf2e7
7
- data.tar.gz: 20329c6f9631a79c614c4c9a3459f8e48eb8a524ec5a246a31e3196da5d1ec835b58c9f25d2b433fe5aa06340036ff04de0f3d5df705789dc0d6fe1774f47cfe
6
+ metadata.gz: 73907cd010768cbe5ae6db720c7f3d830239c585b542d6a61f9e64b8d06c39d07bab5b87494225a44de3a68cdd13d64c2ca2225efcbcc3f8406f2bc7566a9caf
7
+ data.tar.gz: 65bb01c8d9dcab774ac65be62683a48eb2a1c2defcd8ad0736e64999451230fb284674f45ef82a1c276b2991158d39e2c4890aa36beb7a96fdb30ff5528f6dd1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
 
2
2
 
3
+ ### v0.19.1 / 2021-08-12
4
+
5
+ * (No significant changes)
6
+
7
+ ### v0.19.0 / 2021-06-23
8
+
9
+ * ADDED: Add Tracer.non_recording_span to API
10
+
11
+ ### v0.18.0 / 2021-05-21
12
+
13
+ * BREAKING CHANGE: Replace Time.now with Process.clock_gettime
14
+
15
+ * FIXED: Replace Time.now with Process.clock_gettime
16
+
17
+ ### v0.17.0 / 2021-04-22
18
+
19
+ * ADDED: Add zipkin exporter
20
+ * ADDED: Processors validate exporters on init.
21
+
3
22
  ### v0.16.0 / 2021-03-17
4
23
 
5
24
  * ADDED: Instrument lmdb gem
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright The OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ def with_env(new_env)
8
+ env_to_reset = ENV.select { |k, _| new_env.key?(k) }
9
+ keys_to_delete = new_env.keys - ENV.keys
10
+ new_env.each_pair { |k, v| ENV[k] = v }
11
+ yield
12
+ ensure
13
+ env_to_reset.each_pair { |k, v| ENV[k] = v }
14
+ keys_to_delete.each { |k| ENV.delete(k) }
15
+ end
16
+
17
+ def exportable_timestamp(time = Time.now)
18
+ (time.to_r * 1_000_000_000).to_i
19
+ end
@@ -14,13 +14,29 @@ module OpenTelemetry
14
14
 
15
15
  # Returns nil if timeout is nil, 0 if timeout has expired,
16
16
  # or the remaining (positive) time left in seconds.
17
+ #
18
+ # @param [Numeric] timeout The timeout in seconds. May be nil.
19
+ # @param [Numeric] start_time Start time for timeout returned
20
+ # by {timeout_timestamp}.
21
+ #
22
+ # @return [Numeric] remaining (positive) time left in seconds.
23
+ # May be nil.
17
24
  def maybe_timeout(timeout, start_time)
18
25
  return nil if timeout.nil?
19
26
 
20
- timeout -= (Time.now - start_time)
27
+ timeout -= (timeout_timestamp - start_time)
21
28
  timeout.positive? ? timeout : 0
22
29
  end
23
30
 
31
+ # Returns a timestamp suitable to pass as the start_time
32
+ # argument to {maybe_timeout}. This has no meaning outside
33
+ # of the current process.
34
+ #
35
+ # @return [Numeric]
36
+ def timeout_timestamp
37
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
38
+ end
39
+
24
40
  # Encodes a string in utf8
25
41
  #
26
42
  # @param [String] string The string to be utf8 encoded
@@ -57,7 +73,7 @@ module OpenTelemetry
57
73
  end
58
74
 
59
75
  def untraced
60
- OpenTelemetry::Trace.with_span(OpenTelemetry::Trace::Span.new) { yield }
76
+ OpenTelemetry::Trace.with_span(OpenTelemetry::Trace.non_recording_span(OpenTelemetry::Trace::SpanContext.new)) { yield }
61
77
  end
62
78
 
63
79
  # Returns a URL string with userinfo removed.
@@ -73,6 +89,11 @@ module OpenTelemetry
73
89
  rescue URI::Error
74
90
  url
75
91
  end
92
+
93
+ # Returns true if exporter is a valid exporter.
94
+ def valid_exporter?(exporter)
95
+ exporter && %i[export shutdown force_flush].all? { |m| exporter.respond_to?(m) }
96
+ end
76
97
  end
77
98
  end
78
99
  end
@@ -6,6 +6,6 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  module Common
9
- VERSION = '0.16.0'
9
+ VERSION = '0.19.1'
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
19
+ version: 1.0.0.rc3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.16.0
26
+ version: 1.0.0.rc3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -137,16 +137,17 @@ files:
137
137
  - lib/opentelemetry/common.rb
138
138
  - lib/opentelemetry/common/http.rb
139
139
  - lib/opentelemetry/common/http/client_context.rb
140
+ - lib/opentelemetry/common/test_helpers.rb
140
141
  - lib/opentelemetry/common/utilities.rb
141
142
  - lib/opentelemetry/common/version.rb
142
143
  homepage: https://github.com/open-telemetry/opentelemetry-ruby
143
144
  licenses:
144
145
  - Apache-2.0
145
146
  metadata:
146
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.16.0/file.CHANGELOG.html
147
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.1/file.CHANGELOG.html
147
148
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/common
148
149
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
149
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.16.0
150
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.1
150
151
  post_install_message:
151
152
  rdoc_options: []
152
153
  require_paths:
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  - !ruby/object:Gem::Version
163
164
  version: '0'
164
165
  requirements: []
165
- rubygems_version: 3.1.4
166
+ rubygems_version: 3.1.6
166
167
  signing_key:
167
168
  specification_version: 4
168
169
  summary: Common helpers for OpenTelemetry