opentelemetry-api 0.2.0 → 0.6.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/CHANGELOG.md +13 -0
  4. data/LICENSE +1 -1
  5. data/OVERVIEW.md +66 -0
  6. data/lib/{opentelemetry/distributed_context/manager.rb → opentelemetry-api.rb} +1 -6
  7. data/lib/opentelemetry.rb +37 -19
  8. data/lib/opentelemetry/baggage.rb +16 -0
  9. data/lib/opentelemetry/baggage/builder.rb +18 -0
  10. data/lib/opentelemetry/baggage/manager.rb +41 -0
  11. data/lib/opentelemetry/baggage/propagation.rb +57 -0
  12. data/lib/opentelemetry/baggage/propagation/context_keys.rb +27 -0
  13. data/lib/opentelemetry/baggage/propagation/text_map_extractor.rb +60 -0
  14. data/lib/opentelemetry/baggage/propagation/text_map_injector.rb +55 -0
  15. data/lib/opentelemetry/context.rb +138 -15
  16. data/lib/opentelemetry/context/key.rb +29 -0
  17. data/lib/opentelemetry/context/propagation.rb +22 -0
  18. data/lib/opentelemetry/context/propagation/composite_propagator.rb +73 -0
  19. data/lib/opentelemetry/context/propagation/default_getter.rb +26 -0
  20. data/lib/opentelemetry/context/propagation/default_setter.rb +26 -0
  21. data/lib/opentelemetry/context/propagation/noop_extractor.rb +26 -0
  22. data/lib/opentelemetry/context/propagation/noop_injector.rb +26 -0
  23. data/lib/opentelemetry/context/propagation/propagation.rb +27 -0
  24. data/lib/opentelemetry/context/propagation/propagator.rb +64 -0
  25. data/lib/opentelemetry/instrumentation.rb +15 -0
  26. data/lib/opentelemetry/instrumentation/base.rb +245 -0
  27. data/lib/opentelemetry/instrumentation/registry.rb +87 -0
  28. data/lib/opentelemetry/metrics.rb +1 -1
  29. data/lib/opentelemetry/metrics/handles.rb +5 -15
  30. data/lib/opentelemetry/metrics/instruments.rb +18 -69
  31. data/lib/opentelemetry/metrics/meter.rb +2 -39
  32. data/lib/opentelemetry/metrics/{meter_factory.rb → meter_provider.rb} +2 -2
  33. data/lib/opentelemetry/trace.rb +14 -17
  34. data/lib/opentelemetry/trace/link.rb +4 -3
  35. data/lib/opentelemetry/trace/propagation.rb +17 -0
  36. data/lib/opentelemetry/trace/propagation/context_keys.rb +35 -0
  37. data/lib/opentelemetry/trace/propagation/trace_context.rb +59 -0
  38. data/lib/opentelemetry/trace/propagation/trace_context/text_map_extractor.rb +58 -0
  39. data/lib/opentelemetry/trace/propagation/trace_context/text_map_injector.rb +55 -0
  40. data/lib/opentelemetry/trace/propagation/trace_context/trace_parent.rb +130 -0
  41. data/lib/opentelemetry/trace/span.rb +20 -20
  42. data/lib/opentelemetry/trace/span_context.rb +25 -1
  43. data/lib/opentelemetry/trace/status.rb +7 -2
  44. data/lib/opentelemetry/trace/tracer.rb +47 -13
  45. data/lib/opentelemetry/trace/tracer_provider.rb +22 -0
  46. data/lib/opentelemetry/trace/util/http_to_status.rb +47 -0
  47. data/lib/opentelemetry/version.rb +1 -1
  48. metadata +35 -17
  49. data/lib/opentelemetry/distributed_context.rb +0 -19
  50. data/lib/opentelemetry/distributed_context/distributed_context.rb +0 -24
  51. data/lib/opentelemetry/distributed_context/entry.rb +0 -66
  52. data/lib/opentelemetry/distributed_context/propagation.rb +0 -19
  53. data/lib/opentelemetry/distributed_context/propagation/binary_format.rb +0 -26
  54. data/lib/opentelemetry/distributed_context/propagation/text_format.rb +0 -76
  55. data/lib/opentelemetry/distributed_context/propagation/trace_parent.rb +0 -124
  56. data/lib/opentelemetry/internal.rb +0 -22
  57. data/lib/opentelemetry/trace/event.rb +0 -45
  58. data/lib/opentelemetry/trace/sampling_hint.rb +0 -22
  59. data/lib/opentelemetry/trace/tracer_factory.rb +0 -45
