opentelemetry-exporter-otlp 0.12.1 → 0.17.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: d2e42d5832a5e55dd263643260de2a092d8143b3c575ce1dbb413d6deffefef3
4
- data.tar.gz: 62dca89af13815894f58d9a8732bae13bba9bad76743a53cecd18eaa327a2e55
3
+ metadata.gz: 2f5b4d0796501a589f5835d0c45dde197615d480b215ba155def93e1bff5d262
4
+ data.tar.gz: c9059c510ffb3931d4d004b2eb74c6433c4fe353f2a10bfae0e51a6a9e10111f
5
5
  SHA512:
6
- metadata.gz: 6c6c87c2f2d9c29ac6820724416eb5719069a9d77feb5610b1f35164e1a832163cc5f732434bd9936a44b9c03405fbdcf9e130badb61d4bf2f96ee6fa3404024
7
- data.tar.gz: f8cb8d266ef97c6a7b51c8d08afa93df0632ecbe5f6ca82ec44e27b0904c2a8bfacf213536084ce6fb0ee390ee78012d3915bb685efb5f672f7a7d7ca99e9319
6
+ metadata.gz: 6f2118ca07a28c077f245310d32277aacda537a8b71be2a20d2f5a8763bc03be1ed2ad7ed13e0e99fe21738ac13f395ad2dcefd7b240b34c32f090576dfc4887
7
+ data.tar.gz: 6429cf61555ab6052a8cc667925933c40a552225209e829a4270cdec114ff94a0223c5f7459e32ae2447a8689f9817c221a0bf98f32d19ef99e7e04fc45769b5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Release History: opentelemetry-exporter-otlp
2
2
 
3
+ ### v0.17.0 / 2021-04-22
4
+
5
+ * ADDED: Add zipkin exporter
6
+
7
+ ### v0.16.0 / 2021-03-17
8
+
9
+ * BREAKING CHANGE: Implement Exporter#force_flush
10
+
11
+ * ADDED: Implement Exporter#force_flush
12
+ * FIXED: Rescue socket err in otlp exporter to prevent failures unable to connect
13
+ * DOCS: Replace Gitter with GitHub Discussions
14
+
15
+ ### v0.15.0 / 2021-02-18
16
+
17
+ * BREAKING CHANGE: Streamline processor pipeline
18
+
19
+ * ADDED: Add otlp exporter hooks
20
+ * FIXED: Streamline processor pipeline
21
+
22
+ ### v0.14.0 / 2021-02-03
23
+
24
+ * (No significant changes)
25
+
26
+ ### v0.13.0 / 2021-01-29
27
+
28
+ * BREAKING CHANGE: Spec compliance for OTLP exporter
29
+
30
+ * ADDED: Add untraced wrapper to common utils
31
+ * FIXED: Spec compliance for OTLP exporter
32
+ * FIXED: Conditionally append path to collector endpoint
33
+ * FIXED: OTLP path should be /v1/traces
34
+ * FIXED: Rename OTLP env vars SPAN -> TRACES
35
+
3
36
  ### v0.12.1 / 2021-01-13
4
37
 
5
38
  * FIXED: Updated protobuf version dependency
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
- host: 'localhost', port: 55680
42
+ OpenTelemetry::Exporter::OTLP::Exporter.new(
43
+ endpoint: 'http://localhost:55680'
44
44
  )
45
45
  )
46
46
  )
@@ -69,7 +69,7 @@ For additional examples, see the [examples on github][examples-github].
69
69
 
70
70
  The `opentelemetry-exporter-otlp` gem source is [on github][repo-github], along with related gems including `opentelemetry-sdk`.
71
71
 
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].
72
+ 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
73
 
74
74
  ## License
75
75
 
@@ -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/master/LICENSE
84
- [examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/examples
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
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
87
+ [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -31,32 +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('OTEL_EXPORTER_OTLP_SPAN_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'localhost:55681/v1/trace'), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
35
- insecure: config_opt('OTEL_EXPORTER_OTLP_SPAN_INSECURE', 'OTEL_EXPORTER_OTLP_INSECURE', default: false),
36
- certificate_file: config_opt('OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
37
- headers: config_opt('OTEL_EXPORTER_OTLP_SPAN_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS'), # TODO: what format is expected here?
38
- compression: config_opt('OTEL_EXPORTER_OTLP_SPAN_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION'),
39
- timeout: config_opt('OTEL_EXPORTER_OTLP_SPAN_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
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),
40
39
  metrics_reporter: nil)
41
- raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?("http://#{endpoint}")
40
+ raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?(endpoint)
42
41
  raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || compression == 'gzip'
43
- raise ArgumentError, 'headers must be comma-separated k:v pairs or a Hash' unless valid_headers?(headers)
42
+ raise ArgumentError, 'headers must be comma-separated k=v pairs or a Hash' unless valid_headers?(headers)
44
43
 
45
- uri = URI "http://#{endpoint}"
46
- @http = Net::HTTP.new(uri.host, uri.port)
47
- @http.use_ssl = insecure.to_s.downcase == 'false'
44
+ @uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
45
+ URI("#{endpoint}/v1/traces")
46
+ else
47
+ URI(endpoint)
48
+ end
49
+
50
+ @http = Net::HTTP.new(@uri.host, @uri.port)
51
+ @http.use_ssl = @uri.scheme == 'https'
48
52
  @http.ca_file = certificate_file unless certificate_file.nil?
49
53
  @http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT
50
54
 
51
- @path = uri.path
55
+ @path = @uri.path
52
56
  @headers = case headers
53
- when String then CSV.parse(headers, col_sep: ':', row_sep: ',').to_h
57
+ when String then CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
54
58
  when Hash then headers
55
59
  end
56
- @timeout = timeout.to_f # TODO: use this as a default timeout when we implement timeouts in https://github.com/open-telemetry/opentelemetry-ruby/pull/341
60
+ @timeout = timeout.to_f
57
61
  @compression = compression
58
62
  @metrics_reporter = metrics_reporter || OpenTelemetry::SDK::Trace::Export::MetricsReporter
59
-
60
63
  @shutdown = false
61
64
  end
62
65
 
@@ -73,14 +76,24 @@ module OpenTelemetry
73
76
  send_bytes(encode(span_data), timeout: timeout)
74
77
  end
75
78
 
76
- # Called when {OpenTelemetry::SDK::Trace::Tracer#shutdown} is called, if
77
- # this exporter is registered to a {OpenTelemetry::SDK::Trace::Tracer}
79
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#force_flush} is called, if
80
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
81
+ # object.
82
+ #
83
+ # @param [optional Numeric] timeout An optional timeout in seconds.
84
+ def force_flush(timeout: nil)
85
+ SUCCESS
86
+ end
87
+
88
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#shutdown} is called, if
89
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
78
90
  # object.
79
91
  #
80
92
  # @param [optional Numeric] timeout An optional timeout in seconds.
81
93
  def shutdown(timeout: nil)
82
94
  @shutdown = true
83
95
  @http.finish if @http.started?
96
+ SUCCESS
84
97
  end
85
98
 
86
99
  private
@@ -97,7 +110,7 @@ module OpenTelemetry
97
110
  return true if headers.nil? || headers.is_a?(Hash)
98
111
  return false unless headers.is_a?(String)
99
112
 
100
- CSV.parse(headers, col_sep: ':', row_sep: ',').to_h
113
+ CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
101
114
  true
102
115
  rescue ArgumentError
103
116
  false
@@ -106,17 +119,28 @@ module OpenTelemetry
106
119
  def invalid_url?(url)
107
120
  return true if url.nil? || url.strip.empty?
108
121
 
109
- uri = URI(url)
110
- uri.path.nil? || uri.path.empty?
122
+ URI(url)
123
+ false
111
124
  rescue URI::InvalidURIError
112
125
  true
113
126
  end
114
127
 
128
+ # The around_request is a private method that provides an extension
129
+ # point for the exporters network calls. The default behaviour
130
+ # is to not trace these operations.
131
+ #
132
+ # An example use case would be to prepend a patch, or extend this class
133
+ # and override this method's behaviour to explicitly trace the HTTP request.
134
+ # This would allow you to trace your export pipeline.
135
+ def around_request
136
+ OpenTelemetry::Common::Utilities.untraced { yield }
137
+ end
138
+
115
139
  def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
116
140
  retry_count = 0
117
141
  timeout ||= @timeout
118
142
  start_time = Time.now
119
- untraced do # rubocop:disable Metrics/BlockLength
143
+ around_request do # rubocop:disable Metrics/BlockLength
120
144
  request = Net::HTTP::Post.new(@path)
121
145
  request.body = if @compression == 'gzip'
122
146
  request.add_field('Content-Encoding', 'gzip')
@@ -163,6 +187,9 @@ module OpenTelemetry
163
187
  rescue Net::OpenTimeout, Net::ReadTimeout
164
188
  retry if backoff?(retry_count: retry_count += 1, reason: 'timeout')
165
189
  return FAILURE
190
+ rescue SocketError
191
+ retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error')
192
+ return FAILURE
166
193
  end
167
194
  ensure
168
195
  # Reset timeouts to defaults for the next call.
@@ -175,10 +202,6 @@ module OpenTelemetry
175
202
  # TODO: figure out destination and reinitialize @http and @path
176
203
  end
177
204
 
178
- def untraced
179
- OpenTelemetry::Trace.with_span(OpenTelemetry::Trace::Span.new) { yield }
180
- end
181
-
182
205
  def measure_request_duration
183
206
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
184
207
  begin
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Exporter
9
9
  module OTLP
10
10
  ## Current OpenTelemetry OTLP exporter version
11
- VERSION = '0.12.1'
11
+ VERSION = '0.17.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.12.1
4
+ version: 0.17.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-13 00:00:00.000000000 Z
11
+ date: 2021-04-23 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.12.0
33
+ version: 0.17.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.12.0
40
+ version: 0.17.0
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.12.0
47
+ version: 0.17.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.12.0
54
+ version: 0.17.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: 0.17.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.17.0
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.12.1/file.CHANGELOG.html
205
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/exporter/otlp
218
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.17.0/file.CHANGELOG.html
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.12.1
221
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.17.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