opentelemetry-exporter-otlp 0.21.2 → 0.23.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: c65f900e34136a47b094481f79f762069d9b51f291e3af124d33fa831b70dc17
4
- data.tar.gz: 48727712b84ea084c0f007174283fdf17510d5f708d10da491fd61f5d5524cb0
3
+ metadata.gz: 5f04f44504dc7f282168af4aeea6b08f8e010cdf50aa3352d604d4c689a84f96
4
+ data.tar.gz: d70caacf75e05a78dc0ae2e81c8ae1acca2aa4a47b0b47a4c69d9f1aaa4b5e40
5
5
  SHA512:
6
- metadata.gz: e360db9e6293a91eb5944f6752b93287385c2c2609454ef5b2a838eea6278b669fa5f28012836ca7d649196f6c108c4ad49231751c409b3d25f5ab40f79738a7
7
- data.tar.gz: 9ee5d32db05a6834a56f0603235ef8becdbc138b764f0112d2f2ae94860613effbfdd53297ed1a0df1bbca81bae1392ede6883f1279aaa4610ca4deaf253867c
6
+ metadata.gz: f735a7ddf73deba7d4e1708a01a19fc0deccb0869e5ec87d080d3bbabfb97e609cb2889766219ed0f611dad94097c5de87b7e7ff74d6e023d1f473aff098ad9c
7
+ data.tar.gz: 7c2519a847240f89ebac52d2bd007364e197216017d8d996808eca9445c1b2748ae5feef9d4f05694ccc319aa9ae5c8d73ca26daf52d9b4d4fe5e5262ff4d09a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History: opentelemetry-exporter-otlp
2
2
 
3
+ ### v0.23.0 / 2022-06-23
4
+
5
+ * ADDED: Report bundle size stats in exporter; also don't re-gzip unnecessarily
6
+
7
+ ### v0.22.0 / 2022-06-09
8
+
9
+ * ADDED: Otlp grpc
10
+
11
+ ### v0.21.3 / 2022-05-12
12
+
13
+ * (No significant changes)
14
+
3
15
  ### v0.21.2 / 2022-01-19
4
16
 
5
17
  * FIXED: Default scheme for OTLP endpoint
