Module: PlatformSdk::Observability::Langfuse::TraceSummarizable

Defined in:
lib/platform_sdk/observability/langfuse/trace_summarizable.rb

Overview

Mix into Sidekiq jobs (or anything running under a Traceable span) to record a meaningful summary of the work in the trace's Output column in Langfuse.

Including classes implement #langfuse_trace_output_attributes returning a Hash; call record_langfuse_trace_output once the relevant instance state is settled (typically at the end of perform).

class GenerateThingJob
include Sidekiq::Job
include PlatformSdk::Observability::Langfuse::Traceable
include PlatformSdk::Observability::Langfuse::TraceSummarizable

def perform(args)
  @thing = build_thing(args)
  record_langfuse_trace_output
end

private

def langfuse_trace_output_attributes
  { thing_id: @thing&.id, status: @thing&.status }
end
end