Module: Datadog::Core::Telemetry::Logging
- Included in:
- Component
- Defined in:
- lib/datadog/core/telemetry/logging.rb
Overview
INTERNAL USAGE ONLY ===
Logging interface for sending telemetry logs… so we can fix them.
For developer using this module:
-
MUST NOT provide any sensitive information (PII)
-
SHOULD reduce the data cardinality for batching/aggregation
Before using it, ask yourself:
-
Do we need to know about this (ie. internal error or client error)?
-
How severe/critical is this error? (ie. error, warning, fatal)
-
What information needed to make it actionable?
Defined Under Namespace
Modules: DatadogStackTrace
Instance Method Summary collapse
- #error(description) ⇒ Object
- #report(exception, level: :error, description: nil, pii_safe: false) ⇒ Object
Instance Method Details
#error(description) ⇒ Object
69 70 71 72 73 |
# File 'lib/datadog/core/telemetry/logging.rb', line 69 def error(description) event = Event::Log.new(message: description, level: :error) log!(event) end |
#report(exception, level: :error, description: nil, pii_safe: false) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/datadog/core/telemetry/logging.rb', line 48 def report(exception, level: :error, description: nil, pii_safe: false) # Anonymous exceptions to be logged as <Class:0x00007f8b1c0b3b40> = +"#{exception.class.name || exception.class.inspect}" # standard:disable Style/RedundantInterpolation = pii_safe ? exception. : nil if description || << ':' << " #{description}" if description << " (#{exception.})" if end event = Event::Log.new( message: , level: level, stack_trace: DatadogStackTrace.from(exception) ) log!(event) end |