opentelemetry-api 0.6.0 → 0.11.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -2
  3. data/CHANGELOG.md +33 -0
  4. data/LICENSE +1 -1
  5. data/{OVERVIEW.md → README.md} +0 -0
  6. data/lib/opentelemetry-api.rb +1 -1
  7. data/lib/opentelemetry.rb +1 -1
  8. data/lib/opentelemetry/baggage.rb +1 -1
  9. data/lib/opentelemetry/baggage/builder.rb +1 -1
  10. data/lib/opentelemetry/baggage/manager.rb +1 -1
  11. data/lib/opentelemetry/baggage/propagation.rb +1 -1
  12. data/lib/opentelemetry/baggage/propagation/context_keys.rb +1 -1
  13. data/lib/opentelemetry/baggage/propagation/text_map_extractor.rb +1 -1
  14. data/lib/opentelemetry/baggage/propagation/text_map_injector.rb +2 -2
  15. data/lib/opentelemetry/context.rb +1 -1
  16. data/lib/opentelemetry/context/key.rb +1 -1
  17. data/lib/opentelemetry/context/propagation.rb +1 -1
  18. data/lib/opentelemetry/context/propagation/composite_propagator.rb +1 -1
  19. data/lib/opentelemetry/context/propagation/default_getter.rb +1 -1
  20. data/lib/opentelemetry/context/propagation/default_setter.rb +1 -1
  21. data/lib/opentelemetry/context/propagation/noop_extractor.rb +1 -1
  22. data/lib/opentelemetry/context/propagation/noop_injector.rb +1 -1
  23. data/lib/opentelemetry/context/propagation/propagation.rb +1 -1
  24. data/lib/opentelemetry/context/propagation/propagator.rb +1 -1
  25. data/lib/opentelemetry/error.rb +1 -1
  26. data/lib/opentelemetry/instrumentation.rb +1 -1
  27. data/lib/opentelemetry/instrumentation/base.rb +1 -1
  28. data/lib/opentelemetry/instrumentation/registry.rb +2 -2
  29. data/lib/opentelemetry/metrics.rb +1 -1
  30. data/lib/opentelemetry/metrics/handles.rb +1 -1
  31. data/lib/opentelemetry/metrics/instruments.rb +1 -1
  32. data/lib/opentelemetry/metrics/meter.rb +1 -1
  33. data/lib/opentelemetry/metrics/meter_provider.rb +1 -1
  34. data/lib/opentelemetry/trace.rb +39 -3
  35. data/lib/opentelemetry/trace/link.rb +4 -4
  36. data/lib/opentelemetry/trace/propagation.rb +1 -2
  37. data/lib/opentelemetry/trace/propagation/trace_context.rb +1 -1
  38. data/lib/opentelemetry/trace/propagation/trace_context/text_map_extractor.rb +5 -6
  39. data/lib/opentelemetry/trace/propagation/trace_context/text_map_injector.rb +4 -5
  40. data/lib/opentelemetry/trace/propagation/trace_context/trace_parent.rb +3 -3
  41. data/lib/opentelemetry/trace/span.rb +1 -1
  42. data/lib/opentelemetry/trace/span_context.rb +3 -3
  43. data/lib/opentelemetry/trace/span_kind.rb +1 -1
  44. data/lib/opentelemetry/trace/status.rb +14 -72
  45. data/lib/opentelemetry/trace/trace_flags.rb +1 -1
  46. data/lib/opentelemetry/trace/tracer.rb +14 -55
  47. data/lib/opentelemetry/trace/tracer_provider.rb +1 -1
  48. data/lib/opentelemetry/trace/tracestate.rb +158 -0
  49. data/lib/opentelemetry/trace/util/http_to_status.rb +5 -24
  50. data/lib/opentelemetry/version.rb +2 -2
  51. metadata +10 -6
  52. data/lib/opentelemetry/trace/propagation/context_keys.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 538ed3a78ed2551d82e647c361b94afc77a083a1126093cb26674e324197d0a0
4
- data.tar.gz: eb5a65a102585407772dcc8b57b375c83198cbddc432c97a71d9fdef97e3171a
3
+ metadata.gz: 5b7fecd268c9efe43c452847e831bf1456d502c8531e589691b865bd1264b53f
4
+ data.tar.gz: d8b33160247e5d8c94b248f607b621333112cda1a6fc7af00ce68ef1caed1cb0
5
5
  SHA512:
