Usage Analytics
Monitor your API usage, track performance metrics, and analyze governance events with TORK's comprehensive analytics dashboard.
Overview
The TORK analytics dashboard provides real-time insights into your AI governance platform. Track API calls, monitor response times, analyze governance events, and export detailed reports for compliance and optimization.
API Metrics
Total calls, success rates, and error tracking
Performance
Response times, P95/P99 latencies
Governance
PII detections, violations, jailbreaks
Trends
Historical data and comparisons
Key Metrics
API Usage Metrics
| Metric | Description |
|---|---|
| total_calls | Total number of API calls made |
| successful_calls | API calls that completed successfully (2xx) |
| failed_calls | API calls that failed (4xx, 5xx) |
| avg_response_time_ms | Average response time in milliseconds |
| p95_response_time_ms | 95th percentile response time |
| p99_response_time_ms | 99th percentile response time |
Governance Metrics
| Metric | Description |
|---|---|
| pii_detections | PII instances detected and redacted |
| policy_violations | Policy rule violations blocked |
| jailbreak_attempts | Jailbreak/prompt injection attempts blocked |
| rate_limit_hits | Requests rejected due to rate limits |
| circuit_breaker_triggers | Circuit breaker activations |
Time Ranges
Analytics data can be viewed across different time periods:
Data Retention
API Reference
Access analytics data programmatically using the Analytics API.
Get Analytics Summary
curl -X GET "https://api.tork.network/v1/analytics?range=7d" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
{
"success": true,
"data": {
"summary": {
"totalCalls": 15420,
"successfulCalls": 14980,
"failedCalls": 440,
"avgResponseTime": 145.2,
"piiDetections": 234,
"policyViolations": 56,
"jailbreakAttempts": 12,
"rateLimitHits": 89
},
"comparison": {
"callsChange": 12.5,
"successRateChange": -0.3,
"responseTimeChange": -5.2,
"piiChange": 8.1
},
"timeRange": {
"label": "7d",
"start": "2024-01-14T00:00:00Z",
"end": "2024-01-21T00:00:00Z"
}
}
}Available Endpoints
| Endpoint | Description |
|---|---|
| GET /v1/analytics | Summary metrics with period comparison |
| GET /v1/analytics/trends | Daily trend data for charts |
| GET /v1/analytics/heatmap | Hourly usage patterns by day of week |
| GET /v1/analytics/endpoints | Breakdown by API endpoint |
| GET /v1/analytics/agents | Top agents by usage |
| GET /v1/analytics/export | Export data as CSV |
Exporting Data
Export analytics data as CSV for external analysis, reporting, or compliance documentation.
Export Types
Summary Report
Overview metrics and totals for the period
Daily Breakdown
Day-by-day analytics with all metrics
Hourly Details
Hour-by-hour granular data (last 7 days)
Governance Events
PII, violations, and jailbreak data
API Export
# Export daily breakdown as CSV
curl -X GET "https://api.tork.network/v1/analytics/export?range=30d&type=daily" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o analytics-daily-30d.csvAnalytics Alerts
Configure alerts to get notified when metrics exceed thresholds.
Available Alert Metrics
error_rate- Percentage of failed API callspii_detections- Number of PII instances detectedpolicy_violations- Policy violations per time windowresponse_time- Average response time in msrate_limit_hits- Rate limit rejectionsjailbreak_attempts- Jailbreak detection count
Create Alert via API
curl -X POST "https://api.tork.network/v1/analytics/alerts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "High Error Rate Alert",
"metric": "error_rate",
"condition": "above",
"threshold": 5,
"time_window_minutes": 60,
"notify_email": true,
"notify_slack": true
}'Best Practices
Monitor Key Metrics
Set up alerts for error rate, response time, and governance events. Aim for less than 1% error rate and sub-200ms average response times.
Review Usage Patterns
Use the heatmap to identify peak usage hours. Consider scaling resources or adjusting rate limits based on patterns.
Regular Exports
Export analytics data monthly for compliance documentation. Keep governance event exports for audit trails.
Track Agent Performance
Monitor individual agent success rates. Investigate agents with lower than 95% success rate for potential issues.