data/README.md CHANGED
@@ -78,7 +78,7 @@ The collector exporter can be configured explicitly in code, or via environment
78
78
  | `ssl_verify_mode:` | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER` or | `OpenSSL::SSL:VERIFY_PEER` |
79
79
  | | `OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_NONE` | |
80
80
 
81
- `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.
81
+ `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.7.6/libdoc/net/http/rdoc/Net/HTTP.html#verify_mode) for more information about these flags.
82
82
 
83
83
  ## How can I get involved?
84
84
 
@@ -10,6 +10,8 @@ require 'net/http'
10
10
  require 'csv'
11
11
  require 'zlib'
12
12
 
13
+ require 'google/rpc/status_pb'
14
+
13
15
  require 'opentelemetry/proto/common/v1/common_pb'
14
16
  require 'opentelemetry/proto/resource/v1/resource_pb'
15
17
  require 'opentelemetry/proto/trace/v1/trace_pb'
@@ -43,14 +45,14 @@ module OpenTelemetry
43
45
  end
44
46
  end
45
47
 
46
- def initialize(endpoint: config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'http://localhost:4318/v1/traces'), # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
47
- certificate_file: config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
48
+ def initialize(endpoint: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'http://localhost:4318/v1/traces'), # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
49
+ certificate_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
48
50
  ssl_verify_mode: Exporter.ssl_verify_mode,
49
- headers: config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
50
- compression: config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION', default: 'gzip'),
51
- timeout: config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
51
+ headers: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
52
+ compression: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION', default: 'gzip'),
53
+ timeout: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
52
54
  metrics_reporter: nil)
53
- raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" if invalid_url?(endpoint)
55
+ raise ArgumentError, "invalid url for OTLP::Exporter #{endpoint}" unless OpenTelemetry::Common::Utilities.valid_url?(endpoint)
54
56
  raise ArgumentError, "unsupported compression key #{compression}" unless compression.nil? || %w[gzip none].include?(compression)
55
57
 
56
58
  @uri = if endpoint == ENV['OTEL_EXPORTER_OTLP_ENDPOINT']
@@ -118,23 +120,6 @@ module OpenTelemetry
118
120
  http
119
121
  end
120
122
 
121
- def config_opt(*env_vars, default: nil)
122
- env_vars.each do |env_var|
123
- val = ENV[env_var]
124
- return val unless val.nil?
125
- end
126
- default
127
- end
128
-
129
- def invalid_url?(url)
130
- return true if url.nil? || url.strip.empty?
131
-
132
- URI(url)
133
- false
134
- rescue URI::InvalidURIError
135
- true
136
- end
137
-
138
123
  # The around_request is a private method that provides an extension
139
124
  # point for the exporters network calls. The default behaviour
140
125
  # is to not trace these operations.
@@ -146,23 +131,28 @@ module OpenTelemetry
146
131
  OpenTelemetry::Common::Utilities.untraced { yield }
147
132
  end
148
133
 
149
- def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
134
+ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
150
135
  return FAILURE if bytes.nil?
151
136
 
137
+ @metrics_reporter.record_value('otel.otlp_exporter.message.uncompressed_size', value: bytes.bytesize)
138
+
139
+ request = Net::HTTP::Post.new(@path)
140
+ if @compression == 'gzip'
141
+ request.add_field('Content-Encoding', 'gzip')
142
+ body = Zlib.gzip(bytes)
143
+ @metrics_reporter.record_value('otel.otlp_exporter.message.compressed_size', value: body.bytesize)
144
+ else
145
+ body = bytes
146
+ end
147
+ request.body = body
148
+ request.add_field('Content-Type', 'application/x-protobuf')
149
+ @headers.each { |key, value| request.add_field(key, value) }
150
+
152
151
  retry_count = 0
153
152
  timeout ||= @timeout
154
153
  start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
155
- around_request do # rubocop:disable Metrics/BlockLength
156
- request = Net::HTTP::Post.new(@path)
157
- request.body = if @compression == 'gzip'
158
- request.add_field('Content-Encoding', 'gzip')
159
- Zlib.gzip(bytes)
160
- else
161
- bytes
162
- end
163
- request.add_field('Content-Type', 'application/x-protobuf')
164
- @headers.each { |key, value| request.add_field(key, value) }
165
154
 
155
+ around_request do # rubocop:disable Metrics/BlockLength
166
156
  remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
167
157
  return FAILURE if remaining_timeout.zero?
168
158
 
@@ -185,8 +175,7 @@ module OpenTelemetry
185
175
  redo if backoff?(retry_count: retry_count += 1, reason: response.code)
186
176
  FAILURE
187
177
  when Net::HTTPBadRequest, Net::HTTPClientError, Net::HTTPServerError
188
- # TODO: decode the body as a google.rpc.Status Protobuf-encoded message when https://github.com/open-telemetry/opentelemetry-collector/issues/1357 is fixed.
189
- response.body # Read and discard body
178
+ log_status(response.body)
190
179
  @metrics_reporter.add_to_counter('otel.otlp_exporter.failure', labels: { 'reason' => response.code })
191
180
  FAILURE
192
181
  when Net::HTTPRedirection
@@ -231,6 +220,17 @@ module OpenTelemetry
231
220
  # TODO: figure out destination and reinitialize @http and @path
232
221
  end
233
222
 
223
+ def log_status(body)
224
+ status = Google::Rpc::Status.decode(body)
225
+ details = status.details.map do |detail|
226
+ klass_or_nil = ::Google::Protobuf::DescriptorPool.generated_pool.lookup(detail.type_name).msgclass
227
+ detail.unpack(klass_or_nil) if klass_or_nil
228
+ end.compact
229
+ OpenTelemetry.handle_error(message: "OTLP exporter received rpc.Status{message=#{status.message}, details=#{details}}")
230
+ rescue StandardError => e
231
+ OpenTelemetry.handle_error(exception: e, message: 'unexpected error decoding rpc.Status in OTLP::Exporter#log_status')
232
+ end
233
+
234
234
  def measure_request_duration
235
235
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
236
236
  begin
@@ -270,7 +270,7 @@ module OpenTelemetry
270
270
  true
271
271
  end
272
272
 
273
- def encode(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
273
+ def encode(span_data) # rubocop:disable Metrics/MethodLength
274
274
  Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.encode(
275
275
  Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.new(
276
276
  resource_spans: span_data
@@ -300,7 +300,7 @@ module OpenTelemetry
300
300
  nil
301
301
  end
302
302
 
303
- def as_otlp_span(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
303
+ def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength
304
304
  Opentelemetry::Proto::Trace::V1::Span.new(
305
305
  trace_id: span_data.trace_id,
306
306
  span_id: span_data.span_id,
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Exporter
9
9
  module OTLP
10
10
  ## Current OpenTelemetry OTLP exporter version
11
- VERSION = '0.21.2'
11
+ VERSION = '0.23.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.21.2
4
+ version: 0.23.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: 2022-01-19 00:00:00.000000000 Z
11
+ date: 2022-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.7'
19
+ version: '3.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.7'
26
+ version: '3.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: googleapis-common-protos-types
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: opentelemetry-api
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 0.19.3
61
+ version: 0.19.6
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 0.19.3
68
+ version: 0.19.6
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: opentelemetry-sdk
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: opentelemetry-semantic_conventions
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +136,20 @@ dependencies:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
138
  version: '5.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: opentelemetry-test-helpers
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: pry-byebug
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -238,10 +280,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
238
280
  licenses:
239
281
  - Apache-2.0
240
282
  metadata:
241
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.21.2/file.CHANGELOG.html
283
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.23.0/file.CHANGELOG.html
242
284
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp
243
285
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
244
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.21.2
286
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-exporter-otlp/v0.23.0
245
287
  post_install_message:
246
288
  rdoc_options: []
247
289
  require_paths:
@@ -250,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
292
  requirements:
251
293
  - - ">="
252
294
  - !ruby/object:Gem::Version
253
- version: 2.5.0
295
+ version: 2.6.0
254
296
  required_rubygems_version: !ruby/object:Gem::Requirement
255
297
  requirements:
256
298
  - - ">="