-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Description
In version 3.7.1 of ruby_llm-agents, the Pipeline::Middleware::Instrumentation fails to extract and store several key fields into the ruby_llm_agents_executions table, even though these fields are included in the gem's standard migration template.
Issues Identified
model_provideris never set: The migration definest.string :model_provider, but the instrumentation middleware only records themodel_id. This makes it difficult to run analytics and cost reports grouped by provider (e.g., OpenAI vs. Gemini).- Missing Tracing Fields:
request_idandtrace_idare present in the schema but are not extracted from the agent's metadata or the execution context, which breaks distributed tracing for LLM calls. - Hierarchy Fallbacks: The middleware doesn't always fallback to checking agent metadata for
parent_execution_idorroot_execution_idif they aren't explicitly present in the pipeline context.
Suggested Resolution
Update Instrumentation#build_running_execution_data and Instrumentation#build_completion_data to automatically resolve the provider and extract tracing IDs.
Example Fix for model_provider:
# Inside Instrumentation middleware
data[:model_provider] = RubyLLM::Models.find(context.model_used || context.model).provider rescue nilExample Fix for Tracing IDs:
agent_meta = safe_agent_metadata(context)
data[:request_id] = agent_meta[:request_id] if agent_meta[:request_id]
data[:trace_id] = agent_meta[:trace_id] if agent_meta[:trace_id]Environment
ruby_llm-agents: 3.7.1ruby_llm: 1.12.1ruby_llm-schema: 0.3.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels