opentelemetry-sdk 0.12.1 → 0.13.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 +10 -0
- data/README.md +2 -2
- data/lib/opentelemetry/sdk/configurator.rb +6 -6
- data/lib/opentelemetry/sdk/resources/constants.rb +40 -0
- data/lib/opentelemetry/sdk/resources/resource.rb +17 -5
- data/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb +9 -9
- data/lib/opentelemetry/sdk/trace/span.rb +12 -7
- data/lib/opentelemetry/sdk/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64da58e8086f08efd2f7bace98369ec16936abcf95996588bda288a592d5912
|
4
|
+
data.tar.gz: 4d67cd982c51998cf0396531bcbaae6f62f23b89314793def72410624c87a645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8d0331a351e32cf184a512c155c6d3944bb5bbbb2857aad27636bdc7eca58081d45e6d778eecd50681e1a1c471c75f9cf7d8116b57ba5c5c5b7a5838f3a648
|
7
|
+
data.tar.gz: ef884f72a85e1457b1d160d2075313df169f895cfe92831d87e77022244db6b6d980f7a36f6c88926886fd67538e916c2e813728ce80aa2897ef24da216d2924
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Release History: opentelemetry-sdk
|
2
2
|
|
3
|
+
### v0.13.0 / 2021-01-29
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Remove MILLIS from BatchSpanProcessor vars
|
6
|
+
|
7
|
+
* ADDED: Process.runtime resource
|
8
|
+
* ADDED: Provide default resource in SDK
|
9
|
+
* ADDED: Add optional attributes to record_exception
|
10
|
+
* FIXED: Resource.merge consistency
|
11
|
+
* FIXED: Remove MILLIS from BatchSpanProcessor vars
|
12
|
+
|
3
13
|
### v0.12.1 / 2021-01-13
|
4
14
|
|
5
15
|
* FIXED: Fix several BatchSpanProcessor errors related to fork safety
|
data/README.md
CHANGED
@@ -66,8 +66,8 @@ The `opentelemetry-sdk` gem is distributed under the Apache 2.0 license. See [LI
|
|
66
66
|
[opentelemetry-home]: https://opentelemetry.io
|
67
67
|
[bundler-home]: https://bundler.io
|
68
68
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
69
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
70
|
-
[examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
69
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
70
|
+
[examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/examples
|
71
71
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
72
72
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
73
73
|
[ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
|
@@ -27,7 +27,7 @@ module OpenTelemetry
|
|
27
27
|
@text_map_injectors = nil
|
28
28
|
@span_processors = []
|
29
29
|
@use_mode = USE_MODE_UNSPECIFIED
|
30
|
-
@resource = Resources::Resource.
|
30
|
+
@resource = Resources::Resource.default
|
31
31
|
@id_generator = OpenTelemetry::Trace
|
32
32
|
end
|
33
33
|
|
@@ -46,7 +46,7 @@ module OpenTelemetry
|
|
46
46
|
#
|
47
47
|
# @param [Resource] new_resource The resource to be merged
|
48
48
|
def resource=(new_resource)
|
49
|
-
@resource =
|
49
|
+
@resource = @resource.merge(new_resource)
|
50
50
|
end
|
51
51
|
|
52
52
|
# Accepts a string that is merged in as the service.name resource attribute.
|
@@ -54,9 +54,9 @@ module OpenTelemetry
|
|
54
54
|
# calls to this setter.
|
55
55
|
# @param [String] service_name The value to be used as the service name
|
56
56
|
def service_name=(service_name)
|
57
|
-
|
57
|
+
self.resource = OpenTelemetry::SDK::Resources::Resource.create(
|
58
58
|
OpenTelemetry::SDK::Resources::Constants::SERVICE_RESOURCE[:name] => service_name
|
59
|
-
)
|
59
|
+
)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Accepts a string that is merged in as the service.version resource attribute.
|
@@ -64,9 +64,9 @@ module OpenTelemetry
|
|
64
64
|
# calls to this setter.
|
65
65
|
# @param [String] service_version The value to be used as the service version
|
66
66
|
def service_version=(service_version)
|
67
|
-
|
67
|
+
self.resource = OpenTelemetry::SDK::Resources::Resource.create(
|
68
68
|
OpenTelemetry::SDK::Resources::Constants::SERVICE_RESOURCE[:version] => service_version
|
69
|
-
)
|
69
|
+
)
|
70
70
|
end
|
71
71
|
|
72
72
|
# Install an instrumentation with specificied optional +config+.
|
@@ -77,6 +77,46 @@ module OpenTelemetry
|
|
77
77
|
deployment_name: 'k8s.deployment.name'
|
78
78
|
}.freeze
|
79
79
|
|
80
|
+
# Attributes defining an operating system process.
|
81
|
+
PROCESS_RESOURCE = {
|
82
|
+
# Process identifier (PID).
|
83
|
+
pid: 'process.pid',
|
84
|
+
|
85
|
+
# The name of the process executable.
|
86
|
+
executable_name: 'process.executable.name',
|
87
|
+
|
88
|
+
# The full path to the process executable.
|
89
|
+
executable_path: 'process.executable.path',
|
90
|
+
|
91
|
+
# The command used to launch the process (i.e. the command name).
|
92
|
+
command: 'process.command',
|
93
|
+
|
94
|
+
# The full command used to launch the process as a single string
|
95
|
+
# representing the full command.
|
96
|
+
command_line: 'process.command_line',
|
97
|
+
|
98
|
+
# All the command arguments (including the command/executable itself)
|
99
|
+
# as received by the process.
|
100
|
+
command_args: 'process.command_args',
|
101
|
+
|
102
|
+
# The username of the user that owns the process.
|
103
|
+
owner: 'process.owner'
|
104
|
+
}.freeze
|
105
|
+
|
106
|
+
# Attributes defining the single (language) runtime instance which is monitored.
|
107
|
+
PROCESS_RUNTIME_RESOURCE = {
|
108
|
+
# The name of the runtime of this process.
|
109
|
+
name: 'process.runtime.name',
|
110
|
+
|
111
|
+
# The version of the runtime of this process, as returned by the runtime
|
112
|
+
# without modification.
|
113
|
+
version: 'process.runtime.version',
|
114
|
+
|
115
|
+
# An additional description about the runtime of the process, for example
|
116
|
+
# a specific vendor customization of the runtime environment.
|
117
|
+
description: 'process.runtime.description'
|
118
|
+
}.freeze
|
119
|
+
|
80
120
|
# Attributes defining a computing instance (e.g. host).
|
81
121
|
HOST_RESOURCE = {
|
82
122
|
# Unique host id. For Cloud this must be the instance_id assigned by the
|
@@ -30,6 +30,10 @@ module OpenTelemetry
|
|
30
30
|
new(frozen_attributes)
|
31
31
|
end
|
32
32
|
|
33
|
+
def default
|
34
|
+
@default ||= telemetry_sdk.merge(process).merge(create(Constants::SERVICE_RESOURCE[:name] => 'unknown_service'))
|
35
|
+
end
|
36
|
+
|
33
37
|
def telemetry_sdk
|
34
38
|
resource_attributes = {
|
35
39
|
Constants::TELEMETRY_SDK_RESOURCE[:name] => 'opentelemetry',
|
@@ -48,6 +52,18 @@ module OpenTelemetry
|
|
48
52
|
resource_attributes.delete_if { |_key, value| value.nil? || value.empty? }
|
49
53
|
create(resource_attributes)
|
50
54
|
end
|
55
|
+
|
56
|
+
def process
|
57
|
+
resource_attributes = {
|
58
|
+
Constants::PROCESS_RESOURCE[:pid] => Process.pid,
|
59
|
+
Constants::PROCESS_RESOURCE[:command] => $PROGRAM_NAME,
|
60
|
+
Constants::PROCESS_RUNTIME_RESOURCE[:name] => RUBY_ENGINE,
|
61
|
+
Constants::PROCESS_RUNTIME_RESOURCE[:version] => RUBY_VERSION,
|
62
|
+
Constants::PROCESS_RUNTIME_RESOURCE[:description] => RUBY_DESCRIPTION
|
63
|
+
}
|
64
|
+
|
65
|
+
create(resource_attributes)
|
66
|
+
end
|
51
67
|
end
|
52
68
|
|
53
69
|
# @api private
|
@@ -79,11 +95,7 @@ module OpenTelemetry
|
|
79
95
|
def merge(other)
|
80
96
|
return self unless other.is_a?(Resource)
|
81
97
|
|
82
|
-
|
83
|
-
old_v.empty? ? new_v : old_v
|
84
|
-
end
|
85
|
-
|
86
|
-
self.class.send(:new, merged_attributes.freeze)
|
98
|
+
self.class.send(:new, attributes.merge(other.attributes).freeze)
|
87
99
|
end
|
88
100
|
|
89
101
|
protected
|
@@ -19,7 +19,7 @@ module OpenTelemetry
|
|
19
19
|
# All spans reported by the SDK implementation are first added to a
|
20
20
|
# synchronized queue (with a {max_queue_size} maximum size, after the
|
21
21
|
# size is reached spans are dropped) and exported every
|
22
|
-
#
|
22
|
+
# schedule_delay to the exporter pipeline in batches of
|
23
23
|
# max_export_batch_size.
|
24
24
|
#
|
25
25
|
# If the queue gets half full a preemptive notification is sent to the
|
@@ -29,11 +29,11 @@ module OpenTelemetry
|
|
29
29
|
# Returns a new instance of the {BatchSpanProcessor}.
|
30
30
|
#
|
31
31
|
# @param [SpanExporter] exporter
|
32
|
-
# @param [Numeric]
|
33
|
-
# consecutive exports. Defaults to the value of the
|
32
|
+
# @param [Numeric] exporter_timeout the delay interval between two
|
33
|
+
# consecutive exports. Defaults to the value of the OTEL_BSP_EXPORT_TIMEOUT
|
34
34
|
# environment variable, if set, or 30,000 (30 seconds).
|
35
|
-
# @param [Numeric]
|
36
|
-
# Defaults to the value of the
|
35
|
+
# @param [Numeric] schedule_delay the maximum allowed time to export data.
|
36
|
+
# Defaults to the value of the OTEL_BSP_SCHEDULE_DELAY environment
|
37
37
|
# variable, if set, or 5,000 (5 seconds).
|
38
38
|
# @param [Integer] max_queue_size the maximum queue size in spans.
|
39
39
|
# Defaults to the value of the OTEL_BSP_MAX_QUEUE_SIZE environment
|
@@ -44,8 +44,8 @@ module OpenTelemetry
|
|
44
44
|
#
|
45
45
|
# @return a new instance of the {BatchSpanProcessor}.
|
46
46
|
def initialize(exporter:,
|
47
|
-
|
48
|
-
|
47
|
+
exporter_timeout: Float(ENV.fetch('OTEL_BSP_EXPORT_TIMEOUT', 30_000)),
|
48
|
+
schedule_delay: Float(ENV.fetch('OTEL_BSP_SCHEDULE_DELAY', 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
51
|
start_thread_on_boot: String(ENV['OTEL_RUBY_BSP_START_THREAD_ON_BOOT']) !~ /false/i,
|
@@ -53,12 +53,12 @@ module OpenTelemetry
|
|
53
53
|
raise ArgumentError if max_export_batch_size > max_queue_size
|
54
54
|
|
55
55
|
@exporter = exporter
|
56
|
-
@exporter_timeout_seconds =
|
56
|
+
@exporter_timeout_seconds = exporter_timeout / 1000.0
|
57
57
|
@mutex = Mutex.new
|
58
58
|
@export_mutex = Mutex.new
|
59
59
|
@condition = ConditionVariable.new
|
60
60
|
@keep_running = true
|
61
|
-
@delay_seconds =
|
61
|
+
@delay_seconds = schedule_delay / 1000.0
|
62
62
|
@max_queue_size = max_queue_size
|
63
63
|
@batch_size = max_export_batch_size
|
64
64
|
@metrics_reporter = metrics_reporter || OpenTelemetry::SDK::Trace::Export::MetricsReporter
|
@@ -120,15 +120,20 @@ module OpenTelemetry
|
|
120
120
|
# can be recorded on a span.
|
121
121
|
#
|
122
122
|
# @param [Exception] exception The exception to be recorded
|
123
|
+
# @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]
|
124
|
+
# attributes One or more key:value pairs, where the keys must be
|
125
|
+
# strings and the values may be (array of) string, boolean or numeric
|
126
|
+
# type.
|
123
127
|
#
|
124
128
|
# @return [void]
|
125
|
-
def record_exception(exception)
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
129
|
+
def record_exception(exception, attributes: nil)
|
130
|
+
event_attributes = {
|
131
|
+
'exception.type' => exception.class.to_s,
|
132
|
+
'exception.message' => exception.message,
|
133
|
+
'exception.stacktrace' => exception.full_message(highlight: false, order: :top)
|
134
|
+
}
|
135
|
+
event_attributes.merge!(attributes) unless attributes.nil?
|
136
|
+
add_event('exception', attributes: event_attributes)
|
132
137
|
end
|
133
138
|
|
134
139
|
# Sets the Status to the Span
|
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.13.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: 2021-01-
|
11
|
+
date: 2021-01-30 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.13.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.13.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.13.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.13.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,10 +201,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
201
201
|
licenses:
|
202
202
|
- Apache-2.0
|
203
203
|
metadata:
|
204
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.
|
205
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
204
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.13.0/file.CHANGELOG.html
|
205
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/sdk
|
206
206
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
207
|
-
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.13.0
|
208
208
|
post_install_message:
|
209
209
|
rdoc_options: []
|
210
210
|
require_paths:
|