opentelemetry-exporter-otlp 0.12.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a82ddc3fb2e5d64af320a0c2673b1e5c52f7b32cd15dbbf40e8a6442f0ae0eb7
4
- data.tar.gz: a256ebed6d862f8e62a31f8a06e12adb90c4dff26db4fda2f5190ae8623737f8
3
+ metadata.gz: 2455db90272d1c7656bf1496b86a9788727cc1130bbbbea5de716dec94f01ee3
4
+ data.tar.gz: aaebcfa6905ae078fc8ad21bd08e93ddb435a836904f12bf70db47b9a72a14ea
5
5
  SHA512:
6
- metadata.gz: 45c4cdc80fb6e3cad4a32edde1de12f928ace262afdb6d8b395ae052b754d67ee8a80c7a0571bb2ff3764708400801b3aec7594af7a658bab5863ce1f9c112e6
7
- data.tar.gz: 7e8bc1bf14d1c496efe948900170fe1f5bf4a21213f3862df3780e0d5b1d06548afc47b7cc4e9e43d592496211618c4332ea3e01cb50f7638134d6613e6c3155
6
+ metadata.gz: 2a837ec3d592062abe1893195748a1de091c5381b7612607b8125a046f7699e284e06849e7920708c27e555a63d8b5838e542d96f70cce1b7fbbd9e3d1ce183f
7
+ data.tar.gz: 77776d8cd4c9321b7eb92e1e0f2e28c02ccf90869ebd534673713b01ddbe50be4f68664b4fd0f5ebc91aaf483ae0cd7d250fd766d8d164e0bddce897c2b6be10
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Release History: opentelemetry-exporter-otlp
2
2
 
3
+ ### v0.16.0 / 2021-03-17
4
+
5
+ * BREAKING CHANGE: Implement Exporter#force_flush
6
+
7
+ * ADDED: Implement Exporter#force_flush
8
+ * FIXED: Rescue socket err in otlp exporter to prevent failures unable to connect
9
+ * DOCS: Replace Gitter with GitHub Discussions
10
+
11
+ ### v0.15.0 / 2021-02-18
12
+
13
+ * BREAKING CHANGE: Streamline processor pipeline
14
+
15
+ * ADDED: Add otlp exporter hooks
16
+ * FIXED: Streamline processor pipeline
17
+
18
+ ### v0.14.0 / 2021-02-03
19
+
20
+ * (No significant changes)
21
+
22
+ ### v0.13.0 / 2021-01-29
23
+
24
+ * BREAKING CHANGE: Spec compliance for OTLP exporter
25
+
26
+ * ADDED: Add untraced wrapper to common utils
27
+ * FIXED: Spec compliance for OTLP exporter
28
+ * FIXED: Conditionally append path to collector endpoint
29
+ * FIXED: OTLP path should be /v1/traces
30
+ * FIXED: Rename OTLP env vars SPAN -> TRACES
31
+
32
+ ### v0.12.1 / 2021-01-13
33
+
34
+ * FIXED: Updated protobuf version dependency
35
+
3
36
  ### v0.12.0 / 2020-12-24
4
37
 
5
38
  * (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
- 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.0'
11
+ VERSION = '0.16.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.12.0
4
+ version: 0.16.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: 2020-12-24 00:00:00.000000000 Z
11
+ date: 2021-03-22 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: '4'
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: '4'
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.12.0
33
+ version: 0.16.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.12.0
40
+ version: 0.16.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.12.0
47
+ version: 0.16.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.12.0
54
+ version: 0.16.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.12.0/file.CHANGELOG.html
211
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/exporter/otlp
204
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.16.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.12.0
207
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.16.0
214
208
  post_install_message:
215
209
  rdoc_options: []
216
210
  require_paths: