opentelemetry-common 0.19.2 → 0.19.3

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: ccd5d53613769dd8795434123d1c3b5d0c487831226174799c37cd160c5d594a
4
- data.tar.gz: 487b2d429364fe80cc4bfcbb90b8e2ca242978ec12a95460fed9d83ceb6e0ce3
3
+ metadata.gz: 57498f1cb42a7b108f91514b8cf743ee38ae3f18e7708ac920897e0c9b702174
4
+ data.tar.gz: 3a0cc5778fc7003c91510454aa9941bc893d09d35a21757d80fad589a84b0403
5
5
  SHA512:
6
- metadata.gz: 3895f4fef1bdf2505ccee89a38c1769450733233f2e2e59ac5fa8a2b38205efd638809f65fb7335890ed5086cd0026b00361f62ccaad89240024680fb357ce53
7
- data.tar.gz: be977cd4cf43b117b5004ed17946cd7c72412aac568e859738ab460db16be3fad2e9053ba6ae2c046483de3d609e23290060a3958c59f419a5732de4cb873bcf
6
+ metadata.gz: 77981f329e7fc9b8d128d8057fed02f1cce67282899f14a3cdae0c159c1e5d1658fcf3a5f2d6a89852905dcb3652bf60d416943f5fe9643ccbeea69e19cec1c6
7
+ data.tar.gz: edfd859d561c5ac30ac1f603cec5ab2b1e8d171c4a0f9311b5e30ca1204484a4d1fe0dff5ba1d4e851a0340f6a6665e5bfdf805fdcb1fe80f41774f827b2fa03
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
 
2
2
 
3
+ ### v0.19.3 / 2021-12-01
4
+
5
+ * FIXED: Change net attribute names to match the semantic conventions spec for http
6
+
3
7
  ### v0.19.2 / 2021-09-29
4
8
 
5
9
  * (No significant changes)
data/README.md CHANGED
@@ -40,8 +40,8 @@ tracer.in_span(
40
40
  'http.method' => req.method,
41
41
  'http.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
42
42
  'http.target' => req.path,
43
- 'peer.hostname' => @address,
44
- 'peer.port' => @port
43
+ 'net.peer.name' => @address,
44
+ 'net.peer.port' => @port
45
45
  ),
46
46
  kind: :client
47
47
  ) do |span|
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright The OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ module OpenTelemetry
8
+ module Common
9
+ module Propagation
10
+ # The RackEnvGetter class provides a common methods for reading
11
+ # keys from a rack environment. It abstracts away the rack-normalization
12
+ # process so that keys can be looked up without having to transform them
13
+ # first. With this class you can get +traceparent+ instead of
14
+ # +HTTP_TRACEPARENT+
15
+ class RackEnvGetter
16
+ # Converts key into a rack-normalized key and reads it from the carrier.
17
+ # Useful for extract operations.
18
+ def get(carrier, key)
19
+ carrier[to_rack_key(key)] || carrier[key]
20
+ end
21
+
22
+ # Reads all keys from a carrier and converts them from the rack-normalized
23
+ # form to the original. The resulting keys will be lowercase and
24
+ # underscores will be replaced with dashes.
25
+ def keys(carrier)
26
+ carrier.keys.map(&method(:from_rack_key))
27
+ end
28
+
29
+ private
30
+
31
+ def to_rack_key(key)
32
+ ret = 'HTTP_' + key
33
+ ret.tr!('-', '_')
34
+ ret.upcase!
35
+ ret
36
+ end
37
+
38
+ def from_rack_key(key)
39
+ start = key.start_with?('HTTP_') ? 5 : 0
40
+ ret = key[start..-1]
41
+ ret.tr!('_', '-')
42
+ ret.downcase!
43
+ ret
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright The OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ module OpenTelemetry
8
+ module Common
9
+ module Propagation
10
+ # The SymbolKeyGetter class provides a common method for reading
11
+ # symbol keys from a hash.
12
+ class SymbolKeyGetter
13
+ # Converts key into a symbol and reads it from the carrier.
14
+ # Useful for extract operations.
15
+ def get(carrier, key)
16
+ carrier[key.to_sym]
17
+ end
18
+
19
+ # Reads all keys from a carrier
20
+ def keys(carrier)
21
+ carrier.keys.map(&:to_s)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright The OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ require_relative './propagation/rack_env_getter'
8
+ require_relative './propagation/symbol_key_getter'
9
+
10
+ module OpenTelemetry
11
+ module Common
12
+ # Propagation contains common helpers for context propagation.
13
+ module Propagation
14
+ extend self
15
+
16
+ RACK_ENV_GETTER = RackEnvGetter.new
17
+ SYMBOL_KEY_GETTER = SymbolKeyGetter.new
18
+ private_constant :RACK_ENV_GETTER, :SYMBOL_KEY_GETTER
19
+
20
+ # Returns a {RackEnvGetter} instance suitable for reading values from a
21
+ # Rack environment.
22
+ def rack_env_getter
23
+ RACK_ENV_GETTER
24
+ end
25
+
26
+ # Returns a {SymbolKeyGetter} instance for reading values from a
27
+ # symbol keyed hash.
28
+ def symbol_key_getter
29
+ SYMBOL_KEY_GETTER
30
+ end
31
+ end
32
+ end
33
+ end
@@ -6,6 +6,6 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  module Common
9
- VERSION = '0.19.2'
9
+ VERSION = '0.19.3'
10
10
  end
11
11
  end
@@ -6,6 +6,7 @@
6
6
 
7
7
  require 'opentelemetry'
8
8
  require 'opentelemetry/common/http'
9
+ require 'opentelemetry/common/propagation'
9
10
  require 'opentelemetry/common/utilities'
10
11
  require 'opentelemetry/common/version'
11
12
 
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.2
4
+ version: 0.19.3
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-09-30 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -137,6 +137,9 @@ 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/propagation.rb
141
+ - lib/opentelemetry/common/propagation/rack_env_getter.rb
142
+ - lib/opentelemetry/common/propagation/symbol_key_getter.rb
140
143
  - lib/opentelemetry/common/test_helpers.rb
141
144
  - lib/opentelemetry/common/utilities.rb
142
145
  - lib/opentelemetry/common/version.rb
@@ -144,10 +147,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
144
147
  licenses:
145
148
  - Apache-2.0
146
149
  metadata:
147
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.2/file.CHANGELOG.html
150
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.3/file.CHANGELOG.html
148
151
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/common
149
152
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
150
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.2
153
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-common/v0.19.3
151
154
  post_install_message:
152
155
  rdoc_options: []
153
156
  require_paths: