adonisjs-server-stats 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,16 +118,39 @@ import {
|
|
|
118
118
|
} from 'adonisjs-server-stats/collectors'
|
|
119
119
|
|
|
120
120
|
export default defineConfig({
|
|
121
|
+
// How often to collect and broadcast stats (in milliseconds)
|
|
121
122
|
intervalMs: 3000,
|
|
123
|
+
|
|
124
|
+
// Real-time transport: 'transmit' for SSE via @adonisjs/transmit, 'none' for polling only
|
|
122
125
|
transport: 'transmit',
|
|
126
|
+
|
|
127
|
+
// Transmit channel name clients subscribe to
|
|
123
128
|
channelName: 'admin/server-stats',
|
|
129
|
+
|
|
130
|
+
// HTTP endpoint that serves the latest stats snapshot (set to false to disable)
|
|
124
131
|
endpoint: '/admin/api/server-stats',
|
|
132
|
+
|
|
125
133
|
collectors: [
|
|
134
|
+
// CPU usage, event loop lag, heap/RSS memory, uptime, Node.js version
|
|
126
135
|
processCollector(),
|
|
136
|
+
|
|
137
|
+
// OS load averages, total/free system memory, system uptime
|
|
127
138
|
systemCollector(),
|
|
139
|
+
|
|
140
|
+
// Requests/sec, avg response time, error rate, active connections
|
|
141
|
+
// maxRecords: size of the circular buffer for request tracking
|
|
128
142
|
httpCollector({ maxRecords: 10_000 }),
|
|
143
|
+
|
|
144
|
+
// Lucid connection pool: used/free/pending/max connections
|
|
145
|
+
// Requires @adonisjs/lucid
|
|
129
146
|
dbPoolCollector({ connectionName: 'postgres' }),
|
|
147
|
+
|
|
148
|
+
// Redis server stats: memory, connected clients, keys, hit rate
|
|
149
|
+
// Requires @adonisjs/redis
|
|
130
150
|
redisCollector(),
|
|
151
|
+
|
|
152
|
+
// BullMQ queue stats: active/waiting/delayed/failed jobs
|
|
153
|
+
// Requires bullmq -- connects directly to Redis (not via @adonisjs/redis)
|
|
131
154
|
queueCollector({
|
|
132
155
|
queueName: 'default',
|
|
133
156
|
connection: {
|
|
@@ -136,7 +159,12 @@ export default defineConfig({
|
|
|
136
159
|
password: env.get('QUEUE_REDIS_PASSWORD'),
|
|
137
160
|
},
|
|
138
161
|
}),
|
|
162
|
+
|
|
163
|
+
// Log file stats: errors/warnings in a 5-minute window, entries/minute
|
|
139
164
|
logCollector({ logPath: 'logs/adonisjs.log' }),
|
|
165
|
+
|
|
166
|
+
// App-level metrics: online users, pending webhooks, pending emails
|
|
167
|
+
// Requires @adonisjs/lucid
|
|
140
168
|
appCollector(),
|
|
141
169
|
],
|
|
142
170
|
})
|