opentelemetry-sdk 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/opentelemetry/sdk/configurator.rb +5 -1
- data/lib/opentelemetry/sdk/forwarding_logger.rb +1 -1
- data/lib/opentelemetry/sdk/instrumentation_library.rb +1 -0
- data/lib/opentelemetry/sdk/instrumentation_scope.rb +13 -0
- data/lib/opentelemetry/sdk/resources/resource.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb +6 -6
- data/lib/opentelemetry/sdk/trace/export/console_span_exporter.rb +0 -2
- data/lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb +17 -17
- data/lib/opentelemetry/sdk/trace/export/metrics_reporter.rb +1 -0
- data/lib/opentelemetry/sdk/trace/samplers/result.rb +1 -1
- data/lib/opentelemetry/sdk/trace/span.rb +15 -11
- data/lib/opentelemetry/sdk/trace/span_data.rb +7 -1
- data/lib/opentelemetry/sdk/trace/span_limits.rb +13 -7
- data/lib/opentelemetry/sdk/trace/tracer.rb +6 -10
- data/lib/opentelemetry/sdk/trace/tracer_provider.rb +6 -5
- data/lib/opentelemetry/sdk/version.rb +1 -1
- data/lib/opentelemetry/sdk.rb +1 -0
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b3929809dfb23b087387864352e6fdb690fc24b99cfd3e236f710b8b5b01eb4
|
4
|
+
data.tar.gz: 11630ddd0ead48711a68b534de8e75d05395d9d9d2f43177d6c2465b17ff7f2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7756b25f8fd77c81dfd3d824fee54dd4a74c1afb1ca6c47a345ad02b2fd58de0654a7a21680a3ade0d70b3e77ca1006c4b3d36a361e6e5e59507b037d9041274
|
7
|
+
data.tar.gz: cac44fe7f43d2ef5309de35eb3af9a4420bbe6f9ee49ca1ab2ba59d2a539699ed6712277b265ca5225290c648ea07a9a82cd44aa4ec537af0b951ea01764d5f5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History: opentelemetry-sdk
|
2
2
|
|
3
|
+
### v1.2.1 / 2023-05-30
|
4
|
+
|
5
|
+
* FIXED: Untraced only works with parent-based sampler
|
6
|
+
* DOCS: Improve formatting of usage examples in OpenTelemetry SDK rubydocs
|
7
|
+
|
8
|
+
### v1.2.0 / 2022-09-14
|
9
|
+
|
10
|
+
* ADDED: Support OTEL_PROPAGATORS=none
|
11
|
+
* ADDED: Support OTEL_ATTRIBUTE_{COUNT,VALUE_LENGTH}_LIMIT env vars
|
12
|
+
* ADDED: Support InstrumentationScope, and update OTLP proto to 0.18.0
|
13
|
+
* FIXED: SpanLimits setting event attributes length limit
|
14
|
+
|
3
15
|
### v1.1.0 / 2022-05-26
|
4
16
|
|
5
17
|
* BREAKING CHANGE: This requires upgrading both the SDK and Instrumentation gem in tandem
|
@@ -141,11 +141,14 @@ module OpenTelemetry
|
|
141
141
|
configure_span_processors
|
142
142
|
tracer_provider.id_generator = @id_generator
|
143
143
|
OpenTelemetry.tracer_provider = tracer_provider
|
144
|
+
metrics_configuration_hook
|
144
145
|
install_instrumentation
|
145
146
|
end
|
146
147
|
|
147
148
|
private
|
148
149
|
|
150
|
+
def metrics_configuration_hook; end
|
151
|
+
|
149
152
|
def tracer_provider
|
150
153
|
@tracer_provider ||= Trace::TracerProvider.new(resource: @resource)
|
151
154
|
end
|
@@ -169,7 +172,7 @@ module OpenTelemetry
|
|
169
172
|
processors.each { |p| tracer_provider.add_span_processor(p) }
|
170
173
|
end
|
171
174
|
|
172
|
-
def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity
|
175
|
+
def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity
|
173
176
|
exporters = ENV.fetch('OTEL_TRACES_EXPORTER', 'otlp')
|
174
177
|
exporters.split(',').map do |exporter|
|
175
178
|
case exporter.strip
|
@@ -203,6 +206,7 @@ module OpenTelemetry
|
|
203
206
|
when 'jaeger' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::Jaeger')
|
204
207
|
when 'xray' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::XRay')
|
205
208
|
when 'ottrace' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::OTTrace')
|
209
|
+
when 'none' then NoopTextMapPropagator.new
|
206
210
|
else
|
207
211
|
OpenTelemetry.logger.warn "The #{propagator} propagator is unknown and cannot be configured"
|
208
212
|
NoopTextMapPropagator.new
|
@@ -10,7 +10,7 @@ module OpenTelemetry
|
|
10
10
|
# with an ERROR log level, only OpenTelemetry logs at the ERROR level or higher
|
11
11
|
# will be emitted.
|
12
12
|
class ForwardingLogger
|
13
|
-
def initialize(logger, level:)
|
13
|
+
def initialize(logger, level:)
|
14
14
|
@logger = logger
|
15
15
|
|
16
16
|
if level.is_a?(Integer)
|
@@ -0,0 +1,13 @@
|
|
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 SDK
|
9
|
+
# InstrumentationScope is a struct containing scope information for export.
|
10
|
+
InstrumentationScope = Struct.new(:name,
|
11
|
+
:version)
|
12
|
+
end
|
13
|
+
end
|
@@ -11,7 +11,7 @@ module OpenTelemetry
|
|
11
11
|
# for which telemetry (metrics or traces) is reported.
|
12
12
|
class Resource
|
13
13
|
class << self
|
14
|
-
private :new
|
14
|
+
private :new
|
15
15
|
|
16
16
|
# Returns a newly created {Resource} with the specified attributes
|
17
17
|
#
|
@@ -30,10 +30,10 @@ module OpenTelemetry
|
|
30
30
|
#
|
31
31
|
# @param [SpanExporter] exporter the (duck type) SpanExporter to where the
|
32
32
|
# recorded Spans are pushed after batching.
|
33
|
-
# @param [Numeric] exporter_timeout the
|
34
|
-
#
|
33
|
+
# @param [Numeric] exporter_timeout the maximum allowed time to export data.
|
34
|
+
# Defaults to the value of the OTEL_BSP_EXPORT_TIMEOUT
|
35
35
|
# environment variable, if set, or 30,000 (30 seconds).
|
36
|
-
# @param [Numeric] schedule_delay the
|
36
|
+
# @param [Numeric] schedule_delay the delay interval between two consecutive exports.
|
37
37
|
# Defaults to the value of the OTEL_BSP_SCHEDULE_DELAY environment
|
38
38
|
# variable, if set, or 5,000 (5 seconds).
|
39
39
|
# @param [Integer] max_queue_size the maximum queue size in spans.
|
@@ -74,7 +74,7 @@ module OpenTelemetry
|
|
74
74
|
def on_start(_span, _parent_context); end
|
75
75
|
|
76
76
|
# Adds a span to the batch. Thread-safe; may block on lock.
|
77
|
-
def on_finish(span)
|
77
|
+
def on_finish(span)
|
78
78
|
return unless span.context.trace_flags.sampled?
|
79
79
|
|
80
80
|
lock do
|
@@ -100,7 +100,7 @@ module OpenTelemetry
|
|
100
100
|
# @param [optional Numeric] timeout An optional timeout in seconds.
|
101
101
|
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
|
102
102
|
# non-specific failure occurred, TIMEOUT if a timeout occurred.
|
103
|
-
def force_flush(timeout: nil) # rubocop:disable Metrics/
|
103
|
+
def force_flush(timeout: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
104
104
|
start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
|
105
105
|
snapshot = lock do
|
106
106
|
reset_on_fork if @keep_running
|
@@ -155,7 +155,7 @@ module OpenTelemetry
|
|
155
155
|
|
156
156
|
attr_reader :spans, :max_queue_size, :batch_size
|
157
157
|
|
158
|
-
def work
|
158
|
+
def work
|
159
159
|
loop do
|
160
160
|
batch = lock do
|
161
161
|
@condition.wait(@mutex, @delay_seconds) if spans.size < batch_size && @keep_running
|
@@ -10,26 +10,26 @@ module OpenTelemetry
|
|
10
10
|
module Export
|
11
11
|
# A SpanExporter implementation that can be used to test OpenTelemetry integration.
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# @example Usage in a test suite:
|
14
|
+
# class MyClassTest
|
15
|
+
# def setup
|
16
|
+
# @tracer_provider = TracerProvider.new
|
17
|
+
# # The default is `recording: true`, which is appropriate in non-test environments.
|
18
|
+
# @exporter = InMemorySpanExporter.new(recording: false)
|
19
|
+
# @tracer_provider.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
|
20
|
+
# end
|
14
21
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# # The default is `recording: true`, which is appropriate in non-test environments.
|
19
|
-
# @exporter = InMemorySpanExporter.new(recording: false)
|
20
|
-
# @tracer_provider.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# def test_finished_spans
|
24
|
-
# @exporter.recording = true
|
25
|
-
# @tracer_provider.tracer.in_span("span") {}
|
22
|
+
# def test_finished_spans
|
23
|
+
# @exporter.recording = true
|
24
|
+
# @tracer_provider.tracer.in_span("span") {}
|
26
25
|
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
26
|
+
# spans = @exporter.finished_spans
|
27
|
+
# spans.wont_be_nil
|
28
|
+
# spans.size.must_equal(1)
|
29
|
+
# spans[0].name.must_equal("span")
|
31
30
|
#
|
32
|
-
#
|
31
|
+
# @exporter.recording = false
|
32
|
+
# end
|
33
33
|
# end
|
34
34
|
class InMemorySpanExporter
|
35
35
|
# Controls whether or not the exporter will record spans, or discard them.
|
@@ -15,6 +15,7 @@ module OpenTelemetry
|
|
15
15
|
# the unstable OpenTelemetry Metrics API. An example implementation in
|
16
16
|
# terms of StatsD is:
|
17
17
|
#
|
18
|
+
# @example
|
18
19
|
# module MetricsReporter
|
19
20
|
# def add_to_counter(metric, increment: 1, labels: {})
|
20
21
|
# StatsD.increment(metric, increment, labels, no_prefix: true)
|
@@ -40,7 +40,7 @@ module OpenTelemetry
|
|
40
40
|
# an empty Tracestate here, the Tracestate will be cleared, so
|
41
41
|
# samplers SHOULD normally return the passed-in Tracestate if they
|
42
42
|
# do not intend to change it.
|
43
|
-
def initialize(decision:, attributes: nil
|
43
|
+
def initialize(decision:, tracestate:, attributes: nil)
|
44
44
|
@decision = decision
|
45
45
|
@attributes = attributes.freeze || EMPTY_HASH
|
46
46
|
@tracestate = tracestate
|
@@ -23,7 +23,13 @@ module OpenTelemetry
|
|
23
23
|
|
24
24
|
# The following readers are intended for the use of SpanProcessors and
|
25
25
|
# should not be considered part of the public interface for instrumentation.
|
26
|
-
attr_reader :name, :status, :kind, :parent_span_id, :start_timestamp, :end_timestamp, :links, :resource, :
|
26
|
+
attr_reader :name, :status, :kind, :parent_span_id, :start_timestamp, :end_timestamp, :links, :resource, :instrumentation_scope
|
27
|
+
|
28
|
+
# Returns an InstrumentationScope struct, which is backwards compatible with InstrumentationLibrary.
|
29
|
+
# @deprecated Please use instrumentation_scope instead.
|
30
|
+
#
|
31
|
+
# @return InstrumentationScope
|
32
|
+
alias instrumentation_library instrumentation_scope
|
27
33
|
|
28
34
|
# Return a frozen copy of the current attributes. This is intended for
|
29
35
|
# use of SpanProcessors and should not be considered part of the public
|
@@ -131,7 +137,7 @@ module OpenTelemetry
|
|
131
137
|
#
|
132
138
|
# @return [self] returns itself
|
133
139
|
def add_event(name, attributes: nil, timestamp: nil)
|
134
|
-
event = Event.new(name, truncate_attribute_values(attributes), relative_timestamp(timestamp))
|
140
|
+
event = Event.new(name, truncate_attribute_values(attributes, @span_limits.event_attribute_length_limit), relative_timestamp(timestamp))
|
135
141
|
|
136
142
|
@mutex.synchronize do
|
137
143
|
if @ended
|
@@ -267,7 +273,7 @@ module OpenTelemetry
|
|
267
273
|
@links,
|
268
274
|
@events,
|
269
275
|
@resource,
|
270
|
-
@
|
276
|
+
@instrumentation_scope,
|
271
277
|
context.span_id,
|
272
278
|
context.trace_id,
|
273
279
|
context.trace_flags,
|
@@ -276,7 +282,7 @@ module OpenTelemetry
|
|
276
282
|
end
|
277
283
|
|
278
284
|
# @api private
|
279
|
-
def initialize(context, parent_context, parent_span, name, kind, parent_span_id, span_limits, span_processors, attributes, links, start_timestamp, resource,
|
285
|
+
def initialize(context, parent_context, parent_span, name, kind, parent_span_id, span_limits, span_processors, attributes, links, start_timestamp, resource, instrumentation_scope) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
280
286
|
super(span_context: context)
|
281
287
|
@mutex = Mutex.new
|
282
288
|
@name = name
|
@@ -285,7 +291,7 @@ module OpenTelemetry
|
|
285
291
|
@span_limits = span_limits
|
286
292
|
@span_processors = span_processors
|
287
293
|
@resource = resource
|
288
|
-
@
|
294
|
+
@instrumentation_scope = instrumentation_scope
|
289
295
|
@ended = false
|
290
296
|
@status = DEFAULT_STATUS
|
291
297
|
@total_recorded_events = 0
|
@@ -343,21 +349,19 @@ module OpenTelemetry
|
|
343
349
|
|
344
350
|
excess = attrs.size - @span_limits.attribute_count_limit
|
345
351
|
excess.times { attrs.shift } if excess.positive?
|
346
|
-
truncate_attribute_values(attrs)
|
352
|
+
truncate_attribute_values(attrs, @span_limits.attribute_length_limit)
|
347
353
|
nil
|
348
354
|
end
|
349
355
|
|
350
|
-
def truncate_attribute_values(attrs)
|
356
|
+
def truncate_attribute_values(attrs, attribute_length_limit)
|
351
357
|
return EMPTY_ATTRIBUTES if attrs.nil?
|
352
|
-
|
353
|
-
attribute_length_limit = @span_limits.attribute_length_limit
|
354
358
|
return attrs if attribute_length_limit.nil?
|
355
359
|
|
356
360
|
attrs.transform_values! { |value| OpenTelemetry::Common::Utilities.truncate_attribute_value(value, attribute_length_limit) }
|
357
361
|
attrs
|
358
362
|
end
|
359
363
|
|
360
|
-
def trim_links(links, link_count_limit, link_attribute_count_limit) # rubocop:disable Metrics/
|
364
|
+
def trim_links(links, link_count_limit, link_attribute_count_limit) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
361
365
|
# Fast path (likely) common cases.
|
362
366
|
return nil if links.nil?
|
363
367
|
|
@@ -379,7 +383,7 @@ module OpenTelemetry
|
|
379
383
|
end.freeze
|
380
384
|
end
|
381
385
|
|
382
|
-
def append_event(events, event) # rubocop:disable Metrics/
|
386
|
+
def append_event(events, event) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
383
387
|
event_count_limit = @span_limits.event_count_limit
|
384
388
|
event_attribute_count_limit = @span_limits.event_attribute_count_limit
|
385
389
|
valid_attributes = Internal.valid_attributes?(name, 'event', event.attributes)
|
@@ -23,7 +23,7 @@ module OpenTelemetry
|
|
23
23
|
:links, # optional Array[OpenTelemetry::Trace::Link]
|
24
24
|
:events, # optional Array[Event]
|
25
25
|
:resource, # OpenTelemetry::SDK::Resources::Resource
|
26
|
-
:
|
26
|
+
:instrumentation_scope, # OpenTelemetry::SDK::InstrumentationScope
|
27
27
|
:span_id, # String (8 byte binary)
|
28
28
|
:trace_id, # String (16-byte binary)
|
29
29
|
:trace_flags, # Integer (8-bit byte of bit flags)
|
@@ -48,6 +48,12 @@ module OpenTelemetry
|
|
48
48
|
def hex_parent_span_id
|
49
49
|
parent_span_id.unpack1('H*')
|
50
50
|
end
|
51
|
+
|
52
|
+
# Returns an InstrumentationScope struct, which is backwards compatible with InstrumentationLibrary.
|
53
|
+
# @deprecated Please use instrumentation_scope instead.
|
54
|
+
#
|
55
|
+
# @return InstrumentationScope
|
56
|
+
alias_method :instrumentation_library, :instrumentation_scope
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
@@ -24,6 +24,9 @@ module OpenTelemetry
|
|
24
24
|
# The global default max number of attributes per {OpenTelemetry::SDK::Trace::Event}.
|
25
25
|
attr_reader :event_attribute_count_limit
|
26
26
|
|
27
|
+
# The global default max length of attribute value per {OpenTelemetry::SDK::Trace::Event}.
|
28
|
+
attr_reader :event_attribute_length_limit
|
29
|
+
|
27
30
|
# The global default max number of attributes per {OpenTelemetry::Trace::Link}.
|
28
31
|
attr_reader :link_attribute_count_limit
|
29
32
|
|
@@ -31,18 +34,20 @@ module OpenTelemetry
|
|
31
34
|
#
|
32
35
|
# @return [SpanLimits] with the desired values.
|
33
36
|
# @raise [ArgumentError] if any of the max numbers are not positive.
|
34
|
-
def initialize(attribute_count_limit: Integer(
|
35
|
-
attribute_length_limit:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
link_attribute_count_limit: Integer(
|
37
|
+
def initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128)), # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
38
|
+
attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'),
|
39
|
+
event_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_EVENT_COUNT_LIMIT', default: 128)),
|
40
|
+
link_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_LINK_COUNT_LIMIT', default: 128)),
|
41
|
+
event_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT', default: 128)),
|
42
|
+
event_attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'),
|
43
|
+
link_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_LINK_ATTRIBUTE_COUNT_LIMIT', default: 128)))
|
44
|
+
|
41
45
|
raise ArgumentError, 'attribute_count_limit must be positive' unless attribute_count_limit.positive?
|
42
46
|
raise ArgumentError, 'attribute_length_limit must not be less than 32' unless attribute_length_limit.nil? || Integer(attribute_length_limit) >= 32
|
43
47
|
raise ArgumentError, 'event_count_limit must be positive' unless event_count_limit.positive?
|
44
48
|
raise ArgumentError, 'link_count_limit must be positive' unless link_count_limit.positive?
|
45
49
|
raise ArgumentError, 'event_attribute_count_limit must be positive' unless event_attribute_count_limit.positive?
|
50
|
+
raise ArgumentError, 'event_attribute_length_limit must not be less than 32' unless event_attribute_length_limit.nil? || Integer(event_attribute_length_limit) >= 32
|
46
51
|
raise ArgumentError, 'link_attribute_count_limit must be positive' unless link_attribute_count_limit.positive?
|
47
52
|
|
48
53
|
@attribute_count_limit = attribute_count_limit
|
@@ -50,6 +55,7 @@ module OpenTelemetry
|
|
50
55
|
@event_count_limit = event_count_limit
|
51
56
|
@link_count_limit = link_count_limit
|
52
57
|
@event_attribute_count_limit = event_attribute_count_limit
|
58
|
+
@event_attribute_length_limit = event_attribute_length_limit.nil? ? nil : Integer(event_attribute_length_limit)
|
53
59
|
@link_attribute_count_limit = link_attribute_count_limit
|
54
60
|
end
|
55
61
|
|
@@ -19,7 +19,7 @@ module OpenTelemetry
|
|
19
19
|
#
|
20
20
|
# @return [Tracer]
|
21
21
|
def initialize(name, version, tracer_provider)
|
22
|
-
@
|
22
|
+
@instrumentation_scope = InstrumentationScope.new(name, version)
|
23
23
|
@tracer_provider = tracer_provider
|
24
24
|
end
|
25
25
|
|
@@ -28,17 +28,13 @@ module OpenTelemetry
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
|
31
|
-
name ||= 'empty'
|
32
|
-
|
33
31
|
with_parent ||= Context.current
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
trace_id = parent_span_context.trace_id
|
39
|
-
end
|
32
|
+
return super(name, with_parent: with_parent, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind) if Common::Utilities.untraced?(with_parent)
|
33
|
+
|
34
|
+
name ||= 'empty'
|
35
|
+
kind ||= :internal
|
40
36
|
|
41
|
-
@tracer_provider.
|
37
|
+
@tracer_provider.internal_start_span(name, kind, attributes, links, start_timestamp, with_parent, @instrumentation_scope)
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
@@ -126,15 +126,16 @@ module OpenTelemetry
|
|
126
126
|
end
|
127
127
|
|
128
128
|
# @api private
|
129
|
-
def
|
129
|
+
def internal_start_span(name, kind, attributes, links, start_timestamp, parent_context, instrumentation_scope) # rubocop:disable Metrics/MethodLength
|
130
|
+
parent_span = OpenTelemetry::Trace.current_span(parent_context)
|
130
131
|
parent_span_context = parent_span.context
|
132
|
+
|
131
133
|
if parent_span_context.valid?
|
132
134
|
parent_span_id = parent_span_context.span_id
|
133
135
|
trace_id = parent_span_context.trace_id
|
134
136
|
end
|
135
|
-
|
137
|
+
|
136
138
|
trace_id ||= @id_generator.generate_trace_id
|
137
|
-
kind ||= :internal
|
138
139
|
result = @sampler.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes)
|
139
140
|
span_id = @id_generator.generate_span_id
|
140
141
|
if result.recording? && !@stopped
|
@@ -154,7 +155,7 @@ module OpenTelemetry
|
|
154
155
|
links,
|
155
156
|
start_timestamp,
|
156
157
|
@resource,
|
157
|
-
|
158
|
+
instrumentation_scope
|
158
159
|
)
|
159
160
|
else
|
160
161
|
OpenTelemetry::Trace.non_recording_span(OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id, span_id: span_id, tracestate: result.tracestate))
|
@@ -163,7 +164,7 @@ module OpenTelemetry
|
|
163
164
|
|
164
165
|
private
|
165
166
|
|
166
|
-
def sampler_from_environment(default_sampler)
|
167
|
+
def sampler_from_environment(default_sampler)
|
167
168
|
case ENV['OTEL_TRACES_SAMPLER']
|
168
169
|
when 'always_on' then Samplers::ALWAYS_ON
|
169
170
|
when 'always_off' then Samplers::ALWAYS_OFF
|
data/lib/opentelemetry/sdk.rb
CHANGED
@@ -78,6 +78,7 @@ require 'opentelemetry/sdk/configurator'
|
|
78
78
|
require 'opentelemetry/sdk/forwarding_logger'
|
79
79
|
require 'opentelemetry/sdk/internal'
|
80
80
|
require 'opentelemetry/sdk/instrumentation_library'
|
81
|
+
require 'opentelemetry/sdk/instrumentation_scope'
|
81
82
|
require 'opentelemetry/sdk/resources'
|
82
83
|
require 'opentelemetry/sdk/trace'
|
83
84
|
require 'opentelemetry/sdk/version'
|
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: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-31 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: '1.
|
19
|
+
version: '1.1'
|
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: '1.
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-common
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: opentelemetry-semantic_conventions
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 5.15.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 5.15.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: opentelemetry-exporter-zipkin
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 1.51.0
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 1.51.0
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: simplecov
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/opentelemetry/sdk/configurator.rb
|
265
265
|
- lib/opentelemetry/sdk/forwarding_logger.rb
|
266
266
|
- lib/opentelemetry/sdk/instrumentation_library.rb
|
267
|
+
- lib/opentelemetry/sdk/instrumentation_scope.rb
|
267
268
|
- lib/opentelemetry/sdk/internal.rb
|
268
269
|
- lib/opentelemetry/sdk/resources.rb
|
269
270
|
- lib/opentelemetry/sdk/resources/resource.rb
|
@@ -293,10 +294,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
293
294
|
licenses:
|
294
295
|
- Apache-2.0
|
295
296
|
metadata:
|
296
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.1
|
297
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.2.1/file.CHANGELOG.html
|
297
298
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/sdk
|
298
299
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
299
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.1
|
300
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.2.1
|
300
301
|
post_install_message:
|
301
302
|
rdoc_options: []
|
302
303
|
require_paths:
|