feat(instrumentation-ollama): add duration telemetry span attributes#4194
feat(instrumentation-ollama): add duration telemetry span attributes#4194Saptami191 wants to merge 1 commit into
Conversation
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends Ollama instrumentation by recording four timing metrics as span attributes. The implementation extracts duration values (total, load, prompt evaluation, and inference evaluation) from the Ollama API response and sets them as OpenTelemetry span attributes. Tests verify these attributes are captured and contain non-zero values. ChangesOllama Duration Span Attributes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Before{
"llm.provider": "ollama",
"llm.model": "llama3"
}After{
"llm.provider": "ollama",
"llm.model": "llama3",
"llm.ollama.total_duration": 115588345200,
"llm.ollama.load_duration": 53118691900,
"llm.ollama.prompt_eval_duration": 48132531100,
"llm.ollama.eval_duration": 13506373700
} |
Summary
Adds Ollama duration-related response metadata as tracing span attributes.
Added attributes:
llm.ollama.total_durationllm.ollama.load_durationllm.ollama.prompt_eval_durationllm.ollama.eval_durationChanges
set_model_response_attributes()to capture duration telemetry fields from Ollama responsesVerification
Verified locally through exported span output.
Example observed Ollama response fields:
{ "total_duration": 115588345200, "load_duration": 53118691900, "prompt_eval_duration": 48132531100, "eval_duration": 13506373700 }These values are now exported as tracing span attributes.
Checklist
feat(instrumentation): ...orfix(instrumentation): ....Summary by CodeRabbit
New Features
Tests