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

Instance Method Details

#error(description) ⇒ Object



63
64
65
66
67
# File 'lib/datadog/core/telemetry/logging.rb', line 63

def error(description)
  event = Event::Log.new(message: description, level: :error)

  log!(event)
end

#report(exception, level: :error, description: nil) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/datadog/core/telemetry/logging.rb', line 48

def report(exception, level: :error, description: nil)
  # Annoymous exceptions to be logged as <Class:0x00007f8b1c0b3b40>
  message = +''
  message << (exception.class.name || exception.class.inspect)
  message << ':' << description if description

  event = Event::Log.new(
    message: message,
    level: level,
    stack_trace: DatadogStackTrace.from(exception)
  )

  log!(event)
end