opentelemetry-sdk-experimental 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/opentelemetry/sdk/experimental/version.rb +1 -1
- data/lib/opentelemetry/sdk/trace/samplers/consistent_probability_based.rb +0 -6
- data/lib/opentelemetry/sdk/trace/samplers/consistent_probability_tracestate.rb +45 -7
- data/lib/opentelemetry/sdk/trace/samplers/parent_consistent_probability_based.rb +0 -25
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be212866685d65872e43767ebdadebff97a0a31c46a19245de8c257b06bd3301
|
4
|
+
data.tar.gz: '08f676fb84c65d7f58b9c5e181fd8d4ae7f58d640741e0006cee18418ff8b11c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef59d111a8416be5b53efd7d49a4645b2d90e6ca4da97b6ab40903df776d7bb76d0149b12e3bf1fb674e4b5e06469a2bfad14261b125200fe906837f827bf3b2
|
7
|
+
data.tar.gz: 4b39e784ed7f9f41af5de58ff35aab476b393646b015ba9aed90f0dca979c9f6ea037860973d430e1389b5d091bfee7709301336e97ccd598afae40cd3005c38
|
data/CHANGELOG.md
CHANGED
@@ -17,6 +17,31 @@ module OpenTelemetry
|
|
17
17
|
MAX_LIST_LENGTH = 256 # Defined by https://www.w3.org/TR/trace-context/
|
18
18
|
private_constant(:DECIMAL, :MAX_LIST_LENGTH)
|
19
19
|
|
20
|
+
private
|
21
|
+
|
22
|
+
# sanitized_tracestate returns an OpenTelemetry Tracestate object with the
|
23
|
+
# tracestate sanitized according to the Context invariants defined in the
|
24
|
+
# tracestate probability sampling spec.
|
25
|
+
#
|
26
|
+
# @param span_context [OpenTelemetry::Trace::SpanContext] the parent span context
|
27
|
+
# @return [OpenTelemetry::Trace::Tracestate] the sanitized tracestate
|
28
|
+
def sanitized_tracestate(span_context)
|
29
|
+
sampled = span_context.trace_flags.sampled?
|
30
|
+
tracestate = span_context.tracestate
|
31
|
+
parse_ot_vendor_tag(tracestate) do |p, r, rest|
|
32
|
+
if !r.nil? && r > 62
|
33
|
+
p = r = nil
|
34
|
+
elsif !p.nil? && p > 63
|
35
|
+
p = nil
|
36
|
+
elsif !p.nil? && !r.nil? && !invariant(p, r, sampled)
|
37
|
+
p = nil
|
38
|
+
else
|
39
|
+
return tracestate
|
40
|
+
end
|
41
|
+
update_tracestate(tracestate, p, r, rest)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
20
45
|
# parse_ot_vendor_tag parses the 'ot' vendor tag of the tracestate.
|
21
46
|
# It yields the parsed probability fields and the remaining tracestate.
|
22
47
|
# It returns the result of the block.
|
@@ -44,15 +69,22 @@ module OpenTelemetry
|
|
44
69
|
end
|
45
70
|
|
46
71
|
def update_tracestate(tracestate, p, r, rest) # rubocop:disable Naming/UncommunicativeMethodParamName
|
47
|
-
|
48
|
-
# in the most common configuration of parent_consistent_probability_based(root: consistent_probability_based(p)).
|
49
|
-
ps = "p:#{p}" unless p.nil?
|
50
|
-
rs = "r:#{r}" unless r.nil?
|
51
|
-
ot = [ps, rs, rest].compact.join(';')
|
52
|
-
if ot.empty?
|
72
|
+
if p.nil? && r.nil? && rest.nil?
|
53
73
|
tracestate.delete('ot')
|
74
|
+
elsif p.nil? && r.nil?
|
75
|
+
tracestate.set_value('ot', rest)
|
76
|
+
elsif p.nil? && rest.nil?
|
77
|
+
tracestate.set_value('ot', "r:#{r}")
|
78
|
+
elsif r.nil? && rest.nil?
|
79
|
+
tracestate.set_value('ot', "p:#{p}")
|
80
|
+
elsif p.nil?
|
81
|
+
tracestate.set_value('ot', "r:#{r};#{rest}")
|
82
|
+
elsif r.nil?
|
83
|
+
tracestate.set_value('ot', "p:#{p};#{rest}")
|
84
|
+
elsif rest.nil?
|
85
|
+
tracestate.set_value('ot', "p:#{p};r:#{r}")
|
54
86
|
else
|
55
|
-
tracestate.set_value('ot',
|
87
|
+
tracestate.set_value('ot', "p:#{p};r:#{r};#{rest}")
|
56
88
|
end
|
57
89
|
end
|
58
90
|
|
@@ -75,6 +107,12 @@ module OpenTelemetry
|
|
75
107
|
def decimal(str)
|
76
108
|
str.to_i if !str.nil? && DECIMAL.match?(str)
|
77
109
|
end
|
110
|
+
|
111
|
+
def generate_r(trace_id)
|
112
|
+
x = trace_id[8, 8].unpack1('Q>') | 0x3
|
113
|
+
clz = 64 - x.bit_length
|
114
|
+
clz
|
115
|
+
end
|
78
116
|
end
|
79
117
|
end
|
80
118
|
end
|
@@ -55,31 +55,6 @@ module OpenTelemetry
|
|
55
55
|
protected
|
56
56
|
|
57
57
|
attr_reader :root
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
# sanitized_tracestate returns an OpenTelemetry Tracestate object with the
|
62
|
-
# tracestate sanitized according to the Context invariants defined in the
|
63
|
-
# tracestate probability sampling spec.
|
64
|
-
#
|
65
|
-
# @param span_context [OpenTelemetry::Trace::SpanContext] the parent span context
|
66
|
-
# @return [OpenTelemetry::Trace::Tracestate] the sanitized tracestate
|
67
|
-
def sanitized_tracestate(span_context)
|
68
|
-
sampled = span_context.trace_flags.sampled?
|
69
|
-
tracestate = span_context.tracestate
|
70
|
-
parse_ot_vendor_tag(tracestate) do |p, r, rest|
|
71
|
-
if !r.nil? && r > 62
|
72
|
-
p = r = nil
|
73
|
-
elsif !p.nil? && p > 63
|
74
|
-
p = nil
|
75
|
-
elsif !p.nil? && !r.nil? && !invariant(p, r, sampled)
|
76
|
-
p = nil
|
77
|
-
else
|
78
|
-
return tracestate
|
79
|
-
end
|
80
|
-
update_tracestate(tracestate, p, r, rest)
|
81
|
-
end
|
82
|
-
end
|
83
58
|
end
|
84
59
|
end
|
85
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-sdk-experimental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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:
|
11
|
+
date: 2023-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -200,10 +200,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
200
200
|
licenses:
|
201
201
|
- Apache-2.0
|
202
202
|
metadata:
|
203
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk-experimental/v0.1.
|
203
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk-experimental/v0.1.1/file.CHANGELOG.html
|
204
204
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/api
|
205
205
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
206
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk-experimental/v0.1.
|
206
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk-experimental/v0.1.1
|
207
207
|
post_install_message:
|
208
208
|
rdoc_options: []
|
209
209
|
require_paths:
|