opentelemetry-sdk 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/README.md +73 -0
  4. data/lib/opentelemetry-sdk.rb +7 -0
  5. data/lib/opentelemetry/sdk.rb +50 -0
  6. data/lib/opentelemetry/sdk/configurator.rb +158 -0
  7. data/lib/opentelemetry/sdk/correlation_context.rb +16 -0
  8. data/lib/opentelemetry/sdk/correlation_context/builder.rb +40 -0
  9. data/lib/opentelemetry/sdk/correlation_context/manager.rb +87 -0
  10. data/lib/opentelemetry/sdk/internal.rb +21 -1
  11. data/lib/opentelemetry/sdk/resources/resource.rb +4 -3
  12. data/lib/opentelemetry/sdk/trace.rb +1 -1
  13. data/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb +18 -10
  14. data/lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb +5 -5
  15. data/lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb +2 -2
  16. data/lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb +3 -3
  17. data/lib/opentelemetry/sdk/trace/export/simple_span_processor.rb +10 -1
  18. data/lib/opentelemetry/sdk/trace/multi_span_processor.rb +12 -1
  19. data/lib/opentelemetry/sdk/trace/noop_span_processor.rb +10 -1
  20. data/lib/opentelemetry/sdk/trace/samplers.rb +9 -19
  21. data/lib/opentelemetry/sdk/trace/samplers/decision.rb +3 -3
  22. data/lib/opentelemetry/sdk/trace/samplers/probability_sampler.rb +6 -19
  23. data/lib/opentelemetry/sdk/trace/samplers/result.rb +4 -3
  24. data/lib/opentelemetry/sdk/trace/span.rb +22 -6
  25. data/lib/opentelemetry/sdk/trace/tracer.rb +9 -10
  26. data/lib/opentelemetry/sdk/trace/{tracer_factory.rb → tracer_provider.rb} +5 -5
  27. data/lib/opentelemetry/sdk/version.rb +1 -1
  28. metadata +12 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ec567bdc317284ee832998232c68645a334e361aa25525901d2054982fe1390
4
- data.tar.gz: c82ce9e13256fd7e70937f806a11fae72798748e92bdb68b587a6aaa2274f00e
3
+ metadata.gz: 4e4e07f01a74b3728fc3e3b7624bc4bc8e2b82ec2fdfcd8512544ba9fb28b202
4
+ data.tar.gz: a28f74743c88d4cb4b06917061c6995805550d3d048bddda10db850e83399259
5
5
  SHA512:
