opentelemetry-exporter-otlp 0.20.3 → 0.20.4

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: 1e089f8c7bd9d678bffa56801f7afc7391555bb7228827e5498b2ad2e492257a
4
- data.tar.gz: 8af67808ba9a96ba76a240a307ca7f5028846e152df610644f80cfad532dc7b6
3
+ metadata.gz: ce1df6a570727c17754406f2bd2e89ea360fe1bef7520f49479cd27648f2f1ae
4
+ data.tar.gz: ed250da5a1ceb7b87ace908400cb26be946690b2f8de989c733af64dedb61b85
5
5
  SHA512:
6
- metadata.gz: 389df119724c984aa0aa63961165df7ae9d66995b00ae814d4284bbc12712b1b86de469a4ea9f14ceeb2494473a821e2dafe9e608c3d70c53e5d26d56c940e14
7
- data.tar.gz: 1ffbb9a7fe71519322242470d547e56e97cd94655f3bc762024006a8131b87236ee1ae2e61c3da7cf7f9a9161025443392df49c74f842693ab87cc17356535f1
6
+ metadata.gz: 4b51248fe75502f4c4108e00ad9adbbadc12bcff3511f13216f95baacd9e2bc59941bc855b324e5ddf2c475f291bb6efa98c1e0493a6094a388e6765dca1f3ab
7
+ data.tar.gz: e12faa4a6a12a4159184ca11aab1174828104132a179450a7f51811cbeba57d20ccea87568df915146d652fe3e26344e1b54faeab1528bff3d631e52a0f94042
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-exporter-otlp
2
2
 
3
+ ### v0.20.4 / 2021-09-29
4
+
5
+ * FIXED: OTLP Export Header Format
6
+
3
7
  ### v0.20.3 / 2021-08-19
4
8
 
5
9
  * FIXED: OTLP exporter missing failure metrics
@@ -31,6 +31,9 @@ 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
+ ERROR_MESSAGE_INVALID_HEADERS = 'headers must be a String with comma-separated URL Encoded UTF-8 k=v pairs or a Hash'
35
+ private_constant(:ERROR_MESSAGE_INVALID_HEADERS)
36
+
34
37
  def self.ssl_verify_mode
35
38
  if ENV.key?('OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER')
36
39
  OpenSSL::SSL::VERIFY_PEER
@@ -41,16 +44,15 @@ module OpenTelemetry
41
44
  end
42
45
  end
43
46
 
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
47
+ def initialize(endpoint: config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'https://localhost:4317/v1/traces'), # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
45
48
  certificate_file: config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
46
49
  ssl_verify_mode: Exporter.ssl_verify_mode,
47
- headers: config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS'),
50
+ headers: config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
48
51
  compression: config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION'),
49
52
  timeout: config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
50
53
  metrics_reporter: nil)
51
54
  raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?(endpoint)
52
55
  raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || compression == 'gzip'
53
- raise ArgumentError, 'headers must be comma-separated k=v pairs or a Hash' unless valid_headers?(headers)
54
56
 
55
57
  @uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
56
58
  URI("#{endpoint}/v1/traces")
@@ -66,8 +68,10 @@ module OpenTelemetry
66
68
 
67
69
  @path = @uri.path
68
70
  @headers = case headers
69
- when String then CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
71
+ when String then parse_headers(headers)
70
72
  when Hash then headers
73
+ else
74
+ raise ArgumentError, ERROR_MESSAGE_INVALID_HEADERS
71
75
  end
72
76
  @timeout = timeout.to_f
73
77
  @compression = compression
@@ -118,16 +122,6 @@ module OpenTelemetry
118
122
  default
119
123
  end
120
124
 
121
- def valid_headers?(headers)
122
- return true if headers.nil? || headers.is_a?(Hash)
123
- return false unless headers.is_a?(String)
124
-
125
- CSV.parse(headers, col_sep: '=', row_sep: ',').to_h
126
- true
127
- rescue ArgumentError
128
- false
129
- end
130
-
131
125
  def invalid_url?(url)
132
126
  return true if url.nil? || url.strip.empty?
133
127
 
@@ -161,7 +155,7 @@ module OpenTelemetry
161
155
  bytes
162
156
  end
163
157
  request.add_field('Content-Type', 'application/x-protobuf')
164
- @headers&.each { |key, value| request.add_field(key, value) }
158
+ @headers.each { |key, value| request.add_field(key, value) }
165
159
 
166
160
  remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
167
161
  return TIMEOUT if remaining_timeout.zero?
@@ -367,6 +361,24 @@ module OpenTelemetry
367
361
  end
368
362
  result
369
363
  end
364
+
365
+ def parse_headers(raw)
366
+ entries = raw.split(',')
367
+ raise ArgumentError, ERROR_MESSAGE_INVALID_HEADERS if entries.empty?
368
+
369
+ entries.each_with_object({}) do |entry, headers|
370
+ k, v = entry.split('=', 2).map(&CGI.method(:unescape))
371
+ begin
372
+ k = k.to_s.strip
373
+ v = v.to_s.strip
374
+ rescue ArgumentError => e
375
+ raise e, ERROR_MESSAGE_INVALID_HEADERS
376
+ end
377
+ raise ArgumentError, ERROR_MESSAGE_INVALID_HEADERS if k.empty? || v.empty?
378
+
379
+ headers[k] = v
380
+ end
381
+ end
370
382
  end
371
383
  end
372
384
  end
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Exporter
9
9
  module OTLP
10
10
  ## Current OpenTelemetry OTLP exporter version
11
- VERSION = '0.20.3'
11
+ VERSION = '0.20.4'
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.20.3
4
+ version: 0.20.4
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-08-19 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '5.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -215,10 +229,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
215
229
  licenses:
216
230
  - Apache-2.0
217
231
  metadata:
218
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.20.3/file.CHANGELOG.html
232
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.20.4/file.CHANGELOG.html
219
233
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp
220
234
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
221
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.20.3
235
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.20.4
222
236
  post_install_message:
223
237
  rdoc_options: []
224
238
  require_paths: