opentelemetry-common 0.19.5 → 0.19.7

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: 58a2d895adece2c6a96be7355362c2bc630da33eced02fad36f25ccb6f9dd543
4
- data.tar.gz: 1db1cbe0cd4f566e7f96e475f25de913d639780a44bce94b3e40875fd813cc92
3
+ metadata.gz: 364c424a8ede5f9b84ec679db86990267da86de77a3abadd541cddacb1d7c21a
4
+ data.tar.gz: 199bde04749d124c034d58a38436da28404fe160335be7b835abf14fdc658f6e
5
5
  SHA512:
6
- metadata.gz: 836efd569b9efae0067951776782942b1d378232d80f29c7c8ddb7319f1d786b06b3f08cf741eb821adc0463bb09269249d656d9db5c63be1956bb7a2d850791
7
- data.tar.gz: b42f204f66bb84eb28302ecff3135c0dea6c462e78e6e7b5a6e7244440a8aa6818d274b933995b4fba397ef6db4b52e706198dbadf13507a5df431e0d4aa8f01
6
+ metadata.gz: 5520ca11a8ff2489bc5ea9039525030321e15d1e3fc6f7bfb36b4832032bded29d506f8d154b24f51cf331174872bbeedb1b8cc2ebe2968bc12ee3fc26aad812
7
+ data.tar.gz: f10eef00e990e37720a3186d8b29b90c21b0c8623c171320c6bc9de6c716e3327dc5bcb84a71aa53bc550043cb83c4169d27e1db30f35573aeca68f7cba3f277
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-common
2
2
 
3
+ ### v0.19.7 / 2023-05-30
4
+
5
+ * FIXED: Untraced only works with parent-based sampler
6
+
7
+ ### v0.19.6 / 2022-05-18
8
+
9
+ * (No significant changes)
10
+
3
11
  ### v0.19.5 / 2022-05-10
4
12
 
5
13
  * FIXED: Common changelog
@@ -29,7 +29,7 @@ module OpenTelemetry
29
29
  private
30
30
 
31
31
  def to_rack_key(key)
32
- ret = 'HTTP_' + key
32
+ ret = "HTTP_#{key}"
33
33
  ret.tr!('-', '_')
34
34
  ret.upcase!
35
35
  ret
@@ -37,7 +37,7 @@ module OpenTelemetry
37
37
 
38
38
  def from_rack_key(key)
39
39
  start = key.start_with?('HTTP_') ? 5 : 0
40
- ret = key[start..-1]
40
+ ret = key[start..]
41
41
  ret.tr!('_', '-')
42
42
  ret.downcase!
43
43
  ret
@@ -10,6 +10,9 @@ module OpenTelemetry
10
10
  module Utilities
11
11
  extend self
12
12
 
13
+ UNTRACED_KEY = Context.create_key('untraced')
14
+ private_constant :UNTRACED_KEY
15
+
13
16
  STRING_PLACEHOLDER = ''.encode(::Encoding::UTF_8).freeze
14
17
 
15
18
  # Returns nil if timeout is nil, 0 if timeout has expired,
@@ -83,8 +86,17 @@ module OpenTelemetry
83
86
  end
84
87
  end
85
88
 
89
+ # Disables tracing within the provided block.
86
90
  def untraced
87
- OpenTelemetry::Trace.with_span(OpenTelemetry::Trace.non_recording_span(OpenTelemetry::Trace::SpanContext.new)) { yield }
91
+ Context.with_value(UNTRACED_KEY, true) do |ctx, _|
92
+ yield ctx
93
+ end
94
+ end
95
+
96
+ # Detects whether the current context has been set to disable tracing.
97
+ def untraced?(context = nil)
98
+ context ||= Context.current
99
+ !!context.value(UNTRACED_KEY)
88
100
  end
89
101
 
90
102
  # Returns a URL string with userinfo removed.
@@ -101,6 +113,32 @@ module OpenTelemetry
101
113
  url
102
114
  end
103
115
 
116
+ # Returns the first non nil environment variable requested,
117
+ # or the default value if provided.
118
+ #
119
+ # @param [String] env_vars The environment variable(s) to retrieve
120
+ # @param default The fallback value to return if the requested
121
+ # env var(s) are not present
122
+ #
123
+ # @returns [String]
124
+ def config_opt(*env_vars, default: nil)
125
+ ENV.values_at(*env_vars).compact.fetch(0, default)
126
+ end
127
+
128
+ # Returns a true if the provided url is valid
129
+ #
130
+ # @param [String] url the URL string to test validity
131
+ #
132
+ # @return [boolean]
133
+ def valid_url?(url)
134
+ return false if url.nil? || url.strip.empty?
135
+
136
+ URI(url)
137
+ true
138
+ rescue URI::InvalidURIError
139
+ false
140
+ end
141
+
104
142
  # Returns true if exporter is a valid exporter.
105
143
  def valid_exporter?(exporter)
106
144
  exporter && %i[export shutdown force_flush].all? { |m| exporter.respond_to?(m) }
@@ -6,6 +6,6 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  module Common
9
- VERSION = '0.19.5'
9
+ VERSION = '0.19.7'
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.19.5
4
+ version: 0.19.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: opentelemetry-test-helpers
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +86,14 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.73.0
89
+ version: '1.3'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.73.0
96
+ version: '1.3'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: simplecov
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -146,10 +160,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
146
160
  licenses:
147
161
  - Apache-2.0
148
162
  metadata:
149
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.5/file.CHANGELOG.html
163
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.7/file.CHANGELOG.html
150
164
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/common
151
165
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
152
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.5
166
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.7
153
167
  post_install_message:
154
168
  rdoc_options: []
155
169
  require_paths: