Session Metrics
Detailed metrics for monitoring session health, usage patterns, and user engagement across your published applications.
Core Metrics
Active Sessions
The count of sessions currently in the ACTIVE state. This metric updates in real-time and reflects the current load on your application.
const metrics = await gw.provider.analytics.getSessionMetrics({
metric: 'active_sessions',
});
// metrics.current: number
// metrics.peak24h: number
// metrics.average7d: number
Average Duration
The mean time between session creation and termination, measured in minutes. Excludes sessions terminated due to errors.
| Duration Bucket | Description |
|---|---|
| Short (< 5 min) | Quick lookups, single-query sessions |
| Standard (5-30 min) | Typical research sessions |
| Extended (30-120 min) | Deep investigation sessions |
| Long (> 120 min) | Extended analysis workflows |
Completion Rate
The percentage of sessions that reach natural expiration or user-initiated termination, as opposed to error-based termination or timeout.
const completion = await gw.provider.analytics.getCompletionRate({
period: '7d',
breakdown: 'by_app', // or 'by_region', 'by_plan'
});
// completion.rate: number (0-1)
// completion.breakdown: Array<{ key: string; rate: number; count: number }>
Healthy target: 85% or above. A completion rate below 75% may indicate integration issues or poor session UX.
Geographic Distribution
Session origins broken down by country code (ISO 3166-1 alpha-2). Available at daily granularity.
const geo = await gw.provider.analytics.getGeographicDistribution({
period: '30d',
limit: 20,
});
// geo.regions: Array<{ countryCode: string; sessions: number; revenue: number }>
Time-Series Queries
All session metrics support time-series queries with configurable granularity:
const timeSeries = await gw.provider.analytics.getTimeSeries({
metric: 'session_launches',
period: '30d',
granularity: 'daily', // 'hourly' | 'daily' | 'weekly' | 'monthly'
});
// timeSeries.points: Array<{ timestamp: string; value: number }>
Dimensions and Filters
Metrics can be sliced by the following dimensions:
| Dimension | Values | Description |
|---|---|---|
application | App IDs | Filter by specific published application |
region | Country codes | Filter by user geographic region |
session_type | standard, extended, trial | Filter by session pricing tier |
termination_reason | natural, user, error, timeout | Filter by how sessions ended |
const filtered = await gw.provider.analytics.getSessionMetrics({
metric: 'session_launches',
period: '7d',
filters: {
application: 'app_abc123',
region: ['US', 'GB', 'CA'],
},
});
Anomaly Detection
The platform automatically detects anomalies in session patterns and surfaces them in the dashboard. Anomalies are classified by severity:
| Severity | Description | Example |
|---|---|---|
info | Notable but expected variation | Holiday traffic spike |
warning | Unusual pattern requiring attention | 50% drop in completions |
critical | Immediate action recommended | Error terminations > 25% |
Subscribe to anomaly notifications via webhooks or the provider dashboard alert settings.
Rate Limits
Analytics API endpoints are rate-limited separately from session management APIs:
| Endpoint | Rate Limit |
|---|---|
| Real-time metrics | 60 requests/minute |
| Time-series queries | 30 requests/minute |
| Export operations | 5 requests/minute |