opentelemetry-exporter-otlp 0.14.0 → 0.19.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: 34a61cff86886f8c7f613a563002bc1259278565cb95dfb5cc445790d17ddc0d
4
- data.tar.gz: faa25394d4f4124c9a30dcf1d3b7b278c58642f6f3ac9182c04f19f8952767ec
3
+ metadata.gz: bf50130d2b4ab1fb492992a5b468988d1bbb404847f94820e46bd73b3beb9a25
4
+ data.tar.gz: dd4d624818f79259fe10c307e64441382d1e98e5304d89cf4ffac3d9290a42f2
5
5
  SHA512:
6
- metadata.gz: 447e268c0a5c7e68d41a1686d8a9567e5de4eca855fcbdd45c1a3b98ff4dee7dff1988a4acb9915d53c0aa43ff46d31f2167405b1d8b8d1eac300484c2c96660
7
- data.tar.gz: 37cd86ddea7a477a0f96b2050aacc39cd4e376c6983464069e177d54f34aa00ecb833b869afe04ba82f3de8ea35266a7c38ee27690e1fe530bdf27aac6555576
6
+ metadata.gz: e0f80a737f5afcde1670b73785043500eec3fbf7d6a37955485ed88b015a3d0dfef8ff52d4e6bc201b2b872bb3c2bf949edab618b4695296a139520486d1a546
7
+ data.tar.gz: 3c22ed15af7b272db9e09444af4aeeeea8ffedb19ec5fe7f35813ea357347166c6fc045820c1feb030f3901aa0520c047f858ee017a55d0d9726921d9c17d3d8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Release History: opentelemetry-exporter-otlp
2
2
 
3
+ ### v0.19.0 / 2021-06-03
4
+
5
+ * ADDED: Add a SSL verify mode option for the OTLP exporter
6
+ * FIXED: Handle OTLP exporter encoding exceptions
7
+ * DOCS: Remove the OTLP receiver legacy gRPC port(55680) references
8
+
9
+ ### v0.18.0 / 2021-05-21
10
+
11
+ * BREAKING CHANGE: Replace Time.now with Process.clock_gettime
12
+
13
+ * FIXED: Replace Time.now with Process.clock_gettime
14
+ * FIXED: Rescue missed otlp exporter network errors
15
+
16
+ ### v0.17.0 / 2021-04-22
17
+
18
+ * ADDED: Add zipkin exporter
19
+
20
+ ### v0.16.0 / 2021-03-17
21
+
22
+ * BREAKING CHANGE: Implement Exporter#force_flush
23
+
24
+ * ADDED: Implement Exporter#force_flush
25
+ * FIXED: Rescue socket err in otlp exporter to prevent failures unable to connect
26
+ * DOCS: Replace Gitter with GitHub Discussions
27
+
28
+ ### v0.15.0 / 2021-02-18
29
+
30
+ * BREAKING CHANGE: Streamline processor pipeline
31
+
32
+ * ADDED: Add otlp exporter hooks
33
+ * FIXED: Streamline processor pipeline
34
+
3
35
  ### v0.14.0 / 2021-02-03
4
36
 
5
37
  * (No significant changes)
data/README.md CHANGED
@@ -39,8 +39,8 @@ require 'opentelemetry/exporter/otlp'
39
39
  OpenTelemetry::SDK.configure do |c|
40
40
  c.add_span_processor(
41
41
  OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
42
- exporter: OpenTelemetry::Exporter::OTLP::Exporter.new(
43
- endpoint: 'http://localhost:55680'
42
+ OpenTelemetry::Exporter::OTLP::Exporter.new(
43
+ compression: 'gzip'
44
44
  )
45
45
  )
46
46
  )
@@ -65,11 +65,27 @@ end
65
65
 
66
66
  For additional examples, see the [examples on github][examples-github].
67
67
 