@@ -8,46 +8,9 @@ module OpenTelemetry
8
8
  module Metrics
9
9
  # No-op implementation of Meter.
10
10
  class Meter
11
- NOOP_LABEL_SET = Object.new
12
- private_constant(:NOOP_LABEL_SET)
11
+ def record_batch(*measurements, labels: nil); end
13
12
 
14
- def record_batch(*measurements, label_set: nil); end
15
-
16
- # Canonicalizes labels, returning an opaque {LabelSet} object.
17
- #
18
- # @param [Hash<String, String>] labels
19
- # @return [LabelSet]
20
- def labels(labels)
21
- NOOP_LABEL_SET
22
- end
23
-
24
- # Create and return a floating point gauge.
25
- #
26
- # @param [String] name Name of the metric. See {Meter} for required metric name syntax.
27
- # @param [optional String] description Descriptive text documenting the instrument.
28
- # @param [optional String] unit Unit specified according to http://unitsofmeasure.org/ucum.html.
29
- # @param [optional Enumerable<String>] recommended_label_keys Recommended grouping keys for this instrument.
30
- # @param [optional Boolean] monotonic Whether the gauge accepts only monotonic updates. Defaults to false.
31
- # @return [FloatGauge]
32
- def create_float_gauge(name, description: nil, unit: nil, recommended_label_keys: nil, monotonic: false)
33
- raise ArgumentError if name.nil?
34
-
35
- Instruments::FloatGauge.new
36
- end
37
-
38
- # Create and return an integer gauge.
39
- #
40
- # @param [String] name Name of the metric. See {Meter} for required metric name syntax.
41
- # @param [optional String] description Descriptive text documenting the instrument.
42
- # @param [optional String] unit Unit specified according to http://unitsofmeasure.org/ucum.html.
43
- # @param [optional Enumerable<String>] recommended_label_keys Recommended grouping keys for this instrument.
44
- # @param [optional Boolean] monotonic Whether the gauge accepts only monotonic updates. Defaults to false.
45
- # @return [IntegerGauge]
46
- def create_integer_gauge(name, description: nil, unit: nil, recommended_label_keys: nil, monotonic: false)
47
- raise ArgumentError if name.nil?
48
-
49
- Instruments::IntegerGauge.new
50
- end
13
+ # TODO: Observers.
51
14
 
52
15
  # Create and return a floating point counter.
53
16
  #
@@ -6,8 +6,8 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  module Metrics
9
- # No-op implementation of a meter factory.
10
- class MeterFactory
9
+ # No-op implementation of a meter provider.
10
+ class MeterProvider
11
11
  # Returns a {Meter} instance.
12
12
  #
13
13
  # @param [optional String] name Instrumentation package name
@@ -9,45 +9,42 @@ module OpenTelemetry
9
9
  # single logical operation, consolidated across various components of an
10
10
  # application.
11
11
  module Trace
12
- # An invalid trace identifier, a 16-byte array with all zero bytes, encoded
13
- # as a hexadecimal string.
14
- INVALID_TRACE_ID = ('0' * 32).freeze
12
+ # An invalid trace identifier, a 16-byte string with all zero bytes.
13
+ INVALID_TRACE_ID = ("\0" * 16).b
15
14
 