6
- metadata.gz: '097a3f2d32207a56ba207cc2918f24e4eee28483117c54ed0412e83e617922980f385bf5c1949a91b232c4fa4a5bfccf5c66947ee65fc4ebc26460a27a33f6b6'
7
- data.tar.gz: 533897d0cea9a0f731e4d7badf100089fb2bb87e95cbe28060e222aea4137272a4e71f9dd65e12ef8a8558bf3635cc512e663de2d5364fea9a1086cab3a9cef1
6
+ metadata.gz: 06e4bda488c11623f710a74288de802c8af5fbb879bb52edbd003dd10159ff443bde7c9d6f511915e0ecdaaf54244f7b8897c4137b466bd11bdc87f51b87d337
7
+ data.tar.gz: 8466f42436e3e89e0a4339699887b3eae95551dd601f66be5b3f9ffc76f3aaad2075e95cb6aeed945422e0ea998148b769dc2781d3095a67c2051c2cc52068a7
data/.yardopts CHANGED
@@ -1,9 +1,9 @@
1
1
  --no-private
2
2
  --title=OpenTelemetry API
3
3
  --markup=markdown
4
- --main=OVERVIEW.md
4
+ --main=README.md
5
5
  ./lib/opentelemetry/**/*.rb
6
6
  ./lib/opentelemetry.rb
7
7
  -
8
- OVERVIEW.md
8
+ README.md
9
9
  CHANGELOG.md
@@ -1,5 +1,38 @@
1
1
  # Release History: opentelemetry-api
2
2
 
3
+ ### v0.11.0 / 2020-12-11
4
+
5
+ * BREAKING CHANGE: Implement tracestate
6
+
7
+ * ADDED: Implement tracestate
8
+ * FIXED: Missing white space from install messages
9
+ * FIXED: Copyright comments to not reference year
10
+
11
+ ### v0.10.0 / 2020-12-03
12
+
13
+ * (No significant changes)
14
+
15
+ ### v0.9.0 / 2020-11-27
16
+
17
+ * (No significant changes)
18
+
19
+ ### v0.8.0 / 2020-10-27
20
+
21
+ * BREAKING CHANGE: Move context/span methods to Trace module
22
+ * BREAKING CHANGE: Remove 'canonical' from status codes
23
+ * BREAKING CHANGE: Assorted SpanContext fixes
24
+
25
+ * ADDED: B3 support
26
+ * FIXED: Move context/span methods to Trace module
27
+ * FIXED: Remove 'canonical' from status codes
28
+ * FIXED: Assorted SpanContext fixes
29
+
30
+ ### v0.7.0 / 2020-10-07
31
+
32
+ * FIXED: Safely navigate span variable during error cases
33
+ * DOCS: Standardize toplevel docs structure and readme
34
+ * DOCS: Fix param description in TextMapInjector for Baggage
35
+
3
36
  ### v0.6.0 / 2020-09-10
4
37
 
5
38
  * ADDED: Add support for OTEL_LOG_LEVEL env var
data/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2020 OpenTelemetry Authors
189
+ Copyright The OpenTelemetry Authors
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
File without changes
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -16,7 +16,7 @@ module OpenTelemetry
16
16
  # Returns a new TextMapInjector that injects context using the specified
17
17
  # header key
18
18
  #
19
- # @param [String] baggage_header_key The baggage header
19
+ # @param [String] baggage_key The baggage header
20
20
  # key used in the carrier
21
21
  # @return [TextMapInjector]
22
22
  def initialize(baggage_key: 'baggage')
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
  module OpenTelemetry
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -79,7 +79,7 @@ module OpenTelemetry
79
79
  OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} failed to install"
80
80
  end
81
81
  rescue => e # rubocop:disable Style/RescueStandardError
82
- OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} unhandled exception" \
82
+ OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} unhandled exception " \
83
83
  "during install #{e}: #{e.backtrace}"
84
84
  end
85
85
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -9,6 +9,12 @@ module OpenTelemetry
9
9
  # single logical operation, consolidated across various components of an
10
10
  # application.
11
11
  module Trace
12
+ extend self
13
+
14
+ CURRENT_SPAN_KEY = Context.create_key('current-span')
15
+
16
+ private_constant :CURRENT_SPAN_KEY
17
+
12
18
  # An invalid trace identifier, a 16-byte string with all zero bytes.
