Statistics
Detailed metrics and analytics for deployment activity and resource usage.
Statistics API
Section titled “Statistics API”Endpoints
Section titled “Endpoints”| Endpoint | Scope | Access |
|---|---|---|
GET /api/v1/statistics/global | All tenants | Users with statistics:read permission (admin, operator, viewer) |
GET /api/v1/tenants/{id}/statistics | Single tenant | Tenant members |
Query Parameters
Section titled “Query Parameters”| Parameter | Values | Default | Description |
|---|---|---|---|
period | day, week, month, quarter, year | week | Time window for statistics |
# Get global statistics for last 30 dayscurl -H "Authorization: Bearer $TOKEN" \ "https://mantis.example.com/api/v1/statistics/global?period=month"
# Get tenant statistics for last 7 dayscurl -H "Authorization: Bearer $TOKEN" \ "https://mantis.example.com/api/v1/tenants/abc123/statistics?period=week"Deployment Statistics
Section titled “Deployment Statistics”State Breakdown
Section titled “State Breakdown”Deployments are categorized by their final state:
| State | Description | Counted As |
|---|---|---|
| Pending | Waiting to start | In-progress |
| Running | Currently executing | In-progress |
| Succeeded | Completed successfully | Success |
| Failed | Completed with errors | Failure |
| Cancelled | Manually stopped | Neither |
{ "by_state": { "pending": 5, "running": 10, "succeeded": 142, "failed": 8, "cancelled": 3 }}Success Rate
Section titled “Success Rate”Calculated as the percentage of successful deployments out of all deployments in the period:
success_rate = (succeeded / total) × 100total is the sum of all deployment statuses: pending, running, succeeded, failed, and cancelled. All deployments in the period contribute to the denominator.
Example:
- 5 pending + 10 running + 142 succeeded + 8 failed + 3 cancelled = 168 total
- Success rate = 142 / 168 × 100 = 84.5%
Average Duration
Section titled “Average Duration”Mean execution time for completed deployments:
{ "avg_duration_ms": 45200}Display formats:
| Duration | Format |
|---|---|
| < 1 second | 850ms |
| < 1 minute | 45.2s |
| ≥ 1 minute | 2.5m |
Deployment Trends
Section titled “Deployment Trends”Daily Counts
Section titled “Daily Counts”Statistics include daily deployment counts for trend visualization:
{ "deployment_trend": [ { "date": "2024-01-15", "count": 28, "succeeded": 26, "failed": 2 }, { "date": "2024-01-16", "count": 32, "succeeded": 30, "failed": 2 }, { "date": "2024-01-17", "count": 25, "succeeded": 24, "failed": 1 }, { "date": "2024-01-18", "count": 35, "succeeded": 33, "failed": 2 }, { "date": "2024-01-19", "count": 20, "succeeded": 19, "failed": 1 }, { "date": "2024-01-20", "count": 8, "succeeded": 8, "failed": 0 }, { "date": "2024-01-21", "count": 8, "succeeded": 7, "failed": 1 } ]}Trend Analysis
Section titled “Trend Analysis”The trend data enables:
| Analysis | Insight |
|---|---|
| Daily volume | Identify peak deployment days |
| Failure spikes | Detect problematic releases |
| Weekend patterns | See reduced activity periods |
| Growth trends | Track deployment frequency over time |
Mon Tue Wed Thu Fri Sat SunCount 28 32 25 35 20 8 8Success 26 30 24 33 19 8 7Failed 2 2 1 2 1 0 1Rate 92% 94% 96% 94% 95% 100% 88%Resource Counts
Section titled “Resource Counts”Tenant Resources
Section titled “Tenant Resources”Resources scoped to the current tenant:
| Resource | Description |
|---|---|
| solutions | Number of solution packages |
| targets | Registered deployment targets |
| environments | Deployment environments |
| variables | Configuration variables |
| tags | Organization tags |
Global Resources
Section titled “Global Resources”Resources shared across all tenants:
| Resource | Description |
|---|---|
| sequences | Shared execution sequences |
| actions | Shared action definitions |
{ "resource_counts": { "solutions": 12, "targets": 24, "environments": 4, "variables": 156, "tags": 18, "sequences": 8, "actions": 24 }}Activity Feed
Section titled “Activity Feed”Activity Entries
Section titled “Activity Entries”Recent system activity is tracked:
{ "recent_activity": [ { "timestamp": "2024-01-21T14:30:00Z", "event_type": "deployment_success", "description": "Deployment web-app completed successfully", "resource_type": "deployment", "resource_id": "abc123", "resource_name": "web-app", "user": "alice@example.com" }, { "timestamp": "2024-01-21T14:15:00Z", "event_type": "deployment_failed", "description": "Deployment api-service failed", "resource_type": "deployment", "resource_id": "def456", "resource_name": "api-service", "user": "bob@example.com" } ]}Event Types
Section titled “Event Types”The activity feed surfaces deployment lifecycle events. The event_type field is derived from the deployment status:
| Event Type | Description |
|---|---|
deployment_pending | Deployment created, waiting to start |
deployment_queued | Deployment queued for execution |
deployment_running | Deployment is executing |
deployment_success | Deployment completed successfully |
deployment_failed | Deployment failed |
deployment_cancelled | Deployment was cancelled |
Activity Timeline
Section titled “Activity Timeline”┌───────────────────────────────────────────────────────────┐│ Recent Activity │├───────────────────────────────────────────────────────────┤│ ││ ● 14:30 deployment_success ││ web-app completed successfully ││ by alice@example.com ││ ││ ● 14:15 deployment_failed ││ api-service failed ││ by bob@example.com ││ ││ ● 13:45 deployment_running ││ backend-services started ││ by carol@example.com ││ ││ ● 13:00 deployment_cancelled ││ web-app v1.2.2 was cancelled ││ by dave@example.com ││ │└───────────────────────────────────────────────────────────┘Top Tenants
Section titled “Top Tenants”Global Dashboard Only
Section titled “Global Dashboard Only”Administrators see top tenants ranked by activity:
{ "top_tenants": [ { "tenant_id": "abc123", "tenant_name": "Acme Corp", "deployment_count": 48, "success_rate": 97.9 }, { "tenant_id": "def456", "tenant_name": "Beta Inc", "deployment_count": 32, "success_rate": 93.8 }, { "tenant_id": "ghi789", "tenant_name": "Gamma LLC", "deployment_count": 28, "success_rate": 89.3 } ]}Tenant Ranking
Section titled “Tenant Ranking”┌─────────────────────────────────────────────────────────────┐│ Top Tenants by Deployment Activity │├─────────────────────────────────────────────────────────────┤│ ││ ┌────────────────┬──────────────┬────────────────────┐ ││ │ Tenant │ Deployments │ Success Rate │ ││ ├────────────────┼──────────────┼────────────────────┤ ││ │ 🥇 Acme Corp │ 48 │ 97.9% ████████████│ ││ │ 🥈 Beta Inc │ 32 │ 93.8% ███████████ │ ││ │ 🥉 Gamma LLC │ 28 │ 89.3% ██████████ │ ││ │ Delta Co │ 15 │ 86.7% █████████ │ ││ │ Epsilon Ltd │ 12 │ 91.7% ███████████ │ ││ └────────────────┴──────────────┴────────────────────┘ ││ │└─────────────────────────────────────────────────────────────┘Target Health Statistics
Section titled “Target Health Statistics”Status Breakdown
Section titled “Status Breakdown”| Status | Description |
|---|---|
| Online | Target has an active session with its assigned Thorax instance |
| Stale | Session has gone idle; set by Thorax after the configured stale timeout (default 300 s) |
| Offline | No heartbeat received within the liveness window (default 360 s); also the initial state for targets that have never connected |
Health Metrics
Section titled “Health Metrics”Target health counts are not part of the statistics API response (which
carries deployment_stats, resource_counts, and recent_activity). Query
target health via the targets API (GET /api/v1/targets, filterable by
status) or the real-time SSE target stream.
Health Percentage
Section titled “Health Percentage”┌─────────────────────────────────────────────────────────────┐│ Target Health │├─────────────────────────────────────────────────────────────┤│ ││ Online: 83% ██████████████████████████████████░░░░░░░░ ││ ││ ┌──────────┬──────────┬──────────┬──────────┐ ││ │ Total │ Online │ Stale │ Offline │ ││ │ 24 │ 20 │ 2 │ 2 │ ││ │ │ (83.3%) │ (8.3%) │ (8.3%) │ ││ └──────────┴──────────┴──────────┴──────────┘ ││ │└─────────────────────────────────────────────────────────────┘Time Periods
Section titled “Time Periods”Period Mapping
Section titled “Period Mapping”| Period | Days | Date Range Example |
|---|---|---|
day | 1 | Jan 21 only |
week | 7 | Jan 15 - Jan 21 |
month | 30 | Dec 22 - Jan 21 |
quarter | 90 | Oct 23 - Jan 21 |
year | 365 | Jan 22, 2023 - Jan 21, 2024 |
Selecting Periods
Section titled “Selecting Periods”Via Lens UI:
Period: [Last 7 Days ▼] ┌─────────────────────┐ │ Last 24 Hours │ │ Last 7 Days ● │ │ Last 30 Days │ │ Last 90 Days │ │ Last Year │ └─────────────────────┘Via the REST API, select the period with the ?period= query parameter
(day, week, month, quarter, or year):
curl "$MANTIS_URL/api/v1/statistics/global?period=day" -H "Authorization: Bearer $TOKEN"curl "$MANTIS_URL/api/v1/statistics/global?period=week" -H "Authorization: Bearer $TOKEN"curl "$MANTIS_URL/api/v1/statistics/global?period=month" -H "Authorization: Bearer $TOKEN"API Usage
Section titled “API Usage”Statistics are exposed through the REST API (and the Lens dashboard); there is no
mantisctl statistics subcommand.
Global Statistics
Section titled “Global Statistics”# Get global statistics (requires statistics:read permission)curl "$MANTIS_URL/api/v1/statistics/global?period=week" \ -H "Authorization: Bearer $TOKEN"Tenant Statistics
Section titled “Tenant Statistics”# Get statistics for a specific tenant (by tenant ID)curl "$MANTIS_URL/api/v1/tenants/<tenant-id>/statistics?period=week" \ -H "Authorization: Bearer $TOKEN"Exporting Statistics
Section titled “Exporting Statistics”The endpoints return JSON. Pipe the response through jq (or redirect to a file)
to capture or transform it:
# Save raw JSONcurl -s "$MANTIS_URL/api/v1/statistics/global?period=month" \ -H "Authorization: Bearer $TOKEN" > stats.jsonBest Practices
Section titled “Best Practices”1. Monitor Success Rate Trends
Section titled “1. Monitor Success Rate Trends”Track success rate over time:
| Trend | Interpretation | Action |
|---|---|---|
| Stable > 95% | Healthy | Continue monitoring |
| Declining | Problems emerging | Investigate recent changes |
| Volatile | Inconsistent | Review deployment practices |
| Below 90% | Critical | Immediate investigation |
2. Set Alert Thresholds
Section titled “2. Set Alert Thresholds”Recommended alert thresholds:
| Metric | Warning | Critical |
|---|---|---|
| Success Rate | < 95% | < 90% |
| Avg Duration | > 2× baseline | > 5× baseline |
| Failed Deployments | > 3 per day | > 10 per day |
| Offline Targets | > 5% | > 10% |
3. Review Regularly
Section titled “3. Review Regularly”| Frequency | Focus |
|---|---|
| Daily | Current activity, failures |
| Weekly | Trends, patterns |
| Monthly | Growth, capacity |
| Quarterly | Performance optimization |
4. Use Appropriate Time Periods
Section titled “4. Use Appropriate Time Periods”| Scenario | Recommended Period |
|---|---|
| Troubleshooting | Last 24 Hours |
| Weekly reports | Last 7 Days |
| Trend analysis | Last 30 Days |
| Capacity planning | Last 90 Days |
| Annual review | Last Year |
Troubleshooting
Section titled “Troubleshooting”Statistics Not Loading
Section titled “Statistics Not Loading”Cause: Permission or connectivity issue
Solution:
- Verify authentication token is valid
- Confirm your role has the
statistics:readpermission (admin, operator, or viewer) - Confirm network connectivity to API
Stale Data
Section titled “Stale Data”Cause: SSE disconnected or aggregator lag
Solution:
- Click refresh button
- Check SSE connection status
- Verify aggregator service is running
Missing Trend Data
Section titled “Missing Trend Data”Cause: Period too short or no deployments
Solution:
- Extend time period
- Verify deployments occurred in period
- Check deployment filters
Next Steps
Section titled “Next Steps”- Real-time Updates - Live statistics updates
- Dashboard Overview - Dashboard features
- Audit Logs - Detailed event logging