16
- # An invalid span identifier, an 8-byte array with all zero bytes, encoded
17
- # as a hexadecimal string.
18
- INVALID_SPAN_ID = ('0' * 16).freeze
15
+ # An invalid span identifier, an 8-byte string with all zero bytes.
16
+ INVALID_SPAN_ID = ("\0" * 8).b
19
17
 
20
- # Generates a valid trace identifier, a 16-byte array with at least one
21
- # non-zero byte, encoded as a hexadecimal string.
18
+ # Generates a valid trace identifier, a 16-byte string with at least one
19
+ # non-zero byte.
22
20
  #
23
- # @return [String] a hexadecimal string encoding of a valid trace ID.
21
+ # @return [String] a valid trace ID.
24
22
  def self.generate_trace_id
25
23
  loop do
26
- id = Random::DEFAULT.bytes(16).unpack1('H*')
24
+ id = Random::DEFAULT.bytes(16)
27
25
  return id unless id == INVALID_TRACE_ID
28
26
  end
29
27
  end
30
28
 
31
- # Generates a valid span identifier, an 8-byte array with at least one
32
- # non-zero byte, encoded as a hexadecimal string.
29
+ # Generates a valid span identifier, an 8-byte string with at least one
30
+ # non-zero byte.
33
31
  #
34
- # @return [String] a hexadecimal string encoding of a valid span ID.
32
+ # @return [String] a valid span ID.
35
33
  def self.generate_span_id
36
34
  loop do
37
- id = Random::DEFAULT.bytes(8).unpack1('H*')
35
+ id = Random::DEFAULT.bytes(8)
38
36
  return id unless id == INVALID_SPAN_ID
39
37
  end
40
38
  end
41
39
  end
42
40
  end
43
41
 
44
- require 'opentelemetry/trace/event'
45
42
  require 'opentelemetry/trace/link'
46
43
  require 'opentelemetry/trace/trace_flags'
47
44
  require 'opentelemetry/trace/span_context'
48
45
  require 'opentelemetry/trace/span_kind'
49
46
  require 'opentelemetry/trace/span'
50
- require 'opentelemetry/trace/sampling_hint'
51
47
  require 'opentelemetry/trace/status'
48
+ require 'opentelemetry/trace/propagation'
52
49
  require 'opentelemetry/trace/tracer'
53
- require 'opentelemetry/trace/tracer_factory'
50
+ require 'opentelemetry/trace/tracer_provider'
@@ -22,14 +22,15 @@ module OpenTelemetry
22
22
 
23
23
  # Returns the frozen attributes for this link.
24
24
  #
25
- # @return [Hash<String, Object>]
25
+ # @return [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]
26
26
  attr_reader :attributes
27
27
 
28
28
  # Returns a new immutable {Link}.
29
29
  #
30
30
  # @param [SpanContext] span_context The context of the linked {Span}.
31
- # @param [optional Hash<String, Object>] attributes A hash of attributes for
32
- # this link. Attributes will be frozen during Link initialization.
31
+ # @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]
32
+ # attributes A hash of attributes for this link. Attributes will be
33
+ # frozen during Link initialization.
33
34
  # @return [Link]
34
35
  def initialize(span_context, attributes = nil)