13
19
  INVALID_TRACE_ID = ("\0" * 16).b
14
20
 
@@ -19,7 +25,7 @@ module OpenTelemetry
19
25
  # non-zero byte.
20
26
  #
21
27
  # @return [String] a valid trace ID.
22
- def self.generate_trace_id
28
+ def generate_trace_id
23
29
  loop do
24
30
  id = Random::DEFAULT.bytes(16)
25
31
  return id unless id == INVALID_TRACE_ID
@@ -30,17 +36,47 @@ module OpenTelemetry
30
36
  # non-zero byte.
31
37
  #
32
38
  # @return [String] a valid span ID.
33
- def self.generate_span_id
39
+ def generate_span_id
34
40
  loop do
35
41
  id = Random::DEFAULT.bytes(8)
36
42
  return id unless id == INVALID_SPAN_ID
37
43
  end
38
44
  end
45
+
46
+ # Returns the current span from the current or provided context
47
+ #
48
+ # @param [optional Context] context The context to lookup the current
49
+ # {Span} from. Defaults to Context.current
50
+ def current_span(context = nil)
51
+ context ||= Context.current
52
+ context.value(CURRENT_SPAN_KEY) || Span::INVALID
53
+ end
54
+
55
+ # Returns a context containing the span, derived from the optional parent
56
+ # context, or the current context if one was not provided.
57
+ #
58
+ # @param [optional Context] context The context to use as the parent for
59
+ # the returned context
60
+ def context_with_span(span, parent_context: Context.current)
61
+ parent_context.set_value(CURRENT_SPAN_KEY, span)
62
+ end
63
+
64
+ # Activates/deactivates the Span within the current Context, which makes the "current span"
65
+ # available implicitly.
66
+ #
67
+ # On exit, the Span that was active before calling this method will be reactivated.
68
+ #
69
+ # @param [Span] span the span to activate
70
+ # @yield [span, context] yields span and a context containing the span to the block.
71
+ def with_span(span)
72
+ Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }
73
+ end
39
74
  end
40
75
  end
41
76
 
42
77
  require 'opentelemetry/trace/link'
43
78
  require 'opentelemetry/trace/trace_flags'
79
+ require 'opentelemetry/trace/tracestate'
44
80
  require 'opentelemetry/trace/span_context'
45
81
  require 'opentelemetry/trace/span_kind'
46
82
  require 'opentelemetry/trace/span'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -18,7 +18,7 @@ module OpenTelemetry
18
18
  # Returns the {SpanContext} for this link
19
19
  #
20
20
  # @return [SpanContext]
21
- attr_reader :context
21
+ attr_reader :span_context
22
22
 
23
23
  # Returns the frozen attributes for this link.
24
24
  #
@@ -33,13 +33,13 @@ module OpenTelemetry
33
33
  # frozen during Link initialization.
34
34
  # @return [Link]
35
35
  def initialize(span_context, attributes = nil)
36
- @context = span_context
36
+ @span_context = span_context
37
37
  @attributes = attributes.freeze || EMPTY_ATTRIBUTES
38
38
  end
39
39
 
40
40
  # Returns true if two {Link}s are equal.
41
41
  def ==(other)
42
- other.context == @context && other.attributes == @attributes
42
+ other.span_context == @span_context && other.attributes == @attributes
43
43
  end
44
44
  end
45
45
  end
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
- require 'opentelemetry/trace/propagation/context_keys'
8
7
  require 'opentelemetry/trace/propagation/trace_context'
9
8
 
10
9
  module OpenTelemetry
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
  module OpenTelemetry
@@ -37,17 +37,16 @@ module OpenTelemetry
37
37
  # context if parsing fails.
38
38
  def extract(carrier, context, &getter)
39
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)
40
+ tp = TraceParent.from_string(getter.call(carrier, @traceparent_key))
41
+ tracestate = Tracestate.from_string(getter.call(carrier, @tracestate_key))
44
42
 
45
43
  span_context = Trace::SpanContext.new(trace_id: tp.trace_id,
46
44
  span_id: tp.span_id,
47
45
  trace_flags: tp.flags,
48
46
  tracestate: tracestate,
49
47
  remote: true)
50
- context.set_value(ContextKeys.extracted_span_context_key, span_context)
48
+ span = Trace::Span.new(span_context: span_context)
49
+ OpenTelemetry::Trace.context_with_span(span)
51
50
  rescue OpenTelemetry::Error
52
51
  context
53
52
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
  module OpenTelemetry
@@ -36,8 +36,8 @@ module OpenTelemetry
36
36
  return carrier unless (span_context = span_context_from(context))
37
37
 
38
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?
39
+ setter.call(carrier, @traceparent_key, TraceParent.from_span_context(span_context).to_s)
40
+ setter.call(carrier, @tracestate_key, span_context.tracestate.to_s) unless span_context.tracestate.empty?
41
41
 
42
42
  carrier
43
43
  end
@@ -45,8 +45,7 @@ module OpenTelemetry
45
45
  private
46
46
 
47
47
  def span_context_from(context)
48
- context[ContextKeys.current_span_key]&.context ||
49
- context[ContextKeys.extracted_span_context_key]
48
+ OpenTelemetry::Trace.current_span(context).context
50
49
  end
51
50
  end
52
51
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
  module OpenTelemetry
@@ -31,9 +31,9 @@ module OpenTelemetry
31
31
 
32
32
  class << self
33
33
  # Creates a new {TraceParent} from a supplied {Trace::SpanContext}
34
- # @param [SpanContext] ctx The context
34
+ # @param [SpanContext] ctx The span context
35
35
  # @return [TraceParent] a trace parent
36
- def from_context(ctx)
36
+ def from_span_context(ctx)
37
37
  new(trace_id: ctx.trace_id, span_id: ctx.span_id, flags: ctx.trace_flags)
38
38
  end
39
39
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -18,14 +18,14 @@ module OpenTelemetry
18
18
  # @param [optional String] trace_id The trace ID associated with a {Span}.
19
19
  # @param [optional String] span_id The span ID associated with a {Span}.
20
20
  # @param [optional TraceFlags] trace_flags The trace flags associated with a {Span}.
21
- # @param [optional String] tracestate The tracestate associated with a {Span}. May be nil.
21
+ # @param [optional Tracestate] tracestate The tracestate associated with a {Span}. May be nil.
22
22
  # @param [optional Boolean] remote Whether the {SpanContext} was extracted from the wire.
23
23
  # @return [SpanContext]
24
24
  def initialize(
25
25
  trace_id: Trace.generate_trace_id,
26
26
  span_id: Trace.generate_span_id,
27
27
  trace_flags: TraceFlags::DEFAULT,
28
- tracestate: nil,
28
+ tracestate: Tracestate::DEFAULT,
29
29
  remote: false
30
30
  )
31
31
  @trace_id = trace_id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -9,15 +9,15 @@ require 'opentelemetry/trace/util/http_to_status'
9
9
  module OpenTelemetry
10
10
  module Trace
11
11
  # Status represents the status of a finished {Span}. It is composed of a
12
- # canonical code in conjunction with an optional descriptive message.
12
+ # status code in conjunction with an optional descriptive message.
13
13
  class Status
14
14
  # Convenience utility, not in API spec:
15
15
  extend Util::HttpToStatus
16
16
 
17
- # Retrieve the canonical code of this Status.
17
+ # Retrieve the status code of this Status.
18
18
  #
19
19
  # @return [Integer]
20
- attr_reader :canonical_code
20
+ attr_reader :code
21
21
 
22
22
  # Retrieve the description of this Status.
23
23
  #
@@ -26,10 +26,10 @@ module OpenTelemetry
26
26
 
27
27
  # Initialize a Status.
28
28
  #
29
- # @param [Integer] canonical_code One of the standard gRPC codes: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
29
+ # @param [Integer] code One of the status codes below
30
30
  # @param [String] description
31
- def initialize(canonical_code, description: '')
32
- @canonical_code = canonical_code
31
+ def initialize(code, description: '')
32
+ @code = code
33
33
  @description = description
34
34
  end
35
35
 
@@ -37,78 +37,20 @@ module OpenTelemetry
37
37
  #
38
38
  # @return [Boolean]
39
39
  def ok?
40
- @canonical_code == OK
40
+ @code != ERROR
41
41
  end
42
42
 
43
- # The following represents the canonical set of status codes of a
44
- # finished {Span}, following the standard gRPC codes:
45
- # https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
43
+ # The following represents the set of status codes of a
44
+ # finished {Span}
46
45
 
47
46
  # The operation completed successfully.
48
47
  OK = 0
49
48
 