6
- metadata.gz: 1417b975acd7e5006b58c34341f464db4ba809b8664ff0282cc1c7b6caac54358c33691a04dadf78ae1df8323cbb8f8dc8b10bd33da4326fb57ee0c293279f6c
7
- data.tar.gz: 1b2c01c8f77f936cdc9c144f8b1237f7ca46fa92a657bbc0d0824288bde5c3ba49914761f7181630c49c43d843b3c6e39bf33bda30147530f156c6f82e79f63e
6
+ metadata.gz: 19e27ad4c599e28e9f9bd5156af4228b3fd0e043b793cff9f87e4ef84e82efc3e22053a8406ce2c24a47527194e398243ea137bc6e9b32ec15b0dafc490c456d
7
+ data.tar.gz: 2e82d76bca14d45cec4cacc92255c8779d4ccb272b72b8d854c93e9a455675e496a5c562ee4932cb2bc00c971e932be7494db36d78277486e91f7568da44e4f1
@@ -0,0 +1,9 @@
1
+ --no-private
2
+ --title=OpenTelemetry SDK
3
+ --markup=markdown
4
+ --main=OVERVIEW.md
5
+ ./lib/opentelemetry/sdk/**/*.rb
6
+ ./lib/opentelemetry/sdk.rb
7
+ -
8
+ OVERVIEW.md
9
+ CHANGELOG.md
@@ -0,0 +1,73 @@
1
+ # opentelemetry-sdk
2
+
3
+ The `opentelemetry-sdk` gem provides the reference implementation of the OpenTelemetry Ruby API. Using `opentelemetry-sdk`, an application can collect, analyze, and export telemetry data such as distributed traces and metrics.
4
+
5
+ ## What is OpenTelemetry?
6
+
7
+ [OpenTelemetry][opentelemetry-home] is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.
8
+
9
+ OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application. You can analyze them using Prometheus, Jaeger, and other observability tools.
10
+
11
+ ## How does this gem fit in?
12
+
13
+ The `opentelemetry-sdk` gem provides the reference implementation of the OpenTelemetry Ruby interfaces defined in the `opentelemetry-api` gem. That is, it includes the *functionality* needed to collect, analyze, and export telemetry data produced using the API.
14
+
15
+ Generally, Ruby *applications* should install `opentelemetry-sdk` (or other concrete implementation of the OpenTelemetry API). Using the SDK, an application can configure how it wants telemetry data to be handled, including which data should be persisted, how it should be formatted, and where it should be recorded or exported. However, *libraries* that produce telemetry data should generally depend only on `opentelemetry-api`, deferring the choise of concrete implementation to the application developer.
16
+
17
+ ## How do I get started?
18
+
19
+ Install the gem using:
20
+
21
+ ```
22
+ gem install opentelemetry-sdk
23
+ ```
24
+
25
+ Or, if you use [bundler][bundler-home], include `opentelemetry-sdk` in your `Gemfile`.
26
+
27
+ Then, configure the SDK according to your desired handling of telemetry data, and use the OpenTelemetry interfaces to produces traces and other information. Following is a basic example.
28
+
29
+ ```ruby
30
+ require 'opentelemetry/sdk'
31
+
32
+ # Configure the sdk with default export and context propagation formats
33
+ # see SDK#configure for customizing the setup
34
+ OpenTelemetry::SDK.configure
35
+
36
+ # To start a trace you need to get a Tracer from the TracerProvider
37
+ tracer = OpenTelemetry.tracer_provider.tracer('my_app_or_gem', '0.1.0')
38
+
39
+ # create a span
40
+ tracer.in_span('foo') do |span|
41
+ # set an attribute
42
+ span.set_attribute('platform', 'osx')
43
+ # add an event
44
+ span.add_event(name: 'event in bar')
45
+ # create bar as child of foo
46
+ tracer.in_span('bar') do |child_span|
47
+ # inspect the span
48
+ pp child_span
49
+ end
50
+ end
51
+ ```
52
+
53
+ For additional examples, see the [examples on github][examples-github].
54
+
55
+ ## How can I get involved?
56
+
57
+ The `opentelemetry-sdk` gem source is [on github][repo-github], along with related gems including `opentelemetry-api`.
58
+
59
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
60
+
61
+ ## License
62
+
63
+ The `opentelemetry-sdk` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information.
64
+
65
+
66
+ [opentelemetry-home]: https://opentelemetry.io
67
+ [bundler-home]: https://bundler.io
68
+ [repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
69
+ [license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/master/LICENSE
70
+ [examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/examples
71
+ [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
72
+ [community-meetings]: https://github.com/open-telemetry/community#community-meetings
73
+ [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ require 'opentelemetry/sdk'
@@ -6,12 +6,62 @@
6
6
 
7
7
  require 'opentelemetry'
8
8
 
9
+ # OpenTelemetry is an open source observability framework, providing a
10
+ # general-purpose API, SDK, and related tools required for the instrumentation
11
+ # of cloud-native software, frameworks, and libraries.
12
+ #
13
+ # The OpenTelemetry module provides global accessors for telemetry objects.
14
+ # See the documentation for the `opentelemetry-api` gem for details.
9
15
  module OpenTelemetry
10
16
  # SDK provides the reference implementation of the OpenTelemetry API.
11
17
  module SDK
18
+ extend self
19
+
20
+ # Configures SDK and instrumentation
21
+ #
22
+ # @yieldparam [Configurator] configurator Yields a configurator to the
23
+ # provided block
24
+ #
25
+ # Example usage:
26
+ # Without a block defaults are installed without any instrumentation
27
+ #
28
+ # OpenTelemetry::SDK.configure
29
+ #
30
+ # Install instrumentation individually with optional config
31
+ #
32
+ # OpenTelemetry::SDK.configure do |c|
33
+ # c.use 'OpenTelemetry::Adapters::Faraday', tracer_middleware: SomeMiddleware
34
+ # end
35
+ #
36
+ # Install all instrumentation with optional config
37
+ #
38
+ # OpenTelemetry::SDK.configure do |c|
39
+ # c.use_all 'OpenTelemetry::Adapters::Faraday' => { tracer_middleware: SomeMiddleware }
40
+ # end
41
+ #
42
+ # Add a span processor
43
+ #
44
+ # OpenTelemetry::SDK.configure do |c|
45
+ # c.add_span_processor SpanProcessor.new(SomeExporter.new)
46
+ # end
47
+ #
48
+ # Configure everything
49
+ #
50
+ # OpenTelemetry::SDK.configure do |c|
51
+ # c.logger = Logger.new('/dev/null')
52
+ # c.add_span_processor SpanProcessor.new(SomeExporter.new)
53
+ # c.use_all
54
+ # end
55
+ def configure
56
+ configurator = Configurator.new
57
+ yield configurator if block_given?
58
+ configurator.configure
59
+ end
12
60
  end
13
61
  end
14
62
 
63
+ require 'opentelemetry/sdk/configurator'
64
+ require 'opentelemetry/sdk/correlation_context'
15
65
  require 'opentelemetry/sdk/internal'
16
66
  require 'opentelemetry/sdk/resources'
17
67
  require 'opentelemetry/sdk/trace'
@@ -0,0 +1,158 @@
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 SDK
9
+ # The configurator provides defaults and facilitates configuring the
10
+ # SDK for use.
11
+ class Configurator
12
+ USE_MODE_UNSPECIFIED = 0
13
+ USE_MODE_ONE = 1
14
+ USE_MODE_ALL = 2
15
+
16
+ private_constant :USE_MODE_UNSPECIFIED, :USE_MODE_ONE, :USE_MODE_ALL
17
+
18
+ attr_writer :logger, :http_extractors, :http_injectors, :text_extractors,
19
+ :text_injectors
20
+
21
+ def initialize
22
+ @adapter_names = []
23
+ @adapter_config_map = {}
24
+ @http_extractors = nil
25
+ @http_injectors = nil
26
+ @text_extractors = nil
27
+ @text_injectors = nil
28
+ @span_processors = []
29
+ @use_mode = USE_MODE_UNSPECIFIED
30
+ @tracer_provider = Trace::TracerProvider.new
31
+ end
32
+
33
+ def logger
34
+ @logger ||= Logger.new(STDOUT)
35
+ end
36
+
37
+ # Install an instrumentation adapter with specificied optional +config+.
38
+ # Use can be called multiple times to install multiple instrumentation
39
+ # adapters. Only +use+ or +use_all+, but not both when installing
40
+ # instrumentation. A call to +use_all+ after +use+ will result in an
41
+ # exception.
42
+ #
43
+ # @param [String] adapter_name The name of the instrumentation adapter
44
+ # @param [optional Hash] config The config for this adapter
45
+ def use(adapter_name, config = nil)
46
+ check_use_mode!(USE_MODE_ONE)
47
+ @adapter_names << adapter_name
48
+ @adapter_config_map[adapter_name] = config if config
49
+ end
50
+
51
+ # Install all registered instrumentation. Configuration for specific
52
+ # adapters can be provided with the optional +adapter_config_map+
53
+ # parameter. Only +use+ or +use_all+, but not both when installing
54
+ # instrumentation. A call to +use+ after +use_all+ will result in an
55
+ # exception.
56
+ #
57
+ # @param [optional Hash<String,Hash>] adapter_config_map A map with string keys
58
+ # representing the adapter name and values specifying the adapter config
59
+ def use_all(adapter_config_map = {})
60
+ check_use_mode!(USE_MODE_ALL)
61
+ @adapter_config_map = adapter_config_map
62
+ end
63
+
64
+ # Add a span processor to the export pipeline
65
+ #
66
+ # @param [#on_start, #on_finish, #shutdown] span_processor A span_processor
67
+ # that satisfies the duck type #on_start, #on_finish, #shutdown. See
68
+ # {SimpleSpanProcessor} for an example.
69
+ def add_span_processor(span_processor)
70
+ @span_processors << span_processor
71
+ end
72
+
73
+ # @api private
74
+ # The configure method is where we define the setup process. This allows
75
+ # us to make certain guarantees about which systems and globals are setup
76
+ # at each stage. The setup process is:
77
+ # - setup logging
78
+ # - setup propagation
79
+ # - setup tracer_provider and meter_provider
80
+ # - install instrumentation
81
+ def configure
82
+ OpenTelemetry.logger = logger
83
+ OpenTelemetry.correlations = CorrelationContext::Manager.new
84
+ configure_propagation
85
+ configure_span_processors
86
+ OpenTelemetry.tracer_provider = @tracer_provider
87
+ install_instrumentation
88
+ end
89
+
90
+ private
91
+
92
+ def check_use_mode!(mode)
93
+ @use_mode = mode if @use_mode == USE_MODE_UNSPECIFIED
94
+ raise 'Use either `use_all` or `use`, but not both' unless @use_mode == mode
95
+ end
96
+
97
+ def install_instrumentation
98
+ case @use_mode
99
+ when USE_MODE_ONE
100
+ OpenTelemetry.instrumentation_registry.install(@adapter_names, @adapter_config_map)
101
+ when USE_MODE_ALL
102
+ OpenTelemetry.instrumentation_registry.install_all(@adapter_config_map)
103
+ end
104
+ end
105
+
106
+ def configure_span_processors
107
+ processors = @span_processors.empty? ? [default_span_processor] : @span_processors
108
+ processors.each { |p| @tracer_provider.add_span_processor(p) }
109
+ end
110
+
111
+ def default_span_processor
112
+ Trace::Export::SimpleSpanProcessor.new(
113
+ Trace::Export::ConsoleSpanExporter.new
114
+ )
115
+ end
116
+
117
+ def configure_propagation
118
+ OpenTelemetry.propagation.http = create_propagator(@http_injectors || default_http_injectors,
119
+ @http_extractors || default_http_extractors)
120
+ OpenTelemetry.propagation.text = create_propagator(@text_injectors || default_text_injectors,
121
+ @text_extractors || default_text_extractors)
122
+ end
123
+
124
+ def create_propagator(injectors, extractors)
125
+ if injectors.size > 1 || extractors.size > 1
126
+ Context::Propagation::CompositePropagator.new(injectors, extractors)
127
+ else
128
+ Context::Propagation::Propagator.new(injectors, extractors)
129
+ end
130
+ end
131
+
132
+ def default_http_injectors
133
+ default_text_injectors
134
+ end
135
+
136
+ def default_http_extractors
137
+ [
138
+ OpenTelemetry::Trace::Propagation::TraceContext.rack_extractor,
139
+ OpenTelemetry::CorrelationContext::Propagation.rack_extractor
140
+ ]
141
+ end
142
+
143
+ def default_text_injectors
144
+ [
145
+ OpenTelemetry::Trace::Propagation::TraceContext.text_injector,
146
+ OpenTelemetry::CorrelationContext::Propagation.text_injector
147
+ ]
148
+ end
149
+
150
+ def default_text_extractors
151
+ [
152
+ OpenTelemetry::Trace::Propagation::TraceContext.text_extractor,
153
+ OpenTelemetry::CorrelationContext::Propagation.text_extractor
154
+ ]
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ require 'opentelemetry/sdk/correlation_context/builder'
8
+ require 'opentelemetry/sdk/correlation_context/manager'
9
+
10
+ module OpenTelemetry
11
+ module SDK
12
+ # Contains operational implementataions of the CorrelationContext::Manager
13
+ module CorrelationContext
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,40 @@
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 SDK
9
+ module CorrelationContext
10
+ # SDK implementation of CorrelationContext::Builder
11
+ class Builder
12
+ attr_reader :entries
13
+
14
+ def initialize(entries)
15
+ @entries = entries
16
+ end
17
+
18
+ # Set key-value in the to-be-created correlation context
19
+ #
20
+ # @param [String] key The key to store this value under
21
+ # @param [String] value String value to be stored under key
22
+ def set_value(key, value)
23
+ @entries[key] = value.to_s
24
+ end
25
+
26
+ # Removes key from the to-be-created correlation context
27
+ #
28
+ # @param [String] key The key to remove
29
+ def remove_value(key)
30
+ @entries.delete(key)
31
+ end
32
+
33
+ # Clears all correlations from the to-be-created correlation context
34
+ def clear
35
+ @entries.clear
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,87 @@
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 SDK
9
+ module CorrelationContext
10
+ # Manages correlation context
11
+ class Manager
12
+ CORRELATION_CONTEXT_KEY = OpenTelemetry::CorrelationContext::Propagation::ContextKeys.correlation_context_key
13
+ EMPTY_CORRELATION_CONTEXT = {}.freeze
14
+ private_constant(:CORRELATION_CONTEXT_KEY, :EMPTY_CORRELATION_CONTEXT)
15
+
16
+ # Used to chain modifications to correlation context. The result is a
17
+ # context with an updated correlation context. If only a single
18
+ # modification is being made to correlation context, use the other
19
+ # methods on +Manager+, if multiple modifications are being made, use
20
+ # this one.
21
+ #
22
+ # @param [optional Context] context The context to update with with new
23
+ # modified correlation context. Defaults to +Context.current+
24
+ # @return [Context]
25
+ def build_context(context: Context.current)
26
+ builder = Builder.new(correlations_for(context).dup)
27
+ yield builder
28
+ context.set_value(CORRELATION_CONTEXT_KEY, builder.entries)
29
+ end
30
+
31
+ # Returns a new context with empty correlations
32
+ #
33
+ # @param [optional Context] context Context to clear correlations from. Defaults
34
+ # to +Context.current+
35
+ # @return [Context]
36
+ def clear(context: Context.current)
37
+ context.set_value(CORRELATION_CONTEXT_KEY, EMPTY_CORRELATION_CONTEXT)
38
+ end
39
+
40
+ # Returns the corresponding correlation value (or nil) for key
41
+ #
42
+ # @param [String] key The lookup key
43
+ # @param [optional Context] context The context from which to retrieve
44
+ # the key.
45
+ # Defaults to +Context.current+
46
+ # @return [String]
47
+ def value(key, context: Context.current)
48
+ correlations_for(context)[key]
49
+ end
50
+
51
+ # Returns a new context with new key-value pair
52
+ #
53
+ # @param [String] key The key to store this value under
54
+ # @param [String] value String value to be stored under key
55
+ # @param [optional Context] context The context to update with new
56
+ # value. Defaults to +Context.current+
57
+ # @return [Context]
58
+ def set_value(key, value, context: Context.current)
59
+ new_correlations = correlations_for(context).dup
60
+ new_correlations[key] = value
61
+ context.set_value(CORRELATION_CONTEXT_KEY, new_correlations)
62
+ end
63
+
64
+ # Returns a new context with value at key removed
65
+ #
66
+ # @param [String] key The key to remove
67
+ # @param [optional Context] context The context to remove correlation
68
+ # from. Defaults to +Context.current+
69
+ # @return [Context]
70
+ def remove_value(key, context: Context.current)
71
+ correlations = correlations_for(context)
72
+ return context unless correlations.key?(key)
73
+
74
+ new_correlations = correlations.dup
75
+ new_correlations.delete(key)
76
+ context.set_value(CORRELATION_CONTEXT_KEY, new_correlations)
77
+ end
78
+
79
+ private
80
+
81
+ def correlations_for(context)
82
+ context.value(CORRELATION_CONTEXT_KEY) || EMPTY_CORRELATION_CONTEXT
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -20,10 +20,30 @@ module OpenTelemetry
20
20
  key.instance_of?(String)
21
21
  end
22
22
 
23
- def valid_value?(value)
23
+ def valid_simple_value?(value)
24
24
  value.instance_of?(String) || value == false || value == true || value.is_a?(Numeric)
25
25
  end
26
26
 
27
+ def valid_array_value?(value)
28
+ return false unless value.is_a?(Array)
29
+ return true if value.empty?
30
+
31
+ case value.first
32
+ when String
33
+ value.all? { |v| v.instance_of?(String) }
34
+ when TrueClass, FalseClass
35
+ value.all? { |v| boolean?(v) }
36
+ when Numeric
37
+ value.all? { |v| v.is_a?(Numeric) }
38
+ else
39
+ false
40
+ end
41
+ end
42
+
43
+ def valid_value?(value)
44
+ valid_simple_value?(value) || valid_array_value?(value)
45
+ end
46
+
27
47
  def valid_attributes?(attrs)
28
48
  attrs.nil? || attrs.all? { |k, v| valid_key?(k) && valid_value?(v) }
29
49
  end
@@ -15,15 +15,16 @@ module OpenTelemetry
15
15
 
16
16
  # Returns a newly created {Resource} with the specified labels
17
17
  #
18
- # @param [Hash<String, String>] labels Hash of key-value pairs to be used
18
+ # @param [Hash{String => String, Numeric, Boolean} labels Hash of key-value pairs to be used
19
19
  # as labels for this resource
20
20
  # @raise [ArgumentError] If label keys and values are not strings
21
21
  # @return [Resource]
22
22
  def create(labels = {})
23
23
  frozen_labels = labels.each_with_object({}) do |(k, v), memo|
24
- raise ArgumentError, 'label keys and values must be strings' unless k.is_a?(String) && v.is_a?(String)
24
+ raise ArgumentError, 'label keys must be strings' unless k.is_a?(String)
25
+ raise ArgumentError, 'label values must be strings, integers, floats, or booleans' unless Internal.valid_value?(v)
25
26
 
26
- memo[-k] = -v
27
+ memo[-k] = v.freeze
27
28
  end.freeze
28
29
 
29
30
  new(frozen_labels)
@@ -21,4 +21,4 @@ require 'opentelemetry/sdk/trace/noop_span_processor'
21
21
  require 'opentelemetry/sdk/trace/span_data'
22
22
  require 'opentelemetry/sdk/trace/span'
23
23
  require 'opentelemetry/sdk/trace/tracer'
24
- require 'opentelemetry/sdk/trace/tracer_factory'
24
+ require 'opentelemetry/sdk/trace/tracer_provider'
@@ -72,6 +72,23 @@ module OpenTelemetry
72
72
  end
73
73
  end
74
74
 
75
+ # TODO: test this explicitly.
76
+ # Export all ended spans to the configured `Exporter` that have not yet
77
+ # been exported.
78
+ #
79
+ # This method should only be called in cases where it is absolutely
80
+ # necessary, such as when using some FaaS providers that may suspend
81
+ # the process after an invocation, but before the `Processor` exports
82
+ # the completed spans.
83
+ def force_flush
84
+ snapshot = lock { spans.shift(spans.size) }
85
+ until snapshot.empty?
86
+ batch = snapshot.shift(@batch_size).map!(&:to_span_data)
87
+ result_code = @exporter.export(batch)
88
+ report_result(result_code, batch)
89
+ end
90
+ end
91
+
75
92
  # shuts the consumer thread down and flushes the current accumulated buffer
76
93
  # will block until the thread is finished
77
94
  def shutdown
@@ -81,7 +98,7 @@ module OpenTelemetry
81
98
  end
82
99
 
83
100
  @thread.join
84
- flush
101
+ force_flush
85
102
  @exporter.shutdown
86
103
  end
87
104
 
@@ -124,15 +141,6 @@ module OpenTelemetry
124
141
  OpenTelemetry.logger.error("Unable to export #{batch.size} spans") unless result_code == SUCCESS
125
142
  end
126
143
 
127
- def flush
128
- snapshot = lock { spans.shift(spans.size) }
129
- until snapshot.empty?
130
- batch = snapshot.shift(@batch_size).map!(&:to_span_data)
131
- result_code = @exporter.export(batch)
132
- report_result(result_code, batch)
133
- end
134
- end
135
-
136
144
  def fetch_batch
137
145
  spans.shift(@batch_size).map!(&:to_span_data)
138
146
  end
@@ -14,13 +14,13 @@ module OpenTelemetry
14
14
  #
15
15
  # class MyClassTest
16
16
  # def setup
17
- # @tracer_factory = TracerFactory.new
17
+ # @tracer_provider = TracerProvider.new
18
18
  # @exporter = InMemorySpanExporter.new
19
- # @tracer_factory.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
19
+ # @tracer_provider.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
20
20
  # end
21
21
  #
22
22
  # def test_finished_spans
23
- # @tracer_factory.tracer.in_span("span") {}
23
+ # @tracer_provider.tracer.in_span("span") {}
24
24
  #
25
25
  # spans = @exporter.finished_spans
26
26
  # spans.wont_be_nil
@@ -71,8 +71,8 @@ module OpenTelemetry
71
71
  SUCCESS
72
72
  end
73
73
 
74
- # Called when {TracerFactory#shutdown} is called, if this exporter is
75
- # registered to a {TracerFactory} object.
74
+ # Called when {TracerProvider#shutdown} is called, if this exporter is
75
+ # registered to a {TracerProvider} object.
76
76
  def shutdown
77
77
  @mutex.synchronize do
78
78
  @finished_spans.clear
@@ -35,8 +35,8 @@ module OpenTelemetry
35
35
  end
36
36
  end
37
37
 
38
- # Called when {TracerFactory#shutdown} is called, if this exporter is
39
- # registered to a {TracerFactory} object.
38
+ # Called when {TracerProvider#shutdown} is called, if this exporter is
39
+ # registered to a {TracerProvider} object.
40
40
  def shutdown
41
41
  @span_exporters.each(&:shutdown)
42
42
  end
@@ -12,7 +12,7 @@ module OpenTelemetry
12
12
  # duck type. SpanExporter allows different tracing services to export
13
13
  # recorded data for sampled spans in their own format.
14
14
  #
15
- # To export data an exporter MUST be registered to the {TracerFactory} using
15
+ # To export data an exporter MUST be registered to the {TracerProvider} using
16
16
  # a {SimpleSpanProcessor} or a {BatchSpanProcessor}.
17
17
  class NoopSpanExporter
18
18
  def initialize
@@ -30,8 +30,8 @@ module OpenTelemetry
30
30
  FAILED_NOT_RETRYABLE
31
31
  end
32
32
 
33
- # Called when {TracerFactory#shutdown} is called, if this exporter is
34
- # registered to a {TracerFactory} object.
33
+ # Called when {TracerProvider#shutdown} is called, if this exporter is
34
+ # registered to a {TracerProvider} object.
35
35
  def shutdown
36
36
  @stopped = true
37
37
  end
@@ -52,7 +52,16 @@ module OpenTelemetry
52
52
  OpenTelemetry.logger.error("unexpected error in span.on_finish - #{e}")
53
53
  end
54
54
 
55
- # Called when {TracerFactory#shutdown} is called.
55
+ # Export all ended spans to the configured `Exporter` that have not yet
56
+ # been exported.
57
+ #
58
+ # This method should only be called in cases where it is absolutely
59
+ # necessary, such as when using some FaaS providers that may suspend
60
+ # the process after an invocation, but before the `Processor` exports
61
+ # the completed spans.
62
+ def force_flush; end
63
+
64
+ # Called when {TracerProvider#shutdown} is called.
56
65
  def shutdown
57
66
  @span_exporter&.shutdown
58
67
  end
@@ -41,7 +41,18 @@ module OpenTelemetry
41
41
  @span_processors.each { |processor| processor.on_finish(span) }
42
42
  end
43
43
 
44
- # Called when {TracerFactory#shutdown} is called.
44
+ # Export all ended spans to the configured `Exporter` that have not yet
45
+ # been exported.
46
+ #
47
+ # This method should only be called in cases where it is absolutely
48
+ # necessary, such as when using some FaaS providers that may suspend
49
+ # the process after an invocation, but before the `Processor` exports
50
+ # the completed spans.
51
+ def force_flush
52
+ @span_processors.each(&:force_flush)
53
+ end
54
+
55
+ # Called when {TracerProvider#shutdown} is called.
45
56
  def shutdown
46
57
  @span_processors.each(&:shutdown)
47
58
  end
@@ -33,7 +33,16 @@ module OpenTelemetry
33
33
  # @param [Span] span the {Span} that just ended.
34
34
  def on_finish(span); end
35
35
 
36
- # Called when {TracerFactory#shutdown} is called.
36
+ # Export all ended spans to the configured `Exporter` that have not yet
37
+ # been exported.
38
+ #
39
+ # This method should only be called in cases where it is absolutely
40
+ # necessary, such as when using some FaaS providers that may suspend
41
+ # the process after an invocation, but before the `Processor` exports
42
+ # the completed spans.
43
+ def force_flush; end
44
+
45
+ # Called when {TracerProvider#shutdown} is called.
37
46
  def shutdown; end
38
47
  end
39
48
  end
@@ -18,7 +18,7 @@ module OpenTelemetry
18
18
  # Custom samplers can be provided by SDK users. The required interface is
19
19
  # a callable with the signature:
20
20
  #
21
- # (trace_id:, span_id:, parent_context:, hint:, links:, name:, kind:, attributes:) -> Result
21
+ # (trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:) -> Result
22
22
  #
23
23
  # Where:
24
24
  #
@@ -27,8 +27,6 @@ module OpenTelemetry
27
27
  # @param [OpenTelemetry::Trace::SpanContext] parent_context The
28
28
  # {OpenTelemetry::Trace::SpanContext} of a parent span, typically
29
29
  # extracted from the wire. Can be nil for a root span.
30
- # @param [Symbol] hint A {OpenTelemetry::Trace::SamplingHint} about
31
- # whether the {Span} should be sampled and/or record events.
32
30
  # @param [Enumerable<Link>] links A collection of links to be associated
33
31
  # with the {Span} to be created. Can be nil.
34
32
  # @param [String] name Name of the {Span} to be created.
@@ -48,19 +46,17 @@ module OpenTelemetry
48
46
 
49
47
  # rubocop:disable Lint/UnusedBlockArgument
50
48
 
51
- # Ignores all values in hint and returns a {Result} with
52
- # {Decision::RECORD_AND_SAMPLED}.
53
- ALWAYS_ON = ->(trace_id:, span_id:, parent_context:, hint:, links:, name:, kind:, attributes:) { RECORD_AND_SAMPLED }
49
+ # Returns a {Result} with {Decision::RECORD_AND_SAMPLED}.
50
+ ALWAYS_ON = ->(trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:) { RECORD_AND_SAMPLED }
54
51
 
55
- # Ignores all values in hint and returns a {Result} with
56
- # {Decision::NOT_RECORD}.
57
- ALWAYS_OFF = ->(trace_id:, span_id:, parent_context:, hint:, links:, name:, kind:, attributes:) { NOT_RECORD }
52
+ # Returns a {Result} with {Decision::NOT_RECORD}.
53
+ ALWAYS_OFF = ->(trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:) { NOT_RECORD }
58
54
 
59
- # Ignores all values in hint and returns a {Result} with
60
- # {Decision::RECORD_AND_SAMPLED} if the parent context is sampled or
61
- # {Decision::NOT_RECORD} otherwise, or if there is no parent context.
55
+ # Returns a {Result} with {Decision::RECORD_AND_SAMPLED} if the parent
56
+ # context is sampled or {Decision::NOT_RECORD} otherwise, or if there
57
+ # is no parent context.
62
58
  # rubocop:disable Style/Lambda
63
- ALWAYS_PARENT = ->(trace_id:, span_id:, parent_context:, hint:, links:, name:, kind:, attributes:) do
59
+ ALWAYS_PARENT = ->(trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:) do
64
60
  if parent_context&.trace_flags&.sampled?
65
61
  RECORD_AND_SAMPLED
66
62
  else
@@ -75,8 +71,6 @@ module OpenTelemetry
75
71
  #
76
72
  # @param [Numeric] probability The desired probability of sampling.
77
73
  # Must be within [0.0, 1.0].
78
- # @param [optional Enumerable<Symbol>] ignore_hints Sampling hints to
79
- # ignore. Defaults to ignore {OpenTelemetry::Trace::SamplingHint::RECORD}.
80
74
  # @param [optional Boolean] ignore_parent Whether to ignore parent
81
75
  # sampling. Defaults to not ignore parent sampling.
82
76
  # @param [optional Symbol] apply_probability_to Whether to apply
@@ -84,18 +78,14 @@ module OpenTelemetry
84
78
  # or all spans. Allowed values include :root_spans, :root_spans_and_remote_parent,
85
79
  # and :all_spans. Defaults to :root_spans_and_remote_parent.
86
80
  # @raise [ArgumentError] if probability is out of range
87
- # @raise [ArgumentError] if ignore_hints contains invalid hints
88
81
  # @raise [ArgumentError] if apply_probability_to is not one of the allowed symbols
89
82
  def self.probability(probability,
90
- ignore_hints: [OpenTelemetry::Trace::SamplingHint::RECORD],
91
83
  ignore_parent: false,
92
84
  apply_probability_to: :root_spans_and_remote_parent)
93
85
  raise ArgumentError, 'probability must be in range [0.0, 1.0]' unless (0.0..1.0).include?(probability)
94
- raise ArgumentError, 'ignore_hints' unless (ignore_hints.to_a - SAMPLING_HINTS).empty?
95
86
  raise ArgumentError, 'apply_probability_to' unless APPLY_PROBABILITY_TO_SYMBOLS.include?(apply_probability_to)
96
87
 
97
88
  ProbabilitySampler.new(probability,
98
- ignore_hints: ignore_hints.to_a,
99
89
  ignore_parent: ignore_parent,
100
90
  apply_to_remote_parent: apply_probability_to != :root_spans,
101
91
  apply_to_all_spans: apply_probability_to == :all_spans)
@@ -12,13 +12,13 @@ module OpenTelemetry
12
12
  # decision part of a sampling {Result}.
13
13
  module Decision
14
14
  # Decision to not record events and not sample.
15
- NOT_RECORD = OpenTelemetry::Trace::SamplingHint::NOT_RECORD
15
+ NOT_RECORD = :__not_record__
16
16
 
17
17
  # Decision to record events and not sample.
18
- RECORD = OpenTelemetry::Trace::SamplingHint::RECORD
18
+ RECORD = :__record__
19
19
 
20
20
  # Decision to record events and sample.
21
- RECORD_AND_SAMPLED = OpenTelemetry::Trace::SamplingHint::RECORD_AND_SAMPLED
21
+ RECORD_AND_SAMPLED = :__record_and_sampled__
22
22
  end
23
23
  end
24
24
  end
@@ -12,15 +12,9 @@ module OpenTelemetry
12
12
  #
13
13
  # Implements sampling based on a probability.
14
14
  class ProbabilitySampler
15
- HINT_RECORD_AND_SAMPLED = OpenTelemetry::Trace::SamplingHint::RECORD_AND_SAMPLED
16
- HINT_RECORD = OpenTelemetry::Trace::SamplingHint::RECORD
17
-
18
- private_constant(:HINT_RECORD_AND_SAMPLED, :HINT_RECORD)
19
-
20
- def initialize(probability, ignore_hints:, ignore_parent:, apply_to_remote_parent:, apply_to_all_spans:)
15
+ def initialize(probability, ignore_parent:, apply_to_remote_parent:, apply_to_all_spans:)
21
16
  @probability = probability
22
17
  @id_upper_bound = format('%016x', (probability * (2**64 - 1)).ceil)
23
- @ignored_hints = ignore_hints
24
18
  @use_parent_sampled_flag = !ignore_parent
25
19
  @apply_to_remote_parent = apply_to_remote_parent
26
20
  @apply_to_all_spans = apply_to_all_spans
@@ -29,18 +23,11 @@ module OpenTelemetry
29
23
  # @api private
30
24
  #
31
25
  # Callable interface for probability sampler. See {Samplers}.
32
- def call(trace_id:, span_id:, parent_context:, hint:, links:, name:, kind:, attributes:)
26
+ def call(trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:)
33
27
  # Ignored for sampling decision: links, name, kind, attributes.
34
28
 
35
- hint = nil if @ignored_hints.include?(hint)
36
-
37
- sampled = sample?(hint, trace_id, parent_context)
38
- recording = hint == HINT_RECORD || sampled
39
-
40
- if sampled && recording
29
+ if sample?(trace_id, parent_context)
41
30
  RECORD_AND_SAMPLED
42
- elsif recording
43
- RECORD
44
31
  else
45
32
  NOT_RECORD
46
33
  end
@@ -48,11 +35,11 @@ module OpenTelemetry
48
35
 
49
36
  private
50
37
 
51
- def sample?(hint, trace_id, parent_context)
38
+ def sample?(trace_id, parent_context)
52
39
  if parent_context.nil?
53
- hint == HINT_RECORD_AND_SAMPLED || sample_trace_id?(trace_id)
40
+ sample_trace_id?(trace_id)
54
41
  else
55
- parent_sampled?(parent_context) || hint == HINT_RECORD_AND_SAMPLED || sample_trace_id_for_child?(parent_context, trace_id)
42
+ parent_sampled?(parent_context) || sample_trace_id_for_child?(parent_context, trace_id)
56
43
  end
57
44
  end
58
45
 
@@ -19,7 +19,7 @@ module OpenTelemetry
19
19
 
20
20
  # Returns a frozen hash of attributes to be attached span.
21
21
  #
22
- # @return [Hash<String, Object>]
22
+ # @return [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]
23
23
  attr_reader :attributes
24
24
 
25
25
  # Returns a new sampling result with the specified decision and
@@ -27,8 +27,9 @@ module OpenTelemetry
27
27
  #
28
28
  # @param [Symbol] decision Whether or not a span should be sampled
29
29
  # and/or record events.
30
- # @param [optional Hash<String, Object>] attributes A frozen or freezable hash
31
- # containing attributes to be attached to the span.
30
+ # @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]
31
+ # attributes A frozen or freezable hash containing attributes to be
32
+ # attached to the span.
32
33
  def initialize(decision:, attributes: nil)
33
34
  @decision = decision
34
35
  @attributes = attributes.freeze || EMPTY_HASH
@@ -24,7 +24,7 @@ module OpenTelemetry
24
24
  # use of SpanProcesses and should not be considered part of the public
25
25
  # interface for instrumentation.
26
26
  #
27
- # @return [Hash<String, Object>] may be nil.
27
+ # @return [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] may be nil.
28
28
  def attributes
29
29
  # Don't bother synchronizing. Access by SpanProcessors is expected to
30
30
  # be serialized.
@@ -90,16 +90,16 @@ module OpenTelemetry
90
90
  # span.add_event { OpenTelemetry::Trace::Event.new(name: 'event', attributes: {'eager' => false}) }
91
91
  #
92
92
  # Note that the OpenTelemetry project
93
- # {https://github.com/open-telemetry/opentelemetry-specification/blob/master/semantic-conventions.md
93
+ # {https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-semantic-conventions.md
94
94
  # documents} certain "standard event names and keys" which have
95
95
  # prescribed semantic meanings.
96
96
  #
97
97
  # @param [optional String] name Optional name of the event. This is
98
98
  # required if a block is not given.
99
- # @param [optional Hash<String, Object>] attributes One or more key:value
100
- # pairs, where the keys must be strings and the values may be string,
101
- # boolean or numeric type. This argument should only be used when
102
- # passing in a name.
99
+ # @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
100
+ # One or more key:value pairs, where the keys must be strings and the
101
+ # values may be string, boolean or numeric type. This argument should
102
+ # only be used when passing in a name.
103
103
  # @param [optional Time] timestamp Optional timestamp for the event.
104
104
  # This argument should only be used when passing in a name.
105
105
  #
@@ -107,6 +107,7 @@ module OpenTelemetry
107
107
  def add_event(name: nil, attributes: nil, timestamp: nil)
108
108
  super
109
109
  event = block_given? ? yield : OpenTelemetry::Trace::Event.new(name: name, attributes: attributes, timestamp: timestamp || Time.now)
110
+
110
111
  @mutex.synchronize do
111
112
  if @ended
112
113
  OpenTelemetry.logger.warn('Calling add_event on an ended Span.')
@@ -119,6 +120,21 @@ module OpenTelemetry
119
120
  self
120
121
  end
121
122
 
123
+ # Record an error during the execution of this span. Multiple errors
124
+ # can be recorded on a span.
125
+ #
126
+ # @param [Exception] error The error to be recorded
127
+ #
128
+ # @return [void]
129
+ def record_error(error)
130
+ add_event(name: 'error',
131
+ attributes: {
132
+ 'error.type' => error.class.to_s,
133
+ 'error.message' => error.message,
134
+ 'error.stack' => error.backtrace.join("\n")
135
+ })
136
+ end
137
+
122
138
  # Sets the Status to the Span
123
139
  #
124
140
  # If used, this will override the default Span status. Default is OK.
@@ -26,23 +26,22 @@ module OpenTelemetry
26
26
  @resource = Resources::Resource.create('name' => name, 'version' => version)
27
27
  end
28
28
 
29
- def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, sampling_hint: nil)
30
- parent_span_context = OpenTelemetry::Trace::SpanContext::INVALID
31
- start_span(name, with_parent_context: parent_span_context, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, sampling_hint: sampling_hint)
29
+ def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
30
+ start_span(name, with_parent_context: Context.empty, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind)
32
31
  end
33
32
 
34
- def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil, sampling_hint: nil) # rubocop:disable Metrics/AbcSize
33
+ def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
35
34
  name ||= 'empty'
36
35
 
37
- parent_span_context = with_parent&.context || with_parent_context || current_span.context
36
+ parent_span_context = with_parent&.context || active_span_context(with_parent_context)
38
37
  parent_span_context = nil unless parent_span_context.valid?
39
38
  parent_span_id = parent_span_context&.span_id
40
39
  tracestate = parent_span_context&.tracestate
41
40
  trace_id = parent_span_context&.trace_id
42
41
  trace_id ||= OpenTelemetry::Trace.generate_trace_id
43
42
  span_id = OpenTelemetry::Trace.generate_span_id
44
- sampler = OpenTelemetry.tracer_factory.active_trace_config.sampler
45
- result = sampler.call(trace_id: trace_id, span_id: span_id, parent_context: parent_span_context, hint: sampling_hint, links: links, name: name, kind: kind, attributes: attributes)
43
+ sampler = OpenTelemetry.tracer_provider.active_trace_config.sampler
44
+ result = sampler.call(trace_id: trace_id, span_id: span_id, parent_context: parent_span_context, links: links, name: name, kind: kind, attributes: attributes)
46
45
 
47
46
  internal_create_span(result, name, kind, trace_id, span_id, parent_span_id, attributes, links, start_timestamp, tracestate)
48
47
  end
@@ -50,12 +49,12 @@ module OpenTelemetry
50
49
  private
51
50
 
52
51
  def internal_create_span(result, name, kind, trace_id, span_id, parent_span_id, attributes, links, start_timestamp, tracestate) # rubocop:disable Metrics/AbcSize
53
- if result.recording? && !OpenTelemetry.tracer_factory.stopped?
52
+ if result.recording? && !OpenTelemetry.tracer_provider.stopped?
54
53
  trace_flags = result.sampled? ? OpenTelemetry::Trace::TraceFlags::SAMPLED : OpenTelemetry::Trace::TraceFlags::DEFAULT
55
54
  context = OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id, trace_flags: trace_flags, tracestate: tracestate)
56
55
  attributes = attributes&.merge(result.attributes) || result.attributes
57
- active_trace_config = OpenTelemetry.tracer_factory.active_trace_config
58
- active_span_processor = OpenTelemetry.tracer_factory.active_span_processor
56
+ active_trace_config = OpenTelemetry.tracer_provider.active_trace_config
57
+ active_span_processor = OpenTelemetry.tracer_provider.active_span_processor
59
58
  Span.new(context, name, kind, parent_span_id, active_trace_config, active_span_processor, attributes, links, start_timestamp || Time.now, @resource)
60
59
  else
61
60
  OpenTelemetry::Trace::Span.new(span_context: OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id))
@@ -7,8 +7,8 @@
7
7
  module OpenTelemetry
8
8
  module SDK
9
9
  module Trace
10
- # {TracerFactory} is the SDK implementation of {OpenTelemetry::Trace::TracerFactory}.
11
- class TracerFactory < OpenTelemetry::Trace::TracerFactory
10
+ # {TracerProvider} is the SDK implementation of {OpenTelemetry::Trace::TracerProvider}.
11
+ class TracerProvider < OpenTelemetry::Trace::TracerProvider
12
12
  Key = Struct.new(:name, :version)
13
13
  private_constant(:Key)
14
14
 
@@ -17,9 +17,9 @@ module OpenTelemetry
17
17
  attr_reader :stopped
18
18
  alias stopped? stopped
19
19
 
20
- # Returns a new {TracerFactory} instance.
20
+ # Returns a new {TracerProvider} instance.
21
21
  #
22
- # @return [TracerFactory]
22
+ # @return [TracerProvider]
23
23
  def initialize
24
24
  @mutex = Mutex.new
25
25
  @registry = {}
@@ -75,7 +75,7 @@ module OpenTelemetry
75
75
  return
76
76
  end
77
77
  @registered_span_processors << span_processor
78
- @active_span_processor = MultiSpanProcessor.new(@registered_span_processors)
78
+ @active_span_processor = MultiSpanProcessor.new(@registered_span_processors.dup)
79
79
  end
80
80
  end
81
81
  end
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module SDK
9
9
  ## Current OpenTelemetry version
10
- VERSION = '0.2.0'
10
+ VERSION = '0.3.0'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.0'
19
+ version: 0.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.0'
26
+ version: 0.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -143,9 +143,16 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
+ - ".yardopts"
146
147
  - CHANGELOG.md
147
148
  - LICENSE
149
+ - README.md
150
+ - lib/opentelemetry-sdk.rb
148
151
  - lib/opentelemetry/sdk.rb
152
+ - lib/opentelemetry/sdk/configurator.rb
153
+ - lib/opentelemetry/sdk/correlation_context.rb
154
+ - lib/opentelemetry/sdk/correlation_context/builder.rb
155
+ - lib/opentelemetry/sdk/correlation_context/manager.rb
149
156
  - lib/opentelemetry/sdk/internal.rb
150
157
  - lib/opentelemetry/sdk/resources.rb
151
158
  - lib/opentelemetry/sdk/resources/resource.rb
@@ -168,7 +175,7 @@ files:
168
175
  - lib/opentelemetry/sdk/trace/span.rb
169
176
  - lib/opentelemetry/sdk/trace/span_data.rb
170
177
  - lib/opentelemetry/sdk/trace/tracer.rb
171
- - lib/opentelemetry/sdk/trace/tracer_factory.rb
178
+ - lib/opentelemetry/sdk/trace/tracer_provider.rb
172
179
  - lib/opentelemetry/sdk/version.rb
173
180
  homepage: https://github.com/open-telemetry/opentelemetry-ruby
174
181
  licenses: