Module: ScoutApm::Logging::Loggers::OpenTelemetry
- Defined in:
- lib/scout_apm/logging/loggers/opentelemetry/api/logs.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs.rb,
lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb,
lib/scout_apm/logging/loggers/opentelemetry/api/logs/logger.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/export.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/logger.rb,
lib/scout_apm/logging/loggers/opentelemetry/api/logs/version.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/version.rb,
lib/scout_apm/logging/loggers/opentelemetry/api/logs/log_record.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/log_record.rb,
lib/scout_apm/logging/loggers/opentelemetry/api/logs/logger_provider.rb,
lib/scout_apm/logging/loggers/opentelemetry/api/logs/severity_number.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/log_record_data.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/logger_provider.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/log_record_processor.rb,
lib/scout_apm/logging/loggers/opentelemetry/exporter/exporter/otlp/version.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/export/log_record_exporter.rb,
lib/scout_apm/logging/loggers/opentelemetry/exporter/exporter/otlp/logs_exporter.rb,
lib/scout_apm/logging/loggers/opentelemetry/sdk/logs/export/batch_log_record_processor.rb
Defined Under Namespace
Modules: Exporter, Logs, SDK
Class Method Summary
collapse
Class Method Details
.error_handler ⇒ Callable
Returns configured error handler or a default that logs the exception and message at ERROR level.
24
25
26
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 24
def error_handler
@error_handler ||= ->(exception: nil, message: nil) { logger.error("OpenTelemetry error: #{[message, exception&.message, exception&.backtrace&.first].compact.join(' - ')}") }
end
|
.handle_error(exception: nil, message: nil) ⇒ Object
Handles an error by calling the configured error_handler.
32
33
34
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 32
def handle_error(exception: nil, message: nil)
error_handler.call(exception: exception, message: message)
end
|
.logger ⇒ Object, Logger
Overwritten on setup to be the internal logger.
18
19
20
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 18
def logger
@logger ||= ::Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || ::Logger::INFO)
end
|
.logger_provider ⇒ Object
40
41
42
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 40
def logger_provider
@logger_provider
end
|
.logger_provider=(logger_provider) ⇒ Object
36
37
38
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 36
def logger_provider=(logger_provider)
@logger_provider = logger_provider
end
|
.scout_resource(context) ⇒ Object
54
55
56
57
58
|
# File 'lib/scout_apm/logging/loggers/opentelemetry/opentelemetry.rb', line 54
def self.scout_resource(context)
our_resources = ::OpenTelemetry::SDK::Resources::Resource.create({'telemetryhub.key' => context.config.value('logs_ingest_key')})
default_resources = ::OpenTelemetry::SDK::Resources::Resource.default
default_resources.merge(our_resources)
end
|