50
- # The operation was cancelled (typically by the caller).
51
- CANCELLED = 1
49
+ # The default status.
50
+ UNSET = 1
52
51
 
53
- # An unknown error.
54
- UNKNOWN_ERROR = 2
55
-
56
- # Client specified an invalid argument. Note that this differs from
57
- # {FAILED_PRECONDITION}. {INVALID_ARGUMENT} indicates arguments that are
58
- # problematic regardless of the state of the system.
59
- INVALID_ARGUMENT = 3
60
-
61
- # Deadline expired before operation could complete. For operations that
62
- # change the state of the system, this error may be returned even if the
63
- # operation has completed successfully.
64
- DEADLINE_EXCEEDED = 4
65
-
66
- # Some requested entity (e.g., file or directory) was not found.
67
- NOT_FOUND = 5
68
-
69
- # Some entity that we attempted to create (e.g., file or directory)
70
- # already exists.
71
- ALREADY_EXISTS = 6
72
-
73
- # The caller does not have permission to execute the specified operation.
74
- # {PERMISSION_DENIED} must not be used if the caller cannot be identified
75
- # (use {UNAUTHENTICATED} instead for those errors).
76
- PERMISSION_DENIED = 7
77
-
78
- # Some resource has been exhausted, perhaps a per-user quota, or perhaps
79
- # the entire file system is out of space.
80
- RESOURCE_EXHAUSTED = 8
81
-
82
- # Operation was rejected because the system is not in a state required
83
- # for the operation's execution.
84
- FAILED_PRECONDITION = 9
85
-
86
- # The operation was aborted, typically due to a concurrency issue like
87
- # sequencer check failures, transaction aborts, etc.
88
- ABORTED = 10
89
-
90
- # Operation was attempted past the valid range. E.g., seeking or reading
91
- # past end of file. Unlike {INVALID_ARGUMENT}, this error indicates a
92
- # problem that may be fixed if the system state changes.
93
- OUT_OF_RANGE = 11
94
-
95
- # Operation is not implemented or not supported/enabled in this service.
96
- UNIMPLEMENTED = 12
97
-
98
- # Internal errors. Means some invariants expected by underlying system
99
- # has been broken.
100
- INTERNAL_ERROR = 13
101
-
102
- # The service is currently unavailable. This is a most likely a transient
103
- # condition and may be corrected by retrying with a backoff.
104
- UNAVAILABLE = 14
105
-
106
- # Unrecoverable data loss or corruption.
107
- DATA_LOSS = 15
108
-
109
- # The request does not have valid authentication credentials for the
110
- # operation.
111
- UNAUTHENTICATED = 16
52
+ # An error.
53
+ ERROR = 2
112
54
  end
113
55
  end
114
56
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -8,35 +8,6 @@ module OpenTelemetry
8
8
  module Trace
9
9
  # No-op implementation of Tracer.
10
10
  class Tracer
11
- EXTRACTED_SPAN_CONTEXT_KEY = Propagation::ContextKeys.extracted_span_context_key
12
- CURRENT_SPAN_KEY = Propagation::ContextKeys.current_span_key
13
-
14
- private_constant :EXTRACTED_SPAN_CONTEXT_KEY, :CURRENT_SPAN_KEY
15
-
16
- # Returns the current span from the current or provided context
17
- #
18
- # @param [optional Context] context The context to lookup the current
19
- # {Span} from. Defaults to Context.current
20
- def current_span(context = Context.current)
21
- context.value(CURRENT_SPAN_KEY) || Span::INVALID
22
- end
23
-
24
- # Returns the the active span context from the given {Context}, or current
25
- # if one is not explicitly passed in. The active span context may refer to
26
- # a {SpanContext} that has been extracted. If both a current {Span} and an
27
- # extracted, {SpanContext} exist, the context of the current {Span} will be
28
- # returned.
29
- #
30
- # @param [optional Context] context The context to lookup the active
31
- # {SpanContext} from.
32
- #
33
- def active_span_context(context = nil)
34
- context ||= Context.current
35
- context.value(CURRENT_SPAN_KEY)&.context ||
36
- context.value(EXTRACTED_SPAN_CONTEXT_KEY) ||
37
- SpanContext::INVALID
38
- end
39
-
40
11
  # This is a helper for the default use-case of extending the current trace with a span.
41
12
  #
42
13
  # With this helper:
