opentelemetry-exporter-otlp-common 0.2.0 → 0.3.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc61abf6f06d4f015bbac4b02d92ba48882d9b1893f120dead8e1eba6b9265f8
|
|
4
|
+
data.tar.gz: 9a96e3ee82f013270d5f4883b44e760023141556aeebfb29b989cb716218983f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e558088072666371f19014f89e2913f6c22dd6112285905dc4768896ca82425e4646072e1a7e950abd27a0cb92907ad50013384345e81a024a59d9a540c144ac
|
|
7
|
+
data.tar.gz: 12993bec531fd7a0f00c2b2fd0bde9badc76fe4e8c8d046e0b8f44ac29187d103e7344c9ad067a5ed00c55fd0002e1dc09b85e30cc5475efe28432b632a2c1ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History: opentelemetry-exporter-otlp-common
|
|
2
2
|
|
|
3
|
+
### v0.3.0 / 2026-09-29
|
|
4
|
+
|
|
5
|
+
* ADDED: Move otlp exporter uri builder to common (#2240)
|
|
6
|
+
* FIXED: Normalize UTF-8 attribute strings (#2259)
|
|
7
|
+
|
|
3
8
|
### v0.2.0 / 2026-09-03
|
|
4
9
|
|
|
5
10
|
* ADDED: Support InstrumentationScope, and update OTLP proto to 0.18.0 (#1345)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright The OpenTelemetry Authors
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
require 'opentelemetry/common'
|
|
8
|
+
|
|
9
|
+
module OpenTelemetry
|
|
10
|
+
module Exporter
|
|
11
|
+
module OTLP
|
|
12
|
+
module Common
|
|
13
|
+
# Contains common utilities used by the otlp exporters
|
|
14
|
+
module Utilities
|
|
15
|
+
extend self
|
|
16
|
+
|
|
17
|
+
# Builds a url using the endpoint defined and if not present uses the configured sources
|
|
18
|
+
def build_uri(endpoint, path = '', primary_src = '', secondary_src = 'OTEL_EXPORTER_OTLP_ENDPOINT', default = 'http://localhost:4318/')
|
|
19
|
+
endpoint ||= ENV.fetch(primary_src, nil)
|
|
20
|
+
raise ArgumentError, "invalid url for OTLPExporter #{endpoint} set via #{primary_src}" unless endpoint.nil? || OpenTelemetry::Common::Utilities.valid_url?(endpoint)
|
|
21
|
+
|
|
22
|
+
if endpoint.nil?
|
|
23
|
+
endpoint = ENV.fetch(secondary_src, default)
|
|
24
|
+
raise ArgumentError, "invalid url for OTLPExporter #{endpoint} set via #{secondary_src}" unless OpenTelemetry::Common::Utilities.valid_url?(endpoint)
|
|
25
|
+
|
|
26
|
+
endpoint += '/' unless endpoint.end_with?('/')
|
|
27
|
+
URI.join(endpoint, path)
|
|
28
|
+
else
|
|
29
|
+
URI(endpoint)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
|
|
7
7
|
require 'opentelemetry'
|
|
8
|
+
require 'opentelemetry/common'
|
|
9
|
+
require 'opentelemetry/exporter/otlp/common/utilities'
|
|
8
10
|
require 'opentelemetry/exporter/otlp/common/version'
|
|
9
11
|
|
|
10
12
|
require 'google/rpc/status_pb'
|
|
@@ -70,7 +72,7 @@ module OpenTelemetry
|
|
|
70
72
|
|
|
71
73
|
private
|
|
72
74
|
|
|
73
|
-
def as_otlp_span(span_data)
|
|
75
|
+
def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength
|
|
74
76
|
Opentelemetry::Proto::Trace::V1::Span.new(
|
|
75
77
|
trace_id: span_data.trace_id,
|
|
76
78
|
span_id: span_data.span_id,
|
|
@@ -96,8 +98,9 @@ module OpenTelemetry
|
|
|
96
98
|
trace_id: link.span_context.trace_id,
|
|
97
99
|
span_id: link.span_context.span_id,
|
|
98
100
|
trace_state: link.span_context.tracestate.to_s,
|
|
99
|
-
attributes: link.attributes&.map { |k, v| as_otlp_key_value(k, v) }
|
|
101
|
+
attributes: link.attributes&.map { |k, v| as_otlp_key_value(k, v) },
|
|
100
102
|
# TODO: track dropped_attributes_count in Span#trim_links
|
|
103
|
+
flags: build_span_flags(link.span_context.remote?, link.span_context.trace_flags)
|
|
101
104
|
)
|
|
102
105
|
end,
|
|
103
106
|
dropped_links_count: span_data.total_recorded_links - span_data.links&.size.to_i,
|
|
@@ -106,10 +109,31 @@ module OpenTelemetry
|
|
|
106
109
|
code: as_otlp_status_code(status.code),
|
|
107
110
|
message: status.description
|
|
108
111
|
)
|
|
109
|
-
end
|
|
112
|
+
end,
|
|
113
|
+
flags: build_span_flags(span_data.parent_span_is_remote, span_data.trace_flags)
|
|
110
114
|
)
|
|
111
115
|
end
|
|
112
116
|
|
|
117
|
+
# Builds span flags based on whether the parent span context is remote.
|
|
118
|
+
# This follows the OTLP specification for span flags.
|
|
119
|
+
def build_span_flags(parent_span_is_remote, base_flags)
|
|
120
|
+
# Extract integer value from TraceFlags object if needed
|
|
121
|
+
# Derive the low 8-bit W3C trace flags using the public API.
|
|
122
|
+
base_flags_int =
|
|
123
|
+
if base_flags.sampled?
|
|
124
|
+
1
|
|
125
|
+
else
|
|
126
|
+
0
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
has_remote_mask = Opentelemetry::Proto::Trace::V1::SpanFlags::SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK
|
|
130
|
+
is_remote_mask = Opentelemetry::Proto::Trace::V1::SpanFlags::SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK
|
|
131
|
+
|
|
132
|
+
flags = base_flags_int | has_remote_mask
|
|
133
|
+
flags |= is_remote_mask if parent_span_is_remote
|
|
134
|
+
flags
|
|
135
|
+
end
|
|
136
|
+
|
|
113
137
|
def as_otlp_status_code(code)
|
|
114
138
|
case code
|
|
115
139
|
when OpenTelemetry::Trace::Status::OK then Opentelemetry::Proto::Trace::V1::Status::StatusCode::STATUS_CODE_OK
|
|
@@ -130,9 +154,10 @@ module OpenTelemetry
|
|
|
130
154
|
end
|
|
131
155
|
|
|
132
156
|
def as_otlp_key_value(key, value)
|
|
157
|
+
key = OpenTelemetry::Common::Utilities.utf8_encode(key, placeholder: 'Encoding Error')
|
|
133
158
|
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value(value))
|
|
134
159
|
rescue Encoding::UndefinedConversionError => e
|
|
135
|
-
encoded_value = value.encode('UTF-8', invalid: :replace, undef: :replace, replace: '�')
|
|
160
|
+
encoded_value = value.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '�')
|
|
136
161
|
OpenTelemetry.handle_error(exception: e, message: "encoding error for key #{key} and value #{encoded_value}")
|
|
137
162
|
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value('Encoding Error'))
|
|
138
163
|
end
|
|
@@ -141,7 +166,7 @@ module OpenTelemetry
|
|
|
141
166
|
result = Opentelemetry::Proto::Common::V1::AnyValue.new
|
|
142
167
|
case value
|
|
143
168
|
when String
|
|
144
|
-
result.string_value = value
|
|
169
|
+
result.string_value = OpenTelemetry::Common::Utilities.utf8_encode(value, placeholder: value)
|
|
145
170
|
when Integer
|
|
146
171
|
result.int_value = value
|
|
147
172
|
when Float
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-exporter-otlp-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -51,6 +51,20 @@ dependencies:
|
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '1.1'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: opentelemetry-common
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0.20'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.20'
|
|
54
68
|
description: Common functionality for the OTLP exporters
|
|
55
69
|
email:
|
|
56
70
|
- cncf-opentelemetry-contributors@lists.cncf.io
|
|
@@ -64,6 +78,7 @@ files:
|
|
|
64
78
|
- README.md
|
|
65
79
|
- lib/opentelemetry-exporter-otlp-common.rb
|
|
66
80
|
- lib/opentelemetry/exporter/otlp/common.rb
|
|
81
|
+
- lib/opentelemetry/exporter/otlp/common/utilities.rb
|
|
67
82
|
- lib/opentelemetry/exporter/otlp/common/version.rb
|
|
68
83
|
- lib/opentelemetry/proto/collector/logs/v1/logs_service_pb.rb
|
|
69
84
|
- lib/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.rb
|
|
@@ -77,10 +92,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
|
77
92
|
licenses:
|
|
78
93
|
- Apache-2.0
|
|
79
94
|
metadata:
|
|
80
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp-common/0.
|
|
81
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-exporter-otlp-common/v0.
|
|
95
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp-common/0.3.0/file/CHANGELOG.md
|
|
96
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-exporter-otlp-common/v0.3.0/exporter/otlp-common
|
|
82
97
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
|
83
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp-common/0.
|
|
98
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-exporter-otlp-common/0.3.0
|
|
84
99
|
rdoc_options: []
|
|
85
100
|
require_paths:
|
|
86
101
|
- lib
|
|
@@ -95,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
110
|
- !ruby/object:Gem::Version
|
|
96
111
|
version: '0'
|
|
97
112
|
requirements: []
|
|
98
|
-
rubygems_version: 4.0.
|
|
113
|
+
rubygems_version: 4.0.20
|
|
99
114
|
specification_version: 4
|
|
100
115
|
summary: Common functionality for the OTLP exporters
|
|
101
116
|
test_files: []
|