35
36
  @context = span_context
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ require 'opentelemetry/trace/propagation/context_keys'
8
+ require 'opentelemetry/trace/propagation/trace_context'
9
+
10
+ module OpenTelemetry
11
+ module Trace
12
+ # The Trace::Propagation module contains injectors and extractors for
13
+ # sending and receiving span context over the wire
14
+ module Propagation
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ module OpenTelemetry
8
+ module Trace
9
+ module Propagation
10
+ # Contains the keys used to index the current span, or extracted span
11
+ # context in a {Context} instance
12
+ module ContextKeys
13
+ extend self
14
+
15
+ EXTRACTED_SPAN_CONTEXT_KEY = Context.create_key('extracted-span-context')
16
+ CURRENT_SPAN_KEY = Context.create_key('current-span')
17
+ private_constant :EXTRACTED_SPAN_CONTEXT_KEY, :CURRENT_SPAN_KEY
18
+
19
+ # Returns the context key that an extracted span context is indexed by
20
+ #
21
+ # @return [Context::Key]
22
+ def extracted_span_context_key
23
+ EXTRACTED_SPAN_CONTEXT_KEY
24
+ end
25
+
26
+ # Returns the context key that the current span is indexed by
27
+ #
28
+ # @return [Context::Key]
29
+ def current_span_key
30
+ CURRENT_SPAN_KEY
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ require 'opentelemetry/trace/propagation/trace_context/trace_parent'
8
+ require 'opentelemetry/trace/propagation/trace_context/text_map_extractor'
9
+ require 'opentelemetry/trace/propagation/trace_context/text_map_injector'
10
+
11
+ module OpenTelemetry
12
+ module Trace
13
+ module Propagation
14
+ # The TraceContext module contains injectors, extractors, and utilties
15
+ # for context propagation in the W3C Trace Context format.
16
+ module TraceContext
17
+ extend self
18
+
19
+ TEXT_MAP_EXTRACTOR = TextMapExtractor.new
20
+ TEXT_MAP_INJECTOR = TextMapInjector.new
21
+ RACK_EXTRACTOR = TextMapExtractor.new(
22
+ traceparent_key: 'HTTP_TRACEPARENT',
23
+ tracestate_key: 'HTTP_TRACESTATE'
24
+ )
25
+ RACK_INJECTOR = TextMapInjector.new(
26
+ traceparent_key: 'HTTP_TRACEPARENT',
27
+ tracestate_key: 'HTTP_TRACESTATE'
28
+ )
29
+
30
+ private_constant :TEXT_MAP_INJECTOR, :TEXT_MAP_EXTRACTOR,
31
+ :RACK_INJECTOR, :RACK_EXTRACTOR
32
+
33
+ # Returns an extractor that extracts context using the W3C Trace Context
34
+ # format
35
+ def text_map_extractor
36
+ TEXT_MAP_EXTRACTOR
37
+ end
38
+
39
+ # Returns an injector that injects context using the W3C Trace Context
40
+ # format
41
+ def text_map_injector
42
+ TEXT_MAP_INJECTOR
43
+ end
44
+
45
+ # Returns an extractor that extracts context using the W3C Trace Context
46
+ # with Rack normalized keys (upcased and prefixed with HTTP_)
47
+ def rack_extractor
48
+ RACK_EXTRACTOR
49
+ end
50
+
51
+ # Returns an injector that injects context using the W3C Trace Context
52
+ # format with Rack normalized keys (upcased and prefixed with HTTP_)
53
+ def rack_injector
54
+ RACK_INJECTOR
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+ module OpenTelemetry
7
+ module Trace
8
+ module Propagation
9
+ module TraceContext
10
+ # Extracts context from carriers in the W3C Trace Context format
11
+ class TextMapExtractor
12
+ include Context::Propagation::DefaultGetter
13
+
14
+ # Returns a new TextMapExtractor that extracts context using the
15
+ # specified header keys
16
+ #
17
+ # @param [String] traceparent_key The traceparent header key used in the carrier
18
+ # @param [String] tracestate_key The tracestate header key used in the carrier
19
+ # @return [TextMapExtractor]
20
+ def initialize(traceparent_key: 'traceparent',
21
+ tracestate_key: 'tracestate')
22
+ @traceparent_key = traceparent_key
23
+ @tracestate_key = tracestate_key
24
+ end
25
+
26
+ # Extract a remote {Trace::SpanContext} from the supplied carrier.
27
+ # Invalid headers will result in a new, valid, non-remote {Trace::SpanContext}.
28
+ #
29
+ # @param [Carrier] carrier The carrier to get the header from.
30
+ # @param [Context] context The context to be updated with extracted context
31
+ # @param [optional Callable] getter An optional callable that takes a carrier and a key and
32
+ # returns the value associated with the key. If omitted the default getter will be used
33
+ # which expects the carrier to respond to [] and []=.
34
+ # @yield [Carrier, String] if an optional getter is provided, extract will yield the carrier
35
+ # and the header key to the getter.
36
+ # @return [Context] Updated context with span context from the header, or the original
37
+ # context if parsing fails.
38
+ def extract(carrier, context, &getter)
39
+ getter ||= default_getter
40
+ header = getter.call(carrier, @traceparent_key)
41
+ tp = TraceParent.from_string(header)
42
+
43
+ tracestate = getter.call(carrier, @tracestate_key)
44
+
45
+ span_context = Trace::SpanContext.new(trace_id: tp.trace_id,
46
+ span_id: tp.span_id,
47
+ trace_flags: tp.flags,
48
+ tracestate: tracestate,
49
+ remote: true)
50
+ context.set_value(ContextKeys.extracted_span_context_key, span_context)
51
+ rescue OpenTelemetry::Error
52
+ context
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+ module OpenTelemetry
7
+ module Trace
8
+ module Propagation
9
+ module TraceContext
10
+ # Injects context into carriers using the W3C Trace Context format
11
+ class TextMapInjector
12
+ include Context::Propagation::DefaultSetter
13
+
14
+ # Returns a new TextMapInjector that injects context using the
15
+ # specified header keys
16
+ #
17
+ # @param [String] traceparent_key The traceparent header key used in the carrier
18
+ # @param [String] tracestate_key The tracestate header key used in the carrier
19
+ # @return [TextMapInjector]
20
+ def initialize(traceparent_key: 'traceparent',
21
+ tracestate_key: 'tracestate')
22
+ @traceparent_key = traceparent_key
23
+ @tracestate_key = tracestate_key
24
+ end
25
+
26
+ # Set the span context on the supplied carrier.
27
+ #
28
+ # @param [Context] context The active {Context}.
29
+ # @param [optional Callable] setter An optional callable that takes a carrier and a key and
30
+ # a value and assigns the key-value pair in the carrier. If omitted the default setter
31
+ # will be used which expects the carrier to respond to [] and []=.
32
+ # @yield [Carrier, String, String] if an optional setter is provided, inject will yield
33
+ # carrier, header key, header value to the setter.
34
+ # @return [Object] the carrier with context injected
35
+ def inject(carrier, context, &setter)
36
+ return carrier unless (span_context = span_context_from(context))
37
+
38
+ setter ||= DEFAULT_SETTER
39
+ setter.call(carrier, @traceparent_key, TraceParent.from_context(span_context).to_s)
40
+ setter.call(carrier, @tracestate_key, span_context.tracestate) unless span_context.tracestate.nil?
41
+
42
+ carrier
43
+ end
44
+
45
+ private
46
+
47
+ def span_context_from(context)
48
+ context[ContextKeys.current_span_key]&.context ||
49
+ context[ContextKeys.extracted_span_context_key]
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+ module OpenTelemetry
7
+ module Trace
8
+ module Propagation
9
+ module TraceContext
10
+ # A TraceParent is an implementation of the W3C trace context specification
11
+ # https://www.w3.org/TR/trace-context/
12
+ # {Trace::SpanContext}
13
+ class TraceParent
14
+ InvalidFormatError = Class.new(Error)
15
+ InvalidVersionError = Class.new(Error)
16
+ InvalidTraceIDError = Class.new(Error)
17
+ InvalidSpanIDError = Class.new(Error)
18
+
19
+ TRACE_PARENT_HEADER = 'traceparent'
20
+ SUPPORTED_VERSION = 0
21
+ private_constant :SUPPORTED_VERSION
22
+ MAX_VERSION = 254
23
+ private_constant :MAX_VERSION
24
+
25
+ REGEXP = /^(?<version>[A-Fa-f0-9]{2})-(?<trace_id>[A-Fa-f0-9]{32})-(?<span_id>[A-Fa-f0-9]{16})-(?<flags>[A-Fa-f0-9]{2})(?<ignored>-.*)?$/.freeze
26
+ private_constant :REGEXP
27
+
28
+ INVALID_TRACE_ID = OpenTelemetry::Trace::SpanContext::INVALID.hex_trace_id
29
+ INVALID_SPAN_ID = OpenTelemetry::Trace::SpanContext::INVALID.hex_span_id
30
+ private_constant :INVALID_TRACE_ID, :INVALID_SPAN_ID
31
+
32
+ class << self
33
+ # Creates a new {TraceParent} from a supplied {Trace::SpanContext}
34
+ # @param [SpanContext] ctx The context
35
+ # @return [TraceParent] a trace parent
36
+ def from_context(ctx)
37
+ new(trace_id: ctx.trace_id, span_id: ctx.span_id, flags: ctx.trace_flags)
38
+ end
39
+
40
+ # Deserializes the {TraceParent} from the string representation
41
+ # @param [String] string The serialized trace parent
42
+ # @return [TraceParent] a trace_parent
43
+ # @raise [InvalidFormatError] on an invalid format
44
+ # @raise [InvalidVerionError] on an invalid version
45
+ # @raise [InvalidTraceIDError] on an invalid trace_id
46
+ # @raise [InvalidSpanIDError] on an invalid span_id
47
+ def from_string(string)
48
+ matches = match_input(string)
49
+
50
+ version = parse_version(matches[:version])
51
+ raise InvalidFormatError if version > SUPPORTED_VERSION && string.length < 55
52
+
53
+ trace_id = parse_trace_id(matches[:trace_id])
54
+ span_id = parse_span_id(matches[:span_id])
55
+ flags = parse_flags(matches[:flags])
56
+
57
+ new(trace_id: trace_id, span_id: span_id, flags: flags)
58
+ end
59
+
60
+ private
61
+
62
+ def match_input(string)
63
+ matches = REGEXP.match(string)
64
+ raise InvalidFormatError, 'regexp match failed' if !matches || matches.length < 6
65
+
66
+ matches
67
+ end
68
+
69
+ def parse_version(string)
70
+ v = string.to_i(16)
71
+ raise InvalidFormatError, string unless v
72
+ raise InvalidVersionError, v if v > MAX_VERSION
73
+
74
+ v
75
+ end
76
+
77
+ def parse_trace_id(string)
78
+ raise InvalidTraceIDError, string if string == INVALID_TRACE_ID
79
+
80
+ string.downcase!
81
+ Array(string).pack('H*')
82
+ end
83
+
84
+ def parse_span_id(string)
85
+ raise InvalidSpanIDError, string if string == INVALID_SPAN_ID
86
+
87
+ string.downcase!
88
+ Array(string).pack('H*')
89
+ end
90
+
91
+ def parse_flags(string)
92
+ OpenTelemetry::Trace::TraceFlags.from_byte(string.to_i(16))
93
+ end
94
+ end
95
+
96
+ attr_reader :version, :trace_id, :span_id, :flags
97
+
98
+ private_class_method :new
99
+
100
+ # Returns the sampling choice from the trace_flags
101
+ # @return [Boolean] the sampling choice
102
+ def sampled?
103
+ flags.sampled?
104
+ end
105
+
106
+ # converts this object into a string according to the w3c spec
107
+ # @return [String] the serialized trace_parent
108
+ def to_s
109
+ "00-#{trace_id.unpack1('H*')}-#{span_id.unpack1('H*')}-#{flag_string}"
110
+ end
111
+
112
+ private
113
+
114
+ def flag_string
115
+ # the w3c standard only dictates the one flag for this version
116
+ # therefore we can only output the one flag.
117
+ flags.sampled? ? '01' : '00'
118
+ end
119
+
120
+ def initialize(trace_id: nil, span_id: nil, version: SUPPORTED_VERSION, flags: Trace::TraceFlags::DEFAULT)
121
+ @trace_id = trace_id
122
+ @span_id = span_id
123
+ @version = version
124
+ @flags = flags
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end