@@ -45,34 +16,24 @@ module OpenTelemetry
45
16
  #
46
17
  # Equivalent without helper:
47
18
  #
48
- # OpenTelemetry.tracer.with_span(OpenTelemetry.tracer.start_span('do-the-thing')) do ... end
19
+ # OpenTelemetry::Trace.with_span(tracer.start_span('do-the-thing')) do ... end
49
20
  #
50
21
  # On exit, the Span that was active before calling this method will be reactivated. If an
51
22
  # exception occurs during the execution of the provided block, it will be recorded on the
52
23
  # span and reraised.
53
24
  # @yield [span, context] yields the newly created span and a context containing the
54
25
  # span to the block.
55
- def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, with_parent: nil, with_parent_context: nil)
56
- span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, with_parent: with_parent, with_parent_context: with_parent_context)
57
- with_span(span) { |s, c| yield s, c }
26
+ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, with_parent: nil)
27
+ span = nil
28
+ span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, with_parent: with_parent)
29
+ Trace.with_span(span) { |s, c| yield s, c }
58
30
  rescue Exception => e # rubocop:disable Lint/RescueException
59
- span.record_exception(e)
60
- span.status = Status.new(Status::UNKNOWN_ERROR,
61
- description: "Unhandled exception of type: #{e.class}")
31
+ span&.record_exception(e)
32
+ span&.status = Status.new(Status::ERROR,
33
+ description: "Unhandled exception of type: #{e.class}")
62
34
  raise e
63
35
  ensure
64
- span.finish
65
- end
66
-
67
- # Activates/deactivates the Span within the current Context, which makes the "current span"
68
- # available implicitly.
69
- #
70
- # On exit, the Span that was active before calling this method will be reactivated.
71
- #
72
- # @param [Span] span the span to activate
73
- # @yield [span, context] yields span and a context containing the span to the block.
74
- def with_span(span)
75
- Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }
36
+ span&.finish
76
37
  end
77
38
 
78
39
  def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
@@ -84,14 +45,12 @@ module OpenTelemetry
84
45
  #
85
46
  # Parent context can be either passed explicitly, or inferred from currently activated span.
86
47
  #
87
- # @param [optional Span] with_parent Explicitly managed parent Span, overrides
88
- # +with_parent_context+.
89
- # @param [optional Context] with_parent_context Explicitly managed. Overridden by
90
- # +with_parent+.
48
+ # @param [optional Context] with_parent Explicitly managed parent context
91
49
  #
92
50
  # @return [Span]
93
- def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
94
- span_context = with_parent&.context || active_span_context(with_parent_context)
51
+ def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
52
+ span_context = OpenTelemetry::Trace.current_span(with_parent).context
53
+
95
54
  if span_context.valid?
96
55
  Span.new(span_context: span_context)
