Class: Langfuse::CLI::Commands::Metrics

Inherits:
Thor
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/langfuse/cli/commands/metrics.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/langfuse/cli/commands/metrics.rb', line 13

def self.exit_on_failure?
  true
end

Instance Method Details

#queryObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/langfuse/cli/commands/metrics.rb', line 74

def query
  query_params = build_query(options)
  result = client.query_metrics(query_params)

  # Extract data from result if it's wrapped in a data key
  output_data = result.is_a?(Hash) && result['data'] ? result['data'] : result
  output_result(output_data)
rescue Client::AuthenticationError => e
  puts "Authentication Error: #{e.message}"
  exit 1
rescue Client::APIError => e
  puts "Error: #{e.message}"
  exit 1
end