opentelemetry-exporter-otlp 0.9.0 → 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 +30 -0
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/lib/opentelemetry/exporter/otlp/exporter.rb +43 -26
- data/lib/opentelemetry/exporter/otlp/version.rb +2 -2
- metadata +13 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fbf898ad6ec63bdad04f4d2d16831be09d77c0b623c68b57db924853c193d3c
|
4
|
+
data.tar.gz: 6546ffa54907ff60781d1c4b2e51ceb0e3bf62046e813e820e0de1f807b32a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc956ce9f389366057f4dc13bc1de3a66bdde83c2238ee0aa4a87fd362d2834b6e2e6dcf73e95f1218328a49404b4e19fd6aff9b18ef46a2369b9b6db3a3d2af
|
7
|
+
data.tar.gz: ff4058399c35eb0092fb707a34c8cf189a135da3a0d7cc038be243413cd8c9a8100203e614b8a31042b461f961b29ab3a7558af9693c488f41606bb27af16895
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Release History: opentelemetry-exporter-otlp
|
2
2
|
|
3
|
+
### v0.13.0 / 2021-01-29
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Spec compliance for OTLP exporter
|
6
|
+
|
7
|
+
* ADDED: Add untraced wrapper to common utils
|
8
|
+
* FIXED: Spec compliance for OTLP exporter
|
9
|
+
* FIXED: Conditionally append path to collector endpoint
|
10
|
+
* FIXED: OTLP path should be /v1/traces
|
11
|
+
* FIXED: Rename OTLP env vars SPAN -> TRACES
|
12
|
+
|
13
|
+
### v0.12.1 / 2021-01-13
|
14
|
+
|
15
|
+
* FIXED: Updated protobuf version dependency
|
16
|
+
|
17
|
+
### v0.12.0 / 2020-12-24
|
18
|
+
|
19
|
+
* (No significant changes)
|
20
|
+
|
21
|
+
### v0.11.0 / 2020-12-11
|
22
|
+
|
23
|
+
* BREAKING CHANGE: Implement tracestate
|
24
|
+
|
25
|
+
* ADDED: Implement tracestate
|
26
|
+
* ADDED: Metrics reporting from trace export
|
27
|
+
* FIXED: Copyright comments to not reference year
|
28
|
+
|
29
|
+
### v0.10.0 / 2020-12-03
|
30
|
+
|
31
|
+
* (No significant changes)
|
32
|
+
|
3
33
|
### v0.9.0 / 2020-11-27
|
4
34
|
|
5
35
|
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
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/README.md
CHANGED
@@ -40,7 +40,7 @@ OpenTelemetry::SDK.configure do |c|
|
|
40
40
|
c.add_span_processor(
|
41
41
|
OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
|
42
42
|
exporter: OpenTelemetry::Exporter::OTLP::Exporter.new(
|
43
|
-
|
43
|
+
endpoint: 'http://localhost:55680'
|
44
44
|
)
|
45
45
|
)
|
46
46
|
)
|
@@ -80,8 +80,8 @@ The `opentelemetry-exporter-otlp` gem is distributed under the Apache 2.0 licens
|
|
80
80
|
[opentelemetry-home]: https://opentelemetry.io
|
81
81
|
[bundler-home]: https://bundler.io
|
82
82
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
83
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
84
|
-
[examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
83
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
84
|
+
[examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/examples
|
85
85
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
86
86
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
87
87
|
[ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
|
@@ -31,29 +31,35 @@ module OpenTelemetry
|
|
31
31
|
WRITE_TIMEOUT_SUPPORTED = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6')
|
32
32
|
private_constant(:KEEP_ALIVE_TIMEOUT, :RETRY_COUNT, :WRITE_TIMEOUT_SUPPORTED)
|
33
33
|
|
34
|
-
def initialize(endpoint: config_opt('
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?(
|
34
|
+
def initialize(endpoint: config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'https://localhost:4317/v1/traces'), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
35
|
+
certificate_file: config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
|
36
|
+
headers: config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS'),
|
37
|
+
compression: config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION'),
|
38
|
+
timeout: config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
|
39
|
+
metrics_reporter: nil)
|
40
|
+
raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?(endpoint)
|
41
41
|
raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || compression == 'gzip'
|
42
|
-
raise ArgumentError, 'headers must be comma-separated k
|
42
|
+
raise ArgumentError, 'headers must be comma-separated k=v pairs or a Hash' unless valid_headers?(headers)
|
43
|
+
|
44
|
+
uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
|
45
|
+
URI("#{endpoint}/v1/traces")
|
46
|
+
else
|
47
|
+
URI(endpoint)
|
48
|
+
end
|
43
49
|
|
44
|
-
uri = URI "http://#{endpoint}"
|
45
50
|
@http = Net::HTTP.new(uri.host, uri.port)
|
46
|
-
@http.use_ssl =
|
51
|
+
@http.use_ssl = uri.scheme == 'https'
|
47
52
|
@http.ca_file = certificate_file unless certificate_file.nil?
|
48
53
|
@http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT
|
49
54
|
|
50
55
|
@path = uri.path
|
51
56
|
@headers = case headers
|
52
|
-
when String then CSV.parse(headers, col_sep: '
|
57
|
+
when String then CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
|
53
58
|
when Hash then headers
|
54
59
|
end
|
55
|
-
@timeout = timeout.to_f
|
60
|
+
@timeout = timeout.to_f
|
56
61
|
@compression = compression
|
62
|
+
@metrics_reporter = metrics_reporter || OpenTelemetry::SDK::Trace::Export::MetricsReporter
|
57
63
|
|
58
64
|
@shutdown = false
|
59
65
|
end
|
@@ -95,7 +101,7 @@ module OpenTelemetry
|
|
95
101
|
return true if headers.nil? || headers.is_a?(Hash)
|
96
102
|
return false unless headers.is_a?(String)
|
97
103
|
|
98
|
-
CSV.parse(headers, col_sep: '
|
104
|
+
CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
|
99
105
|
true
|
100
106
|
rescue ArgumentError
|
101
107
|
false
|
@@ -104,8 +110,8 @@ module OpenTelemetry
|
|
104
110
|
def invalid_url?(url)
|
105
111
|
return true if url.nil? || url.strip.empty?
|
106
112
|
|
107
|
-
|
108
|
-
|
113
|
+
URI(url)
|
114
|
+
false
|
109
115
|
rescue URI::InvalidURIError
|
110
116
|
true
|
111
117
|
end
|
@@ -114,7 +120,7 @@ module OpenTelemetry
|
|
114
120
|
retry_count = 0
|
115
121
|
timeout ||= @timeout
|
116
122
|
start_time = Time.now
|
117
|
-
untraced do # rubocop:disable Metrics/BlockLength
|
123
|
+
OpenTelemetry::Common::Utilities.untraced do # rubocop:disable Metrics/BlockLength
|
118
124
|
request = Net::HTTP::Post.new(@path)
|
119
125
|
request.body = if @compression == 'gzip'
|
120
126
|
request.add_field('Content-Encoding', 'gzip')
|
@@ -132,7 +138,7 @@ module OpenTelemetry
|
|
132
138
|
@http.read_timeout = remaining_timeout
|
133
139
|
@http.write_timeout = remaining_timeout if WRITE_TIMEOUT_SUPPORTED
|
134
140
|
@http.start unless @http.started?
|
135
|
-
response = @http.request(request)
|
141
|
+
response = measure_request_duration { @http.request(request) }
|
136
142
|
|
137
143
|
case response
|
138
144
|
when Net::HTTPOK
|
@@ -140,11 +146,11 @@ module OpenTelemetry
|
|
140
146
|
SUCCESS
|
141
147
|
when Net::HTTPServiceUnavailable, Net::HTTPTooManyRequests
|
142
148
|
response.body # Read and discard body
|
143
|
-
redo if backoff?(retry_after: response['Retry-After'], retry_count: retry_count += 1)
|
149
|
+
redo if backoff?(retry_after: response['Retry-After'], retry_count: retry_count += 1, reason: response.code)
|
144
150
|
FAILURE
|
145
151
|
when Net::HTTPRequestTimeOut, Net::HTTPGatewayTimeOut, Net::HTTPBadGateway
|
146
152
|
response.body # Read and discard body
|
147
|
-
redo if backoff?(retry_count: retry_count += 1)
|
153
|
+
redo if backoff?(retry_count: retry_count += 1, reason: response.code)
|
148
154
|
FAILURE
|
149
155
|
when Net::HTTPBadRequest, Net::HTTPClientError, Net::HTTPServerError
|
150
156
|
# TODO: decode the body as a google.rpc.Status Protobuf-encoded message when https://github.com/open-telemetry/opentelemetry-collector/issues/1357 is fixed.
|
@@ -153,13 +159,13 @@ module OpenTelemetry
|
|
153
159
|
when Net::HTTPRedirection
|
154
160
|
@http.finish
|
155
161
|
handle_redirect(response['location'])
|
156
|
-
redo if backoff?(retry_after: 0, retry_count: retry_count += 1)
|
162
|
+
redo if backoff?(retry_after: 0, retry_count: retry_count += 1, reason: response.code)
|
157
163
|
else
|
158
164
|
@http.finish
|
159
165
|
FAILURE
|
160
166
|
end
|
161
167
|
rescue Net::OpenTimeout, Net::ReadTimeout
|
162
|
-
retry if backoff?(retry_count: retry_count += 1)
|
168
|
+
retry if backoff?(retry_count: retry_count += 1, reason: 'timeout')
|
163
169
|
return FAILURE
|
164
170
|
end
|
165
171
|
ensure
|
@@ -173,13 +179,24 @@ module OpenTelemetry
|
|
173
179
|
# TODO: figure out destination and reinitialize @http and @path
|
174
180
|
end
|
175
181
|
|
176
|
-
def
|
177
|
-
|
182
|
+
def measure_request_duration
|
183
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
184
|
+
begin
|
185
|
+
response = yield
|
186
|
+
ensure
|
187
|
+
stop = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
188
|
+
duration_ms = 1000.0 * (stop - start)
|
189
|
+
@metrics_reporter.record_value('otel.otlp_exporter.request_duration',
|
190
|
+
value: duration_ms,
|
191
|
+
labels: { 'status' => response&.code || 'unknown' })
|
192
|
+
end
|
178
193
|
end
|
179
194
|
|
180
|
-
def backoff?(retry_after: nil, retry_count:)
|
195
|
+
def backoff?(retry_after: nil, retry_count:, reason:)
|
181
196
|
return false if retry_count > RETRY_COUNT
|
182
197
|
|
198
|
+
@metrics_reporter.add_to_counter('otel.otlp_exporter.failure', labels: { 'reason' => reason })
|
199
|
+
|
183
200
|
sleep_interval = nil
|
184
201
|
unless retry_after.nil?
|
185
202
|
sleep_interval =
|
@@ -233,7 +250,7 @@ module OpenTelemetry
|
|
233
250
|
Opentelemetry::Proto::Trace::V1::Span.new(
|
234
251
|
trace_id: span_data.trace_id,
|
235
252
|
span_id: span_data.span_id,
|
236
|
-
trace_state: span_data.tracestate,
|
253
|
+
trace_state: span_data.tracestate.to_s,
|
237
254
|
parent_span_id: span_data.parent_span_id == OpenTelemetry::Trace::INVALID_SPAN_ID ? nil : span_data.parent_span_id,
|
238
255
|
name: span_data.name,
|
239
256
|
kind: as_otlp_span_kind(span_data.kind),
|
@@ -254,7 +271,7 @@ module OpenTelemetry
|
|
254
271
|
Opentelemetry::Proto::Trace::V1::Span::Link.new(
|
255
272
|
trace_id: link.span_context.trace_id,
|
256
273
|
span_id: link.span_context.span_id,
|
257
|
-
trace_state: link.span_context.tracestate,
|
274
|
+
trace_state: link.span_context.tracestate.to_s,
|
258
275
|
attributes: link.attributes&.map { |k, v| as_otlp_key_value(k, v) }
|
259
276
|
# TODO: track dropped_attributes_count in Span#trim_links
|
260
277
|
)
|
@@ -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
|
|
@@ -8,7 +8,7 @@ module OpenTelemetry
|
|
8
8
|
module Exporter
|
9
9
|
module OTLP
|
10
10
|
## Current OpenTelemetry OTLP exporter version
|
11
|
-
VERSION = '0.
|
11
|
+
VERSION = '0.13.0'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,63 +1,57 @@
|
|
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.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:
|
11
|
+
date: 2021-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.4.1.1
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
19
|
+
version: '3.7'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.4.1.1
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
26
|
+
version: '3.7'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: opentelemetry-api
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
33
|
+
version: 0.13.0
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
40
|
+
version: 0.13.0
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: opentelemetry-common
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
47
|
+
version: 0.13.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
54
|
+
version: 0.13.0
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: bundler
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,10 +201,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
207
201
|
licenses:
|
208
202
|
- Apache-2.0
|
209
203
|
metadata:
|
210
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.
|
211
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
204
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.13.0/file.CHANGELOG.html
|
205
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp
|
212
206
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
213
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.
|
207
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.13.0
|
214
208
|
post_install_message:
|
215
209
|
rdoc_options: []
|
216
210
|
require_paths:
|