97
56
  else
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -0,0 +1,158 @@
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 Trace
9
+ # Tracestate is a part of SpanContext, represented by an immutable list of
10
+ # string key/value pairs and formally defined by the W3C Trace Context
11
+ # specification https://www.w3.org/TR/trace-context/
12
+ class Tracestate
13
+ class << self
14
+ private :new # rubocop:disable Style/AccessModifierDeclarations
15
+
16
+ # Returns a newly created Tracestate parsed from the header provided.
17
+ #
18
+ # @param [String] header Encoding of the tracestate header defined by
19
+ # the W3C Trace Context specification https://www.w3.org/TR/trace-context/
20
+ # @return [Tracestate] A new Tracestate instance or DEFAULT
21
+ def from_string(header) # rubocop:disable Metrics/CyclomaticComplexity:
22
+ return DEFAULT if header.nil? || header.empty?
23
+
24
+ hash = header.split(',').each_with_object({}) do |member, memo|
25
+ member.strip!
26
+ kv = member.split('=')
27
+ k, v = *kv
28
+ next unless kv.length == 2 && VALID_KEY.match?(k) && VALID_VALUE.match?(v)
29
+
30
+ memo[k] = v
31
+ end
32
+ return DEFAULT if hash.empty?
33
+
34
+ new(hash)
35
+ end
36
+
37
+ # Returns a Tracestate created from a Hash.
38
+ #
39
+ # @param [Hash<String, String>] hash Key-value pairs to store in the
40
+ # Tracestate. Keys and values are validated against the W3C Trace
41
+ # Context specification, and any invalid members are logged at
42
+ # DEBUG level and dropped.
43
+ # @return [Tracestate] A new Tracestate instance or DEFAULT
44
+ def from_hash(hash)
45
+ hash = hash.select do |k, v|
46
+ valid = VALID_KEY.match?(k) && VALID_VALUE.match?(v)
47
+ OpenTelemetry.logger.debug("Invalid Tracestate member - #{k} : #{v}") unless valid
48
+ valid
49
+ end
50
+ new(hash)
51
+ end
52
+
53
+ # @api private
54
+ # Returns a new Tracestate created from the Hash provided. This
55
+ # skips validation of the keys and values, assuming they are already
56
+ # valid.
57
+ # This method is intended only for the use of instance methods in
58
+ # this class.
59
+ def create(hash)
60
+ new(hash)
61
+ end
62
+ end
63
+
64
+ MAX_MEMBER_COUNT = 32 # Defined by https://www.w3.org/TR/trace-context/
65
+ VALID_KEY = Regexp.union(%r(^[a-z][a-z0-9_\-*/]{,255}$), %r(^[a-z0-9][a-z0-9_\-*/]{,240}@[a-z][a-z0-9_\-*/]{,13}$)).freeze
66
+ VALID_VALUE = /^[ -~&&[^,=]]{,255}[!-~&&[^,=]]$/.freeze
67
+ private_constant(:MAX_MEMBER_COUNT, :VALID_KEY, :VALID_VALUE)
68
+
69
+ # @api private
70
+ # The constructor is private and only for use internally by the class.
71
+ # Users should use the {from_hash} or {from_string} factory methods to
72
+ # obtain a {Tracestate} instance.
73
+ #
74
+ # @param [Hash<String, String>] hash Key-value pairs
75
+ # @return [Tracestate]
76
+ def initialize(hash)
77
+ excess = hash.size - MAX_MEMBER_COUNT
78
+ hash = Hash[hash.drop(excess)] if excess.positive?
79
+ @hash = hash.freeze
80
+ end
81
+
82
+ # Returns the value associated with the given key, or nil if the key
83
+ # is not present.
84
+ #
85
+ # @param [String] key The key to lookup.
86
+ # @return [String] The value associated with the key, or nil.
87
+ def value(key)
88
+ @hash[key]
89
+ end
90
+
91
+ alias [] value
92
+
93
+ # Adds a new key/value pair or updates an existing value for a given key.
94
+ # Keys and values are validated against the W3C Trace Context
95
+ # specification, and any invalid members are logged at DEBUG level and
96
+ # ignored.
97
+ #
98
+ # @param [String] key The key to add or update.
99
+ # @param [String] value The value to add or update.
100
+ # @return [Tracestate] self, if unchanged, or a new Tracestate containing
101
+ # the new or updated key/value pair.
102
+ def set_value(key, value)
103
+ return self unless VALID_KEY.match?(key) && VALID_VALUE.match?(value)
104
+
105
+ h = Hash[@hash]
106
+ h[key] = value
107
+ self.class.create(h)
108
+ end
109
+
110
+ # Deletes the key/value pair associated with the given key.
111
+ #
112
+ # @param [String] key The key to remove.
113
+ # @return [Tracestate] self, if unchanged, or a new Tracestate without
114
+ # the specified key.
115
+ def delete(key)
116
+ return self unless @hash.key?(key)
117
+
118
+ h = Hash[@hash]
119
+ h.delete(key)
120
+ self.class.create(h)
121
+ end
122
+
123
+ # Returns this Tracestate encoded according to the W3C Trace Context
124
+ # specification https://www.w3.org/TR/trace-context/
125
+ #
126
+ # @return [String] this Tracestate encoded as a string.
127
+ def to_s
128
+ @hash.inject(+'') do |memo, (k, v)|
129
+ memo << k << '=' << v << ','
130
+ end.chop! || ''
131
+ end
132
+
133
+ # Returns this Tracestate as a Hash.
134
+ #
135
+ # @return [Hash] the members of this Tracestate
136
+ def to_h
137
+ @hash.dup
138
+ end
139
+
140
+ # Returns true if this Tracestate is empty.
141
+ #
142
+ # @return [Boolean] true if this Tracestate is empty, else false.
143
+ def empty?
144
+ @hash.empty?
145
+ end
146
+
147
+ # Returns true if this Tracestate equals other.
148
+ #
149
+ # @param [Tracestate] other The Tracestate for comparison.
150
+ # @return [Boolean] true if this Tracestate == other, else false.
151
+ def ==(other)
152
+ @hash == other.to_h
153
+ end
154
+
155
+ DEFAULT = new({})
156
+ end
157
+ end
158
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
@@ -9,36 +9,17 @@ module OpenTelemetry
9
9
  module Util