68
+ ## How can I configure the OTLP exporter?
69
+
70
+ The collector exporter can be configured explicitly in code, as shown above, or via environment variables. The configuration parameters, environment variables, and defaults are shown below.
71
+
72
+ | Parameter | Environment variable | Default |
73
+ | ------------------- | -------------------------------------------- | ----------------------------------- |
74
+ | `endpoint:` | `OTEL_EXPORTER_OTLP_ENDPOINT` | `"http://localhost:4317/v1/traces"` |
75
+ | `certificate_file: `| `OTEL_EXPORTER_OTLP_CERTIFICATE` | |
76
+ | `headers:` | `OTEL_EXPORTER_OTLP_HEADERS` | |
77
+ | `compression:` | `OTEL_EXPORTER_OTLP_COMPRESSION` | |
78
+ | `timeout:` | `OTEL_EXPORTER_OTLP_TIMEOUT` | `10` |
79
+ | `ssl_verify_mode:` | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER` or | `OpenSSL::SSL:VERIFY_PEER` |
80
+ | | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_NONE` | |
81
+
82
+ `ssl_verify_mode:` parameter values should be flags for server certificate verification: `OpenSSL::SSL:VERIFY_PEER` and `OpenSSL::SSL:VERIFY_NONE` are acceptable. These values can also be set using the appropriately named environment variables as shown where `VERIFY_PEER` will take precedence over `VERIFY_NONE`. Please see [the Net::HTTP docs](https://ruby-doc.org/stdlib-2.5.1/libdoc/net/http/rdoc/Net/HTTP.html#verify_mode) for more information about these flags.
83
+
68
84
  ## How can I get involved?
69
85
 
70
86
  The `opentelemetry-exporter-otlp` gem source is [on github][repo-github], along with related gems including `opentelemetry-sdk`.
71
87
 
72
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
88
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
73
89
 
74
90
  ## License
75
91
 
@@ -84,4 +100,4 @@ The `opentelemetry-exporter-otlp` gem is distributed under the Apache 2.0 licens
84
100
  [examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/examples
85
101
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
86
102
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
87
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
103
+ [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -31,8 +31,19 @@ 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('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'https://localhost:4317/v1/traces'), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
34
+ def self.ssl_verify_mode
35
+ if ENV.key?('OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER')
36
+ OpenSSL::SSL::VERIFY_PEER
37
+ elsif ENV.key?('OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_NONE')
38
+ OpenSSL::SSL::VERIFY_NONE
39
+ else
40
+ OpenSSL::SSL::VERIFY_PEER
41
+ end
42
+ end
43
+
44
+ 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, Metrics/MethodLength
35
45
  certificate_file: config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
46
+ ssl_verify_mode: Exporter.ssl_verify_mode,
36
47
  headers: config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS'),
37
48
  compression: config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION'),
38
49
  timeout: config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
@@ -41,18 +52,19 @@ module OpenTelemetry
41
52
  raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || compression == 'gzip'
42
53
  raise ArgumentError, 'headers must be comma-separated k=v pairs or a Hash' unless valid_headers?(headers)
43
54
 
44
- uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
45
- URI("#{endpoint}/v1/traces")
46
- else
47
- URI(endpoint)
48
- end
55
+ @uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
56
+ URI("#{endpoint}/v1/traces")
57
+ else
58
+ URI(endpoint)
59
+ end
49
60
 
50
- @http = Net::HTTP.new(uri.host, uri.port)
51
- @http.use_ssl = uri.scheme == 'https'
61
+ @http = Net::HTTP.new(@uri.host, @uri.port)
62
+ @http.use_ssl = @uri.scheme == 'https'
63
+ @http.verify_mode = ssl_verify_mode
52
64
  @http.ca_file = certificate_file unless certificate_file.nil?
53
65
  @http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT
54
66
 
55
- @path = uri.path
67
+ @path = @uri.path
56
68
  @headers = case headers
57
69
  when String then CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
58
70
  when Hash then headers
@@ -60,7 +72,6 @@ module OpenTelemetry
60
72
  @timeout = timeout.to_f
61
73
  @compression = compression
62
74
  @metrics_reporter = metrics_reporter || OpenTelemetry::SDK::Trace::Export::MetricsReporter
63
-
64
75
  @shutdown = false
65
76
  end
66
77
 
@@ -77,14 +88,24 @@ module OpenTelemetry
77
88
  send_bytes(encode(span_data), timeout: timeout)
78
89
  end
79
90
 
80
- # Called when {OpenTelemetry::SDK::Trace::Tracer#shutdown} is called, if
81
- # this exporter is registered to a {OpenTelemetry::SDK::Trace::Tracer}
91
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#force_flush} is called, if
92
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
93
+ # object.
94
+ #
95
+ # @param [optional Numeric] timeout An optional timeout in seconds.
96
+ def force_flush(timeout: nil)
97
+ SUCCESS
98
+ end
99
+
100
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#shutdown} is called, if
101
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
82
102
  # object.
83
103
  #
84
104
  # @param [optional Numeric] timeout An optional timeout in seconds.
85
105
  def shutdown(timeout: nil)
86
106
  @shutdown = true
87
107
  @http.finish if @http.started?
108
+ SUCCESS
88
109
  end
89
110
 
90
111
  private
@@ -116,11 +137,22 @@ module OpenTelemetry
116
137
  true
117
138
  end
118
139
 
140
+ # The around_request is a private method that provides an extension
141
+ # point for the exporters network calls. The default behaviour
142
+ # is to not trace these operations.
143
+ #
144
+ # An example use case would be to prepend a patch, or extend this class
145
+ # and override this method's behaviour to explicitly trace the HTTP request.
146
+ # This would allow you to trace your export pipeline.
147
+ def around_request
148
+ OpenTelemetry::Common::Utilities.untraced { yield }
149
+ end
150
+
119
151
  def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
120
152
  retry_count = 0
121
153
  timeout ||= @timeout
122
- start_time = Time.now
123
- OpenTelemetry::Common::Utilities.untraced do # rubocop:disable Metrics/BlockLength
154
+ start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
155
+ around_request do # rubocop:disable Metrics/BlockLength
124
156
  request = Net::HTTP::Post.new(@path)
125
157
  request.body = if @compression == 'gzip'
126
158
  request.add_field('Content-Encoding', 'gzip')
@@ -167,6 +199,15 @@ module OpenTelemetry
167
199
  rescue Net::OpenTimeout, Net::ReadTimeout
168
200
  retry if backoff?(retry_count: retry_count += 1, reason: 'timeout')
169
201
  return FAILURE
202
+ rescue SocketError
203
+ retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error')
204
+ return FAILURE
205
+ rescue SystemCallError => e
206
+ retry if backoff?(retry_count: retry_count += 1, reason: e.class.name)
207
+ return FAILURE
208
+ rescue EOFError
209
+ retry if backoff?(retry_count: retry_count += 1, reason: 'eof_error')
210
+ return FAILURE
170
211
  end
171
212
  ensure
172
213
  # Reset timeouts to defaults for the next call.
@@ -254,13 +295,13 @@ module OpenTelemetry
254
295
  parent_span_id: span_data.parent_span_id == OpenTelemetry::Trace::INVALID_SPAN_ID ? nil : span_data.parent_span_id,
255
296
  name: span_data.name,
256
297
  kind: as_otlp_span_kind(span_data.kind),
257
- start_time_unix_nano: as_otlp_timestamp(span_data.start_timestamp),
258
- end_time_unix_nano: as_otlp_timestamp(span_data.end_timestamp),
298
+ start_time_unix_nano: span_data.start_timestamp,
299
+ end_time_unix_nano: span_data.end_timestamp,
259
300
  attributes: span_data.attributes&.map { |k, v| as_otlp_key_value(k, v) },
260
301
  dropped_attributes_count: span_data.total_recorded_attributes - span_data.attributes&.size.to_i,
261
302
  events: span_data.events&.map do |event|
262
303
  Opentelemetry::Proto::Trace::V1::Span::Event.new(
263
- time_unix_nano: as_otlp_timestamp(event.timestamp),
304
+ time_unix_nano: event.timestamp,
264
305
  name: event.name,
265
306
  attributes: event.attributes&.map { |k, v| as_otlp_key_value(k, v) }
266
307
  # TODO: track dropped_attributes_count in Span#append_event
@@ -287,10 +328,6 @@ module OpenTelemetry
287
328
  )
288
329
  end
289
330
 
290
- def as_otlp_timestamp(timestamp)
291
- (timestamp.to_r * 1_000_000_000).to_i
292
- end
293
-
294
331
  def as_otlp_span_kind(kind)
295
332
  case kind
296
333
  when :internal then Opentelemetry::Proto::Trace::V1::Span::SpanKind::INTERNAL
@@ -304,6 +341,9 @@ module OpenTelemetry
304
341
 
305
342
  def as_otlp_key_value(key, value)
306
343
  Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value(value))
344
+ rescue Encoding::UndefinedConversionError => e
345
+ OpenTelemetry.handle_error(exception: e, message: "encoding error for key #{key} and value #{value}")
346
+ Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value('Encoding Error'))
307
347
  end
308
348
 
309
349
  def as_otlp_any_value(value)
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Exporter
9
9
  module OTLP
10
10
  ## Current OpenTelemetry OTLP exporter version
11
- VERSION = '0.14.0'
11
+ VERSION = '0.19.0'
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-exporter-otlp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.19.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-02-03 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -30,28 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.14.0
33
+ version: 1.0.0.rc1
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.14.0
40
+ version: 1.0.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opentelemetry-common
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.14.0
47
+ version: 0.18.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.14.0
54
+ version: 0.18.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: opentelemetry-sdk
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0.rc1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.0.rc1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -201,10 +215,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
201
215
  licenses:
202
216
  - Apache-2.0
203
217
  metadata:
204
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.14.0/file.CHANGELOG.html
218
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.19.0/file.CHANGELOG.html
205
219
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp
206
220
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
207
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.14.0
221
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.19.0
208
222
  post_install_message:
209
223
  rdoc_options: []
210
224
  require_paths:
@@ -220,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
234
  - !ruby/object:Gem::Version
221
235
  version: '0'
222
236
  requirements: []
223
- rubygems_version: 3.1.4
237
+ rubygems_version: 3.1.6
224
238
  signing_key:
225
239
  specification_version: 4
226
240
  summary: OTLP exporter for the OpenTelemetry framework