Introduction
This guide demonstrates how to leverage R2R’s powerful analytics and logging 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 cookbook are typically restricted to superusers. Ensure you have the necessary permissions before attempting to access these features.
Setup
Before diving into the authentication features, ensure you have R2R installed and configured as described in the installation guide. For this guide, we’ll use the default configuration. Further,r2r serve must be called to serve R2R in either your local environment or local Docker engine.
Basic Usage
Logging
R2R automatically logs various events and metrics during its operation. To fetch our logs using the client-server architecture, use the following:- CLI
- Python
- JavaScript
- Curl
Analytics
R2R offers an analytics feature that allows you to aggregate and analyze log data: The relevant command- CLI
- Python
- JavaScript
- Curl
- Filter logs based on specific criteria
- Perform statistical analysis on various metrics (e.g., search latencies)
- Track performance trends over time
- Identify potential bottlenecks or areas for optimization
Experimental Features
Custom Analytics
R2R’s analytics system is flexible and allows for custom analysis. You can specify different filters and analysis types to focus on specific aspects of your application’s performance.Preloading Data for Analysis
To get meaningful analytics, you need a substantial amount of data. Here’s a script to preload your database with random searches:User-Level Analytics
To get analytics for a specific user:Summary
R2R’s logging and analytics 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

