opentelemetry-api 0.11.0 → 0.12.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: 5b7fecd268c9efe43c452847e831bf1456d502c8531e589691b865bd1264b53f
4
- data.tar.gz: d8b33160247e5d8c94b248f607b621333112cda1a6fc7af00ce68ef1caed1cb0
3
+ metadata.gz: c7c58fd79dce24997ec350919d59c831940d6604acea611b2a0be72177f0b692
4
+ data.tar.gz: a0c08af587e1002da839ff0f4d9860f528256fbb3dbba3b885c0494f06c71b95
5
5
  SHA512:
6
- metadata.gz: 06e4bda488c11623f710a74288de802c8af5fbb879bb52edbd003dd10159ff443bde7c9d6f511915e0ecdaaf54244f7b8897c4137b466bd11bdc87f51b87d337
7
- data.tar.gz: 8466f42436e3e89e0a4339699887b3eae95551dd601f66be5b3f9ffc76f3aaad2075e95cb6aeed945422e0ea998148b769dc2781d3095a67c2051c2cc52068a7
6
+ metadata.gz: 3988fc0200883dadf62a8623d6c727d032c6648c2bc4e860cac0e3f7ae3e8bacc6a0c8a05638272cbf24d254cfaf3723bfdb2564e306bb99e029d1f88860d5d4
7
+ data.tar.gz: 183d0203693f3585a153992582aee24e7df9ce3afc66ba536dd3dcfc7295ca00226b3cb02f468fa9ce17fce2dc6b5a54523c5cfba4b79c87d8f879255d6a34e1
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-api
2
2
 
3
+ ### v0.12.0 / 2020-12-24
4
+
5
+ * ADDED: Structured error handling
6
+
3
7
  ### v0.11.0 / 2020-12-11
4
8
 
5
9
  * BREAKING CHANGE: Implement tracestate
@@ -22,13 +22,27 @@ require 'opentelemetry/version'
22
22
  module OpenTelemetry
23
23
  extend self
24
24
 
25
- attr_writer :tracer_provider, :meter_provider, :baggage, :logger
25
+ attr_writer :tracer_provider, :meter_provider, :baggage, :logger, :error_handler
26
26
 
27
27
  # @return [Object, Logger] configured Logger or a default STDOUT Logger.
28
28
  def logger
29
29
  @logger ||= Logger.new(STDOUT, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
30
30
  end
31
31
 
32
+ # @return [Callable] configured error handler or a default that logs the
33
+ # exception and message at ERROR level.
34
+ def error_handler
35
+ @error_handler ||= ->(exception: nil, message: nil) { logger.error("OpenTelemetry error: #{[message, exception&.message].compact.join(' - ')}") }
36
+ end
37
+
38
+ # Handles an error by calling the configured error_handler.
39
+ #
40
+ # @param [optional Exception] exception The exception to be handled
41
+ # @param [optional String] message An error message.
42
+ def handle_error(exception: nil, message: nil)
43
+ error_handler.call(exception: exception, message: message)
44
+ end
45
+
32
46
  # @return [Object, Trace::TracerProvider] registered tracer provider or a
33
47
  # default no-op implementation of the tracer provider.
34
48
  def tracer_provider
@@ -79,8 +79,7 @@ module OpenTelemetry
79
79
  OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} failed to install"
80
80
  end
81
81
  rescue => e # rubocop:disable Style/RescueStandardError
82
- OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} unhandled exception " \
83
- "during install #{e}: #{e.backtrace}"
82
+ OpenTelemetry.handle_error(exception: e, message: "Instrumentation: #{instrumentation.name} unhandled exception during install: #{e.backtrace}")
84
83
  end
85
84
  end
86
85
  end
@@ -6,5 +6,5 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  ## Current OpenTelemetry version
9
- VERSION = '0.11.0'
9
+ VERSION = '0.12.0'
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.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-11 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ipsa
@@ -196,10 +196,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
196
196
  licenses:
197
197
  - Apache-2.0
198
198
  metadata:
199
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.11.0/file.CHANGELOG.html
199
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.12.0/file.CHANGELOG.html
200
200
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/api
201
201
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
202
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.11.0
202
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v0.12.0
203
203
  post_install_message:
204
204
  rdoc_options: []
205
205
  require_paths: