opentelemetry-sdk 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/lib/opentelemetry-sdk.rb +1 -1
- data/lib/opentelemetry/sdk.rb +1 -1
- data/lib/opentelemetry/sdk/baggage.rb +1 -1
- data/lib/opentelemetry/sdk/baggage/builder.rb +1 -1
- data/lib/opentelemetry/sdk/baggage/manager.rb +1 -1
- data/lib/opentelemetry/sdk/configurator.rb +1 -1
- data/lib/opentelemetry/sdk/instrumentation_library.rb +1 -1
- data/lib/opentelemetry/sdk/internal.rb +1 -1
- data/lib/opentelemetry/sdk/resources.rb +1 -1
- data/lib/opentelemetry/sdk/resources/constants.rb +1 -1
- data/lib/opentelemetry/sdk/resources/resource.rb +1 -1
- data/lib/opentelemetry/sdk/trace.rb +1 -1
- data/lib/opentelemetry/sdk/trace/config.rb +1 -1
- data/lib/opentelemetry/sdk/trace/config/trace_config.rb +1 -1
- data/lib/opentelemetry/sdk/trace/event.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export.rb +2 -1
- data/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb +23 -4
- data/lib/opentelemetry/sdk/trace/export/console_span_exporter.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export/metrics_reporter.rb +59 -0
- data/lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb +1 -1
- data/lib/opentelemetry/sdk/trace/export/simple_span_processor.rb +1 -1
- data/lib/opentelemetry/sdk/trace/multi_span_processor.rb +1 -1
- data/lib/opentelemetry/sdk/trace/noop_span_processor.rb +1 -1
- data/lib/opentelemetry/sdk/trace/samplers.rb +1 -1
- data/lib/opentelemetry/sdk/trace/samplers/decision.rb +1 -1
- data/lib/opentelemetry/sdk/trace/samplers/result.rb +1 -1
- data/lib/opentelemetry/sdk/trace/samplers/trace_id_ratio_based.rb +1 -1
- data/lib/opentelemetry/sdk/trace/span.rb +1 -1
- data/lib/opentelemetry/sdk/trace/span_data.rb +1 -1
- data/lib/opentelemetry/sdk/trace/tracer.rb +1 -1
- data/lib/opentelemetry/sdk/trace/tracer_provider.rb +1 -1
- data/lib/opentelemetry/sdk/version.rb +2 -2
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb411f30633b54940beb1f9098606f19330f8ebab59e3b98cec8e56ec2e3bbdf
|
4
|
+
data.tar.gz: 6f9a05cd0341cf0411c501abbb40648c11dc97d920b65728386dca2c404b8f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ed1519e66997080314953a11e483e6f00d4bb774b9eecc6effe6623f2e48c68485594717db25ba39bd92c453cd25c926c0ca2dabc19588878067eefba48ece
|
7
|
+
data.tar.gz: 3f1dcd7506145ed4c008403926827205ed8661a3ee6c35f524ead8d6fd16984ce556722c4b0917229e2e641c37ffe3c83088beadd990d6dfb6015a1fa083cf6a
|
data/CHANGELOG.md
CHANGED
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
|
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.
|
data/lib/opentelemetry-sdk.rb
CHANGED
data/lib/opentelemetry/sdk.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -30,6 +30,7 @@ end
|
|
30
30
|
require 'opentelemetry/sdk/trace/export/batch_span_processor'
|
31
31
|
require 'opentelemetry/sdk/trace/export/console_span_exporter'
|
32
32
|
require 'opentelemetry/sdk/trace/export/in_memory_span_exporter'
|
33
|
+
require 'opentelemetry/sdk/trace/export/metrics_reporter'
|
33
34
|
require 'opentelemetry/sdk/trace/export/multi_span_exporter'
|
34
35
|
require 'opentelemetry/sdk/trace/export/noop_span_exporter'
|
35
36
|
require 'opentelemetry/sdk/trace/export/simple_span_processor'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -48,7 +48,8 @@ module OpenTelemetry
|
|
48
48
|
schedule_delay_millis: Float(ENV.fetch('OTEL_BSP_SCHEDULE_DELAY_MILLIS', 5_000)),
|
49
49
|
max_queue_size: Integer(ENV.fetch('OTEL_BSP_MAX_QUEUE_SIZE', 2048)),
|
50
50
|
max_export_batch_size: Integer(ENV.fetch('OTEL_BSP_MAX_EXPORT_BATCH_SIZE', 512)),
|
51
|
-
start_thread_on_boot: String(ENV['OTEL_RUBY_BSP_START_THREAD_ON_BOOT']) !~ /false/i
|
51
|
+
start_thread_on_boot: String(ENV['OTEL_RUBY_BSP_START_THREAD_ON_BOOT']) !~ /false/i,
|
52
|
+
metrics_reporter: nil)
|
52
53
|
raise ArgumentError if max_export_batch_size > max_queue_size
|
53
54
|
|
54
55
|
@exporter = exporter
|
@@ -60,6 +61,7 @@ module OpenTelemetry
|
|
60
61
|
@delay_seconds = schedule_delay_millis / 1000.0
|
61
62
|
@max_queue_size = max_queue_size
|
62
63
|
@batch_size = max_export_batch_size
|
64
|
+
@metrics_reporter = metrics_reporter || OpenTelemetry::SDK::Trace::Export::MetricsReporter
|
63
65
|
@spans = []
|
64
66
|
@pid = nil
|
65
67
|
@thread = nil
|
@@ -77,6 +79,7 @@ module OpenTelemetry
|
|
77
79
|
reset_on_fork
|
78
80
|
n = spans.size + 1 - max_queue_size
|
79
81
|
spans.shift(n) if n.positive?
|
82
|
+
report_dropped_spans(n, reason: 'buffer-full')
|
80
83
|
spans << span
|
81
84
|
@condition.signal if spans.size > batch_size
|
82
85
|
end
|
@@ -115,6 +118,7 @@ module OpenTelemetry
|
|
115
118
|
lock do
|
116
119
|
n = spans.size + snapshot.size - max_queue_size
|
117
120
|
snapshot.shift(n) if n.positive?
|
121
|
+
report_dropped_spans(n, reason: 'buffer-full')
|
118
122
|
spans.unshift(snapshot) unless snapshot.empty?
|
119
123
|
@condition.signal if spans.size > max_queue_size / 2
|
120
124
|
end
|
@@ -136,13 +140,15 @@ module OpenTelemetry
|
|
136
140
|
@thread.join(timeout)
|
137
141
|
force_flush(timeout: OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time))
|
138
142
|
@exporter.shutdown(timeout: OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time))
|
143
|
+
dropped_spans = lock { spans.size }
|
144
|
+
report_dropped_spans(dropped_spans, reason: 'terminating') if dropped_spans.positive?
|
139
145
|
end
|
140
146
|
|
141
147
|
private
|
142
148
|
|
143
149
|
attr_reader :spans, :max_queue_size, :batch_size
|
144
150
|
|
145
|
-
def work
|
151
|
+
def work # rubocop:disable Metrics/AbcSize
|
146
152
|
loop do
|
147
153
|
batch = lock do
|
148
154
|
reset_on_fork(restart_thread: false)
|
@@ -153,6 +159,8 @@ module OpenTelemetry
|
|
153
159
|
fetch_batch
|
154
160
|
end
|
155
161
|
|
162
|
+
@metrics_reporter.observe_value('otel.bsp.buffer_utilization', value: spans.size / max_queue_size.to_f)
|
163
|
+
|
156
164
|
export_batch(batch)
|
157
165
|
end
|
158
166
|
end
|
@@ -173,7 +181,18 @@ module OpenTelemetry
|
|
173
181
|
end
|
174
182
|
|
175
183
|
def report_result(result_code, batch)
|
176
|
-
|
184
|
+
if result_code == SUCCESS
|
185
|
+
@metrics_reporter.add_to_counter('otel.bsp.export.success')
|
186
|
+
@metrics_reporter.add_to_counter('otel.bsp.exported_spans', increment: batch.size)
|
187
|
+
else
|
188
|
+
OpenTelemetry.logger.error("Unable to export #{batch.size} spans")
|
189
|
+
@metrics_reporter.add_to_counter('otel.bsp.export.failure')
|
190
|
+
report_dropped_spans(batch.size, reason: 'export-failure')
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def report_dropped_spans(count, reason:)
|
195
|
+
@metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: count, labels: { 'reason' => reason })
|
177
196
|
end
|
178
197
|
|
179
198
|
def fetch_batch
|
@@ -0,0 +1,59 @@
|
|
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
|
+
module Trace
|
10
|
+
module Export
|
11
|
+
# MetricsReporter defines an interface used for reporting metrics from
|
12
|
+
# span processors (like the BatchSpanProcessor) and exporters. It can
|
13
|
+
# be used to report metrics such as dropped spans, and successful and
|
14
|
+
# failed export attempts. This exists to decouple the Trace SDK from
|
15
|
+
# the unstable OpenTelemetry Metrics API. An example implementation in
|
16
|
+
# terms of StatsD is:
|
17
|
+
#
|
18
|
+
# module MetricsReporter
|
19
|
+
# def add_to_counter(metric, increment: 1, labels: {})
|
20
|
+
# StatsD.increment(metric, increment, labels, no_prefix: true)
|
21
|
+
# end
|
22
|
+
# def record_value(metric, value:, labels: {})
|
23
|
+
# StatsD.distribution(metric, value, labels, no_prefix: true)
|
24
|
+
# end
|
25
|
+
# def observe_value(metric, value:, labels: {})
|
26
|
+
# StatsD.gauge(metric, value, labels, no_prefix: true)
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
module MetricsReporter
|
30
|
+
extend self
|
31
|
+
|
32
|
+
# Adds an increment to a metric with the provided labels.
|
33
|
+
#
|
34
|
+
# @param [String] metric The metric name.
|
35
|
+
# @param [optional Numeric] increment An optional increment to report.
|
36
|
+
# @param [optional Hash<String, String>] labels Optional labels to
|
37
|
+
# associate with the metric.
|
38
|
+
def add_to_counter(metric, increment: 1, labels: {}); end
|
39
|
+
|
40
|
+
# Records a value for a metric with the provided labels.
|
41
|
+
#
|
42
|
+
# @param [String] metric The metric name.
|
43
|
+
# @param [Numeric] value The value to report.
|
44
|
+
# @param [optional Hash<String, String>] labels Optional labels to
|
45
|
+
# associate with the metric.
|
46
|
+
def record_value(metric, value:, labels: {}); end
|
47
|
+
|
48
|
+
# Observes a value for a metric with the provided labels.
|
49
|
+
#
|
50
|
+
# @param [String] metric The metric name.
|
51
|
+
# @param [Numeric] value The value to observe.
|
52
|
+
# @param [optional Hash<String, String>] labels Optional labels to
|
53
|
+
# associate with the metric.
|
54
|
+
def observe_value(metric, value:, labels: {}); end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
7
|
module OpenTelemetry
|
8
8
|
module SDK
|
9
9
|
## Current OpenTelemetry version
|
10
|
-
VERSION = '0.
|
10
|
+
VERSION = '0.11.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.
|
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-12-
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.11.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.
|
26
|
+
version: 0.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-common
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.11.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.11.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- lib/opentelemetry/sdk/trace/export/batch_span_processor.rb
|
181
181
|
- lib/opentelemetry/sdk/trace/export/console_span_exporter.rb
|
182
182
|
- lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb
|
183
|
+
- lib/opentelemetry/sdk/trace/export/metrics_reporter.rb
|
183
184
|
- lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb
|
184
185
|
- lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
|
185
186
|
- lib/opentelemetry/sdk/trace/export/simple_span_processor.rb
|
@@ -200,10 +201,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
200
201
|
licenses:
|
201
202
|
- Apache-2.0
|
202
203
|
metadata:
|
203
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.
|
204
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.11.0/file.CHANGELOG.html
|
204
205
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/sdk
|
205
206
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
206
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.
|
207
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.11.0
|
207
208
|
post_install_message:
|
208
209
|
rdoc_options: []
|
209
210
|
require_paths:
|