feat(gateway): add system.sessionAnalytics usage snapshot RPC
This commit is contained in:
@@ -303,6 +303,42 @@ Online/offline is inferred from inactivity threshold in the daemon.
|
||||
}
|
||||
```
|
||||
|
||||
#### `system.sessionAnalytics`
|
||||
|
||||
Return aggregate session analytics from the SQLite message history.
|
||||
|
||||
Useful for operator dashboards and trend checks (sessions/day, message volume, top active sessions).
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"id": 10,
|
||||
"method": "system.sessionAnalytics",
|
||||
"params": {
|
||||
"days": 30,
|
||||
"topLimit": 10
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"id": 10,
|
||||
"result": {
|
||||
"daily": [
|
||||
{ "day": "2026-02-16", "sessions": 14, "messages": 228 }
|
||||
],
|
||||
"topSessions": [
|
||||
{ "sessionId": "telegram:123456", "messages": 42, "lastActivity": 1739700300 }
|
||||
],
|
||||
"averageMessagesPerSession": 16.29,
|
||||
"totalSessions": 14,
|
||||
"totalMessages": 228
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user