Quick Start
For immediate visibility, attach the built-in logger:lib/my_app/application.ex
graph: true enabled:
Logger Options
Event Reference
All events use:telemetry.span/3, which emits :start, :stop, and :exception variants automatically.
Core Events
| Event | Measurements | Metadata |
|---|---|---|
[:arcana, :ingest, :*] | system_time, duration | text, repo, collection, document, chunk_count |
[:arcana, :search, :*] | system_time, duration | query, repo, mode, limit, results, result_count |
[:arcana, :ask, :*] | system_time, duration | question, repo, answer, context_count |
[:arcana, :embed, :*] | system_time, duration | text, dimensions |
[:arcana, :llm, :complete, :*] | system_time, duration | model, prompt_length, success, response_length, error |
Agent Pipeline Events
Each step in the Agent pipeline emits its own events:| Event | Metadata |
|---|---|
[:arcana, :agent, :gate, :*] | question, skip_retrieval |
[:arcana, :agent, :rewrite, :*] | question, rewritten_query |
[:arcana, :agent, :select, :*] | selected (collections) |
[:arcana, :agent, :expand, :*] | question, expanded_query |
[:arcana, :agent, :decompose, :*] | question, sub_question_count |
[:arcana, :agent, :search, :*] | question, total_chunks |
[:arcana, :agent, :reason, :*] | question, iterations |
[:arcana, :agent, :rerank, :*] | question, chunks_before, chunks_after |
[:arcana, :agent, :answer, :*] | question, context_chunk_count |
GraphRAG Events
When usinggraph: true, these events track knowledge graph operations:
| Event | Metadata |
|---|---|
[:arcana, :graph, :build, :*] | chunk_count, collection, entity_count, relationship_count |
[:arcana, :graph, :search, :*] | query, entity_count, graph_result_count, combined_count |
[:arcana, :graph, :ner, :*] | text, entity_count |
[:arcana, :graph, :relationship_extraction, :*] | text, relationship_count |
[:arcana, :graph, :community_detection, :*] | entity_count, community_count |
[:arcana, :graph, :community_summary, :*] | entity_count, summary_length |
VectorStore and GraphStore Events
Storage layer events for vector and graph operations:- VectorStore
- GraphStore
| Event | Metadata |
|---|---|
[:arcana, :vector_store, :store, :*] | collection, id, backend |
[:arcana, :vector_store, :search, :*] | collection, limit, backend, result_count |
[:arcana, :vector_store, :search_text, :*] | collection, query, limit, backend, result_count |
[:arcana, :vector_store, :delete, :*] | collection, id, backend |
[:arcana, :vector_store, :clear, :*] | collection, backend |
Exception Events
All:exception events include:
kind- The exception type (:error,:exit,:throw)reason- The exception or error termstacktrace- Full stacktrace
Custom Handlers
For more control, attach your own handlers:lib/my_app/arcana_metrics.ex
MyApp.ArcanaMetrics.setup() in your application startup.
Phoenix LiveDashboard Integration
Add Arcana metrics to your LiveDashboard:lib/my_app/telemetry.ex
lib/my_app_web/router.ex
Prometheus Integration
For production monitoring with Prometheus, useprom_ex:
mix.exs
lib/my_app/prom_ex/arcana_plugin.ex
Debugging Performance Issues
Identify Slow Operations
The built-in logger makes it easy to spot bottlenecks:In this example, the LLM call dominates total time (3.2s of 3.3s).
Track Agent Pipeline Steps
For agentic RAG, each pipeline step is instrumented:Reranking too slow?
Reranking too slow?
If reranking takes too long, consider:
- Reducing chunks before reranking (lower search limit)
- Using a faster reranking threshold
- Implementing a custom reranker
Too many reason iterations?
Too many reason iterations?
If
reason/2 is taking too long:- Lower
max_iterations(default: 2) - Improve initial search quality with query expansion
Monitor LLM Costs
Track prompt sizes to estimate API costs:Error Tracking
Handle exceptions to send to your error tracking service:Best Practices
Start with built-in logger
Zero-config logging helps you understand what’s happening
Focus on LLM latency
LLM calls are usually the bottleneck - track them closely
Monitor reranking
Watch the kept/original ratio when using Agent.rerank/2
Tag by collection
Identify slow document sets by tagging metrics with collection names
Set up alerts
Alert on LLM failures and unusually slow operations
Log in production
Keep at least :info level logging for debugging issues
Next Steps
Evaluation
Measure retrieval quality alongside performance
Dashboard
View operations and results in the web UI
Agentic RAG
Monitor complex pipeline steps
GraphRAG
Track entity extraction and graph building