Skip to content

Statistics

Detailed metrics and analytics for deployment activity and resource usage.

EndpointScopeAccess
GET /api/v1/statisticsThe caller’s own scopeUsers with statistics:read

A tenant-scoped user always receives their own tenant’s statistics. A platform administrator receives the whole platform, and may narrow to one tenant with tenant_id; that parameter is ignored for tenant-scoped users, who cannot widen their scope.

Platform-only fields (tenant_count, top_tenants) are null for a tenant-scoped caller; tenant identifies the tenant when the result is confined to one.

period is the window discriminant; days, since and until are subordinate to it, and supplying one against the wrong period is a 400.

ParameterValuesDefaultDescription
periodday, week, month, quarter, year, relative, customweekTime window for statistics
daysPositive integernoneRolling window length, with period=relative
sinceRFC 3339 instantnoneLower bound, with period=custom
untilRFC 3339 instantnoneUpper bound, with period=custom
tenant_idTenant UUIDnonePlatform admins only: narrow scope
Terminal window
# Statistics for your own scope over the last calendar month
curl -H "Authorization: Bearer $TOKEN" \
"https://mantis.example.com/api/v1/statistics?period=month"
# A rolling window of the last 45 days
curl -H "Authorization: Bearer $TOKEN" \
"https://mantis.example.com/api/v1/statistics?period=relative&days=45"
# An explicit range
curl -H "Authorization: Bearer $TOKEN" \
"https://mantis.example.com/api/v1/statistics?period=custom&since=2026-07-01T00:00:00Z&until=2026-07-19T00:00:00Z"
# Platform admins: narrow to one tenant
curl -H "Authorization: Bearer $TOKEN" \
"https://mantis.example.com/api/v1/statistics?tenant_id=019b937d-a39a-8bd5-ad63-b6c422fb96dc&period=week"

Deployments are categorized by their final state:

Every state below is counted in total. Queued has no field of its own: it is reported together with Pending under by_state.pending.

StateDescriptionReported asCounted As
PendingAwaiting dispatchpendingIn-progress
QueuedDispatched, not yet startedpendingIn-progress
RunningCurrently executingrunningIn-progress
SucceededCompleted successfullysucceededSuccess
FailedCompleted with errorsfailedFailure
CancelledManually stoppedcancelledNeither
RolledBackSuperseded by a rollbackrolled_backNeither
{
"by_state": {
"pending": 5,
"running": 10,
"succeeded": 142,
"failed": 8,
"cancelled": 3,
"rolled_back": 2
}
}

Calculated as the percentage of successful deployments out of all deployments in the period:

success_rate = (succeeded / total) × 100

total is the sum of every state in the breakdown — pending (including queued), running, succeeded, failed, cancelled and rolled back. All deployments in the period contribute to the denominator. A row whose status the platform does not define is left out of both.

Example:

  • 5 pending + 10 running + 142 succeeded + 8 failed + 3 cancelled + 2 rolled back = 170 total
  • Success rate = 142 / 170 × 100 = 83.5%

Mean execution time for completed deployments:

{
"avg_duration_ms": 45200
}

Display formats:

DurationFormat
< 1 second850ms
< 1 minute45.2s
≥ 1 minute2.5m

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 }
]
}

The trend data enables:

AnalysisInsight
Daily volumeIdentify peak deployment days
Failure spikesDetect problematic releases
Weekend patternsSee reduced activity periods
Growth trendsTrack deployment frequency over time
Mon Tue Wed Thu Fri Sat Sun
Count 28 32 25 35 20 8 8
Success 26 30 24 33 19 8 7
Failed 2 2 1 2 1 0 1
Rate 92% 94% 96% 94% 95% 100% 88%

Resources scoped to the current tenant:

ResourceDescription
solutionsNumber of solution packages
targetsRegistered deployment targets
environmentsDeployment environments
variablesConfiguration variables
tagsOrganization tags

Resources shared across all tenants:

ResourceDescription
sequencesShared execution sequences
actionsShared action definitions
{
"resource_counts": {
"solutions": 12,
"targets": 24,
"environments": 4,
"variables": 156,
"tags": 18,
"sequences": 8,
"actions": 24
}
}

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": "019b937d-a39a-8bd5-ad63-b6c422fb96dc",
"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": "019b937d-78bc-8a32-a79f-fefe5386b887",
"resource_name": "api-service",
"user": "bob@example.com"
}
]
}

The activity feed surfaces deployment lifecycle events. The event_type field is derived from the deployment status:

Event TypeDescription
deployment_pendingDeployment created, waiting to start
deployment_queuedDeployment queued for execution
deployment_runningDeployment is executing
deployment_successDeployment completed successfully
deployment_failedDeployment failed
deployment_cancelledDeployment was cancelled
deployment_rolled_backDeployment was rolled back

The rule is literal: event_type is deployment_ plus the deployment status, so any status the enum renders can appear here.

┌───────────────────────────────────────────────────────────┐
│ 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 │
│ │
└───────────────────────────────────────────────────────────┘

Administrators see top tenants ranked by activity:

{
"top_tenants": [
{
"tenant_id": "019b937d-a39a-8bd5-ad63-b6c422fb96dc",
"tenant_name": "Acme Corp",
"deployment_count": 48,
"success_rate": 97.9
},
{
"tenant_id": "019b937d-78bc-8a32-a79f-fefe5386b887",
"tenant_name": "Beta Inc",
"deployment_count": 32,
"success_rate": 93.8
},
{
"tenant_id": "019b937d-4172-8af3-aea8-5c3919af26a9",
"tenant_name": "Gamma LLC",
"deployment_count": 28,
"success_rate": 89.3
}
]
}
┌─────────────────────────────────────────────────────────────┐
│ 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% ███████████ │ │
│ └────────────────┴──────────────┴────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
StatusDescription
OnlineTarget has an active session with its assigned Thorax instance
StaleNo heartbeat within the heartbeat timeout (default 90 s); the target then dwells Stale for the stale timeout (default 300 s) before going Offline
OfflineNo heartbeat received within the liveness window (default 360 s); also the initial state for targets that have never connected

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.

┌─────────────────────────────────────────────────────────────┐
│ Target Health │
├─────────────────────────────────────────────────────────────┤
│ │
│ Online: 83% ██████████████████████████████████░░░░░░░░ │
│ │
│ ┌──────────┬──────────┬──────────┬──────────┐ │
│ │ Total │ Online │ Stale │ Offline │ │
│ │ 24 │ 20 │ 2 │ 2 │ │
│ │ │ (83.3%) │ (8.3%) │ (8.3%) │ │
│ └──────────┴──────────┴──────────┴──────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
PeriodDaysDate Range Example
day1Jan 21 only
week7Jan 15 - Jan 21
month30Dec 22 - Jan 21
quarter90Oct 23 - Jan 21
year365Jan 22, 2023 - Jan 21, 2024

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 — a calendar window (day, week, month, quarter, year), a rolling one (relative with days), or an explicit range (custom with since/until):

Terminal window
curl "$MANTIS_URL/api/v1/statistics?period=day" -H "Authorization: Bearer $TOKEN"
curl "$MANTIS_URL/api/v1/statistics?period=week" -H "Authorization: Bearer $TOKEN"
curl "$MANTIS_URL/api/v1/statistics?period=month" -H "Authorization: Bearer $TOKEN"
curl "$MANTIS_URL/api/v1/statistics?period=relative&days=90" -H "Authorization: Bearer $TOKEN"

Statistics are exposed through the REST API (and the Lens dashboard); there is no mantisctl statistics subcommand.

Terminal window
# Statistics for the caller's scope (requires statistics:read)
curl "$MANTIS_URL/api/v1/statistics?period=week" \
-H "Authorization: Bearer $TOKEN"
Terminal window
# Narrow to one tenant (platform administrators only)
curl "$MANTIS_URL/api/v1/statistics?tenant_id=<tenant-id>&period=week" \
-H "Authorization: Bearer $TOKEN"

A tenant-scoped user does not need this: GET /api/v1/statistics already returns their own tenant, and tenant_id is ignored for them.

The endpoint returns JSON. Pipe the response through jq (or redirect to a file) to capture or transform it:

Terminal window
# Save raw JSON
curl -s "$MANTIS_URL/api/v1/statistics?period=month" \
-H "Authorization: Bearer $TOKEN" > stats.json

Track success rate over time:

TrendInterpretationAction
Stable > 95%HealthyContinue monitoring
DecliningProblems emergingInvestigate recent changes
VolatileInconsistentReview deployment practices
Below 90%CriticalImmediate investigation

Recommended alert thresholds:

MetricWarningCritical
Success Rate< 95%< 90%
Avg Duration> 2× baseline> 5× baseline
Failed Deployments> 3 per day> 10 per day
Offline Targets> 5%> 10%
FrequencyFocus
DailyCurrent activity, failures
WeeklyTrends, patterns
MonthlyGrowth, capacity
QuarterlyPerformance optimization
ScenarioRecommended Period
TroubleshootingLast 24 Hours
Weekly reportsLast 7 Days
Trend analysisLast 30 Days
Capacity planningLast 90 Days
Annual reviewLast Year

Cause: Permission or connectivity issue

Solution:

  1. Verify authentication token is valid
  2. Confirm your role has the statistics:read permission (admin, operator, or viewer)
  3. Confirm network connectivity to API

Cause: SSE disconnected or aggregator lag

Solution:

  1. Click refresh button
  2. Check SSE connection status
  3. Verify aggregator service is running

Cause: Period too short or no deployments

Solution:

  1. Extend the window — a longer period, or period=relative&days=<n>
  2. Verify deployments occurred in the window
  3. Check deployment filters