How to Check R2R Logs and Use Analytics & Observability Features
This guide covers various methods to access and analyze R2R logs, as well as leverage R2R’s powerful analytics and observability features. These capabilities allow you to monitor system performance, track usage patterns, and gain valuable insights into your RAG application’s behavior.
The features described in this section are typically restricted to superusers. Ensure you have the necessary permissions before attempting to access these features.
To get meaningful analytics, you can preload your database with random searches:
Copy
Ask AI
import randomfrom r2r import R2R, GenerationConfigapp = R2R()queries = [ "What is artificial intelligence?", "Explain machine learning.", "How does natural language processing work?", "What are neural networks?", "Describe deep learning.", # Add more queries as needed]for _ in range(1000): query = random.choice(queries) app.rag(query, GenerationConfig(model="openai/gpt-4o-mini"))print("Preloading complete. You can now run analytics on this data.")
R2R’s logging, analytics, and observability features provide powerful tools for understanding and optimizing your RAG application. By leveraging these capabilities, you can:
Monitor system performance in real-time
Analyze trends in search and RAG operations
Identify potential bottlenecks or areas for improvement
Track user behavior and usage patterns
Make data-driven decisions to enhance your application’s performance and user experience
Remember to rotate logs regularly and set up log retention policies to manage disk space, especially in production environments.For more advanced usage and customization options, consider joining the R2R Discord community or referring to the detailed R2R documentation.