10
10
  # Convenience methods, not necessarily required by the API specification.
11
11
  module HttpToStatus
12
- # Implemented according to
13
- # https://github.com/open-telemetry/opentelemetry-specification/issues/306
14
- # https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md#status
12
+ # Maps numeric HTTP status codes to Trace::Status. This module is a mixin for Trace::Status
13
+ # and is not intended for standalone use.
15
14
  #
16
15
  # @param code Numeric HTTP status
17
16
  # @return Status
18
- def http_to_status(code) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
17
+ def http_to_status(code)
19
18
  case code.to_i
20
19
  when 100..399
21
20
  new(const_get(:OK))
22
- when 401
23
- new(const_get(:UNAUTHENTICATED))
24
- when 403
25
- new(const_get(:PERMISSION_DENIED))
26
- when 404
27
- new(const_get(:NOT_FOUND))
28
- when 429
29
- new(const_get(:RESOURCE_EXHAUSTED))
30
- when 400..499
31
- new(const_get(:INVALID_ARGUMENT))
32
- when 501
33
- new(const_get(:UNIMPLEMENTED))
34
- when 503
35
- new(const_get(:UNAVAILABLE))
36
- when 504
37
- new(const_get(:DEADLINE_EXCEEDED))
38
- when 500..599
39
- new(const_get(:INTERNAL_ERROR))
40
21
  else
41
- new(const_get(:UNKNOWN_ERROR))
22
+ new(const_get(:ERROR))
42
23
  end
43
24
  end
44
25
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2019 OpenTelemetry Authors
3
+ # Copyright The OpenTelemetry Authors
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
7
  module OpenTelemetry
8
8
  ## Current OpenTelemetry version
9
- VERSION = '0.6.0'
9
+ VERSION = '0.11.0'
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-11 00:00:00.000000000 Z
11
+ date: 2020-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ipsa
@@ -146,7 +146,7 @@ files:
146
146
  - ".yardopts"
147
147
  - CHANGELOG.md
148
148
  - LICENSE
149
- - OVERVIEW.md
149
+ - README.md
150
150
  - lib/opentelemetry-api.rb
151
151
  - lib/opentelemetry.rb
152
152
  - lib/opentelemetry/baggage.rb
@@ -178,7 +178,6 @@ files:
178
178
  - lib/opentelemetry/trace.rb
179
179
  - lib/opentelemetry/trace/link.rb
180
180
  - lib/opentelemetry/trace/propagation.rb
181
- - lib/opentelemetry/trace/propagation/context_keys.rb
182
181
  - lib/opentelemetry/trace/propagation/trace_context.rb
183
182
  - lib/opentelemetry/trace/propagation/trace_context/text_map_extractor.rb
184
183
  - lib/opentelemetry/trace/propagation/trace_context/text_map_injector.rb
@@ -190,12 +189,17 @@ files:
190
189
  - lib/opentelemetry/trace/trace_flags.rb
191
190
  - lib/opentelemetry/trace/tracer.rb
192
191
  - lib/opentelemetry/trace/tracer_provider.rb
192
+ - lib/opentelemetry/trace/tracestate.rb
193
193
  - lib/opentelemetry/trace/util/http_to_status.rb
194
194
  - lib/opentelemetry/version.rb
195
195
  homepage: https://github.com/open-telemetry/opentelemetry-ruby
196
196
  licenses:
197
197
  - Apache-2.0
198
- metadata: {}
198
+ metadata:
199
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.11.0/file.CHANGELOG.html
200
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/api
201
+ bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
202
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.11.0
199
203
  post_install_message:
200
204
  rdoc_options: []
201
205
  require_paths:
@@ -211,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
215
  - !ruby/object:Gem::Version
212
216
  version: '0'
213
217
  requirements: []
214
- rubygems_version: 3.1.2
218
+ rubygems_version: 3.1.4
215
219
  signing_key:
216
220
  specification_version: 4
217
221
  summary: A stats collection and distributed tracing framework
@@ -1,35 +0,0 @@
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