Class: LogMethod::OpenTelemetryAfterLog

Inherits:
Object
  • Object
show all
Defined in:
lib/log_method/open_telemetry_after_log.rb

Class Method Summary collapse

Class Method Details

.call(class_thats_logging_name, method_name, object_id, object_class_name, trace_id, current_actor_id, log_message) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/log_method/open_telemetry_after_log.rb', line 2

def self.call(class_thats_logging_name, method_name, object_id, object_class_name, trace_id, current_actor_id, log_message)
  current_actor_id_attribute = "app.#{LogMethod.config.current_actor_id_label}"

  OpenTelemetry::Trace.current_span.add_event(
    log_message,
    attributes: {
      "log_method.class_name"        => class_thats_logging_name,
      "log_method.method_name"       => method_name,
      "log_method.object_id"         => object_id,
      "log_method.object_class_name" => object_class_name,
      "app.trace_id"                 => trace_id,
      current_actor_id_attribute     => current_actor_id,
    }
  )
end