opentelemetry-exporter-otlp 0.35.1 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/lib/opentelemetry/exporter/otlp/exporter.rb +6 -152
- data/lib/opentelemetry/exporter/otlp/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65a1d95610cd4baa2fc786e2a6aa93ca03c2517638201aa81b7eadf161dacd8f
|
|
4
|
+
data.tar.gz: f6d7a78a6d578a67ef3d540ad1a5c34089119e2a316dabb6bff632f7795fa747
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '019c553548f6070e5098b4483079894994641261706ef5a7a0f7cef00d392fabe0b81b4a0fbc357b2161e3c3526220c854849b641966f6cef84fa7dddb56721a'
|
|
7
|
+
data.tar.gz: b58b514cdd1c8fadbbe52ec3ab7f997ca84f50d369dbb66b62d2b5b1aa508a51ed277b9bcddd7f7c7a39b20703efd77fe9b20adbf2fa0888c5e4d8b866d7a4bd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Release History: opentelemetry-exporter-otlp
|
|
2
2
|
|
|
3
|
+
### v0.37.0 / 2026-09-29
|
|
4
|
+
|
|
5
|
+
* ADDED: Move otlp exporter uri builder to common (#2240)
|
|
6
|
+
* FIXED: Default OTLP exporter compression to none (#2331)
|
|
7
|
+
* FIXED: Normalize UTF-8 attribute strings (#2259)
|
|
8
|
+
|
|
9
|
+
### v0.36.0 / 2026-09-09
|
|
10
|
+
|
|
11
|
+
* ADDED: Use common conversion including supporting flags (#2333)
|
|
12
|
+
* ADDED: Add opentelemetry-exporter-otlp as a dependency (#2333)
|
|
13
|
+
|
|
3
14
|
### v0.35.1 / 2026-09-01
|
|
4
15
|
|
|
5
16
|
* REVERT: Use common conversion including supporting flags (#2328)
|
data/README.md
CHANGED
|
@@ -80,7 +80,7 @@ The collector exporter can be configured explicitly in code, or via environment
|
|
|
80
80
|
| `client_certificate_file` | `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` | |
|
|
81
81
|
| `client_key_file` | `OTEL_EXPORTER_OTLP_CLIENT_KEY` | |
|
|
82
82
|
| `headers:` | `OTEL_EXPORTER_OTLP_HEADERS` | |
|
|
83
|
-
| `compression:` | `OTEL_EXPORTER_OTLP_COMPRESSION` | `"
|
|
83
|
+
| `compression:` | `OTEL_EXPORTER_OTLP_COMPRESSION` | `"none"` |
|
|
84
84
|
| `timeout:` | `OTEL_EXPORTER_OTLP_TIMEOUT` | `10` |
|
|
85
85
|
| `ssl_verify_mode:` | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER` or | `OpenSSL::SSL:VERIFY_PEER` |
|
|
86
86
|
| | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_NONE` | |
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
|
|
7
7
|
require 'opentelemetry/common'
|
|
8
|
+
require 'opentelemetry/exporter/otlp/common'
|
|
8
9
|
require 'opentelemetry/sdk'
|
|
9
10
|
require 'net/http'
|
|
10
11
|
require 'zlib'
|
|
@@ -35,7 +36,7 @@ module OpenTelemetry
|
|
|
35
36
|
|
|
36
37
|
DEFAULT_USER_AGENT = "OTel-OTLP-Exporter-Ruby/#{OpenTelemetry::Exporter::OTLP::VERSION} Ruby/#{RUBY_VERSION} (#{RUBY_PLATFORM}; #{RUBY_ENGINE}/#{RUBY_ENGINE_VERSION})".freeze
|
|
37
38
|
|
|
38
|
-
# rubocop:disable Lint/DuplicateBranch
|
|
39
|
+
# rubocop:disable-next Lint/DuplicateBranch
|
|
39
40
|
def self.ssl_verify_mode
|
|
40
41
|
if ENV.key?('OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER')
|
|
41
42
|
OpenSSL::SSL::VERIFY_PEER
|
|
@@ -45,7 +46,6 @@ module OpenTelemetry
|
|
|
45
46
|
OpenSSL::SSL::VERIFY_PEER
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
|
-
# rubocop:enable Lint/DuplicateBranch
|
|
49
49
|
|
|
50
50
|
def initialize(endpoint: nil,
|
|
51
51
|
certificate_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
|
|
@@ -53,13 +53,12 @@ module OpenTelemetry
|
|
|
53
53
|
client_key_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY', 'OTEL_EXPORTER_OTLP_CLIENT_KEY'),
|
|
54
54
|
ssl_verify_mode: Exporter.ssl_verify_mode,
|
|
55
55
|
headers: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
|
|
56
|
-
compression: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION', default: '
|
|
56
|
+
compression: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION', default: 'none'),
|
|
57
57
|
timeout: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
|
|
58
58
|
metrics_reporter: nil)
|
|
59
|
-
@uri = prepare_endpoint(endpoint)
|
|
60
|
-
|
|
61
59
|
raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || %w[gzip none].include?(compression)
|
|
62
60
|
|
|
61
|
+
@uri = OpenTelemetry::Exporter::OTLP::Common::Utilities.build_uri(endpoint, 'v1/traces', 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318/')
|
|
63
62
|
@http = http_connection(@uri, ssl_verify_mode, certificate_file, client_certificate_file, client_key_file)
|
|
64
63
|
|
|
65
64
|
@path = @uri.path
|
|
@@ -105,26 +104,6 @@ module OpenTelemetry
|
|
|
105
104
|
|
|
106
105
|
private
|
|
107
106
|
|
|
108
|
-
# Builds span flags based on whether the parent span context is remote.
|
|
109
|
-
# This follows the OTLP specification for span flags.
|
|
110
|
-
def build_span_flags(parent_span_is_remote, base_flags)
|
|
111
|
-
# Extract integer value from TraceFlags object if needed
|
|
112
|
-
# Derive the low 8-bit W3C trace flags using the public API.
|
|
113
|
-
base_flags_int =
|
|
114
|
-
if base_flags.sampled?
|
|
115
|
-
1
|
|
116
|
-
else
|
|
117
|
-
0
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
has_remote_mask = Opentelemetry::Proto::Trace::V1::SpanFlags::SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK
|
|
121
|
-
is_remote_mask = Opentelemetry::Proto::Trace::V1::SpanFlags::SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK
|
|
122
|
-
|
|
123
|
-
flags = base_flags_int | has_remote_mask
|
|
124
|
-
flags |= is_remote_mask if parent_span_is_remote
|
|
125
|
-
flags
|
|
126
|
-
end
|
|
127
|
-
|
|
128
107
|
def http_connection(uri, ssl_verify_mode, certificate_file, client_certificate_file, client_key_file)
|
|
129
108
|
http = Net::HTTP.new(uri.hostname, uri.port)
|
|
130
109
|
http.use_ssl = uri.scheme == 'https'
|
|
@@ -293,32 +272,9 @@ module OpenTelemetry
|
|
|
293
272
|
true
|
|
294
273
|
end
|
|
295
274
|
|
|
296
|
-
def encode(span_data)
|
|
275
|
+
def encode(span_data)
|
|
297
276
|
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
298
|
-
|
|
299
|
-
Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.new(
|
|
300
|
-
resource_spans: span_data
|
|
301
|
-
.group_by(&:resource)
|
|
302
|
-
.map do |resource, span_datas|
|
|
303
|
-
Opentelemetry::Proto::Trace::V1::ResourceSpans.new(
|
|
304
|
-
resource: Opentelemetry::Proto::Resource::V1::Resource.new(
|
|
305
|
-
attributes: resource.attribute_enumerator.map { |key, value| as_otlp_key_value(key, value) }
|
|
306
|
-
),
|
|
307
|
-
scope_spans: span_datas
|
|
308
|
-
.group_by(&:instrumentation_scope)
|
|
309
|
-
.map do |il, sds|
|
|
310
|
-
Opentelemetry::Proto::Trace::V1::ScopeSpans.new(
|
|
311
|
-
scope: Opentelemetry::Proto::Common::V1::InstrumentationScope.new(
|
|
312
|
-
name: il.name,
|
|
313
|
-
version: il.version
|
|
314
|
-
),
|
|
315
|
-
spans: sds.map { |sd| as_otlp_span(sd) }
|
|
316
|
-
)
|
|
317
|
-
end
|
|
318
|
-
)
|
|
319
|
-
end
|
|
320
|
-
)
|
|
321
|
-
)
|
|
277
|
+
OpenTelemetry::Exporter::OTLP::Common.as_encoded_etsr(span_data)
|
|
322
278
|
rescue StandardError => e
|
|
323
279
|
OpenTelemetry.handle_error(exception: e, message: 'unexpected error in OTLP::Exporter#encode')
|
|
324
280
|
nil
|
|
@@ -329,108 +285,6 @@ module OpenTelemetry
|
|
|
329
285
|
value: duration_ms)
|
|
330
286
|
end
|
|
331
287
|
|
|
332
|
-
def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
333
|
-
Opentelemetry::Proto::Trace::V1::Span.new(
|
|
334
|
-
trace_id: span_data.trace_id,
|
|
335
|
-
span_id: span_data.span_id,
|
|
336
|
-
trace_state: span_data.tracestate.to_s,
|
|
337
|
-
parent_span_id: span_data.parent_span_id == OpenTelemetry::Trace::INVALID_SPAN_ID ? nil : span_data.parent_span_id,
|
|
338
|
-
name: span_data.name,
|
|
339
|
-
kind: as_otlp_span_kind(span_data.kind),
|
|
340
|
-
start_time_unix_nano: span_data.start_timestamp,
|
|
341
|
-
end_time_unix_nano: span_data.end_timestamp,
|
|
342
|
-
attributes: span_data.attributes&.map { |k, v| as_otlp_key_value(k, v) },
|
|
343
|
-
dropped_attributes_count: span_data.total_recorded_attributes - span_data.attributes&.size.to_i,
|
|
344
|
-
events: span_data.events&.map do |event|
|
|
345
|
-
Opentelemetry::Proto::Trace::V1::Span::Event.new(
|
|
346
|
-
time_unix_nano: event.timestamp,
|
|
347
|
-
name: event.name,
|
|
348
|
-
attributes: event.attributes&.map { |k, v| as_otlp_key_value(k, v) }
|
|
349
|
-
# TODO: track dropped_attributes_count in Span#append_event
|
|
350
|
-
)
|
|
351
|
-
end,
|
|
352
|
-
dropped_events_count: span_data.total_recorded_events - span_data.events&.size.to_i,
|
|
353
|
-
links: span_data.links&.map do |link|
|
|
354
|
-
Opentelemetry::Proto::Trace::V1::Span::Link.new(
|
|
355
|
-
trace_id: link.span_context.trace_id,
|
|
356
|
-
span_id: link.span_context.span_id,
|
|
357
|
-
trace_state: link.span_context.tracestate.to_s,
|
|
358
|
-
attributes: link.attributes&.map { |k, v| as_otlp_key_value(k, v) },
|
|
359
|
-
# TODO: track dropped_attributes_count in Span#trim_links
|
|
360
|
-
flags: build_span_flags(link.span_context.remote?, link.span_context.trace_flags)
|
|
361
|
-
)
|
|
362
|
-
end,
|
|
363
|
-
dropped_links_count: span_data.total_recorded_links - span_data.links&.size.to_i,
|
|
364
|
-
status: span_data.status&.then do |status|
|
|
365
|
-
Opentelemetry::Proto::Trace::V1::Status.new(
|
|
366
|
-
code: as_otlp_status_code(status.code),
|
|
367
|
-
message: status.description
|
|
368
|
-
)
|
|
369
|
-
end,
|
|
370
|
-
flags: build_span_flags(span_data.parent_span_is_remote, span_data.trace_flags)
|
|
371
|
-
)
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
def as_otlp_status_code(code)
|
|
375
|
-
case code
|
|
376
|
-
when OpenTelemetry::Trace::Status::OK then Opentelemetry::Proto::Trace::V1::Status::StatusCode::STATUS_CODE_OK
|
|
377
|
-
when OpenTelemetry::Trace::Status::ERROR then Opentelemetry::Proto::Trace::V1::Status::StatusCode::STATUS_CODE_ERROR
|
|
378
|
-
else Opentelemetry::Proto::Trace::V1::Status::StatusCode::STATUS_CODE_UNSET
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
def as_otlp_span_kind(kind)
|
|
383
|
-
case kind
|
|
384
|
-
when :internal then Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_INTERNAL
|
|
385
|
-
when :server then Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_SERVER
|
|
386
|
-
when :client then Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_CLIENT
|
|
387
|
-
when :producer then Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_PRODUCER
|
|
388
|
-
when :consumer then Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_CONSUMER
|
|
389
|
-
else Opentelemetry::Proto::Trace::V1::Span::SpanKind::SPAN_KIND_UNSPECIFIED
|
|
390
|
-
end
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
def as_otlp_key_value(key, value)
|
|
394
|
-
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value(value))
|
|
395
|
-
rescue Encoding::UndefinedConversionError => e
|
|
396
|
-
encoded_value = value.encode('UTF-8', invalid: :replace, undef: :replace, replace: '�')
|
|
397
|
-
OpenTelemetry.handle_error(exception: e, message: "encoding error for key #{key} and value #{encoded_value}")
|
|
398
|
-
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value('Encoding Error'))
|
|
399
|
-
end
|
|
400
|
-
|
|
401
|
-
def as_otlp_any_value(value)
|
|
402
|
-
result = Opentelemetry::Proto::Common::V1::AnyValue.new
|
|
403
|
-
case value
|
|
404
|
-
when String
|
|
405
|
-
result.string_value = value
|
|
406
|
-
when Integer
|
|
407
|
-
result.int_value = value
|
|
408
|
-
when Float
|
|
409
|
-
result.double_value = value
|
|
410
|
-
when true, false
|
|
411
|
-
result.bool_value = value
|
|
412
|
-
when Array
|
|
413
|
-
values = value.map { |element| as_otlp_any_value(element) }
|
|
414
|
-
result.array_value = Opentelemetry::Proto::Common::V1::ArrayValue.new(values: values)
|
|
415
|
-
end
|
|
416
|
-
result
|
|
417
|
-
end
|
|
418
|
-
|
|
419
|
-
def prepare_endpoint(endpoint)
|
|
420
|
-
endpoint ||= ENV.fetch('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', nil)
|
|
421
|
-
if endpoint.nil?
|
|
422
|
-
endpoint = ENV['OTEL_EXPORTER_OTLP_ENDPOINT'] || 'http://localhost:4318'
|
|
423
|
-
endpoint += '/' unless endpoint.end_with?('/')
|
|
424
|
-
URI.join(endpoint, 'v1/traces')
|
|
425
|
-
elsif endpoint.strip.empty?
|
|
426
|
-
raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}"
|
|
427
|
-
else
|
|
428
|
-
URI(endpoint)
|
|
429
|
-
end
|
|
430
|
-
rescue URI::InvalidURIError
|
|
431
|
-
raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}"
|
|
432
|
-
end
|
|
433
|
-
|
|
434
288
|
def prepare_headers(config_headers)
|
|
435
289
|
headers = case config_headers
|
|
436
290
|
when String then parse_headers(config_headers)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-exporter-otlp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.37.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -65,6 +65,20 @@ dependencies:
|
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '0.20'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: opentelemetry-exporter-otlp-common
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0.2'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.2'
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
83
|
name: opentelemetry-sdk
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,10 +136,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
|
122
136
|
licenses:
|
|
123
137
|
- Apache-2.0
|
|
124
138
|
metadata:
|
|
125
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp/0.
|
|
126
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-exporter-otlp/v0.
|
|
139
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp/0.37.0/file/CHANGELOG.md
|
|
140
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-exporter-otlp/v0.37.0/exporter/otlp
|
|
127
141
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
|
128
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp/0.
|
|
142
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp/0.37.0
|
|
129
143
|
rdoc_options: []
|
|
130
144
|
require_paths:
|
|
131
145
|
- lib
|
|
@@ -140,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
154
|
- !ruby/object:Gem::Version
|
|
141
155
|
version: '0'
|
|
142
156
|
requirements: []
|
|
143
|
-
rubygems_version: 4.0.
|
|
157
|
+
rubygems_version: 4.0.20
|
|
144
158
|
specification_version: 4
|
|
145
159
|
summary: OTLP exporter for the OpenTelemetry framework
|
|
146
160
|
test_files: []
|