@rudderjs/pulse 5.0.0 → 6.1.0
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 +16 -16
- package/boost/guidelines.md +22 -11
- package/dist/api/routes.d.ts +11 -4
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +117 -135
- package/dist/api/routes.js.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -31
- package/dist/index.js.map +1 -1
- package/dist/recorders/cache.d.ts +11 -0
- package/dist/recorders/cache.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/cache.js +2 -2
- package/dist/recorders/cache.js.map +1 -0
- package/dist/recorders/exception.d.ts +11 -0
- package/dist/recorders/exception.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/exception.js +2 -2
- package/dist/recorders/exception.js.map +1 -0
- package/dist/{aggregators → recorders}/query.d.ts +3 -3
- package/dist/recorders/query.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/query.js +2 -2
- package/dist/recorders/query.js.map +1 -0
- package/dist/recorders/queue.d.ts +19 -0
- package/dist/recorders/queue.d.ts.map +1 -0
- package/dist/recorders/queue.js +52 -0
- package/dist/recorders/queue.js.map +1 -0
- package/dist/{aggregators → recorders}/request.d.ts +3 -3
- package/dist/recorders/request.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/request.js +2 -2
- package/dist/recorders/request.js.map +1 -0
- package/dist/{aggregators → recorders}/server.d.ts +3 -3
- package/dist/recorders/server.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/server.js +2 -2
- package/dist/recorders/server.js.map +1 -0
- package/dist/{aggregators → recorders}/user.d.ts +3 -3
- package/dist/recorders/user.d.ts.map +1 -0
- package/dist/{aggregators → recorders}/user.js +2 -2
- package/dist/recorders/user.js.map +1 -0
- package/dist/routes.d.ts +23 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +44 -0
- package/dist/routes.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/views/vanilla/Dashboard.d.ts +11 -0
- package/dist/views/vanilla/Dashboard.d.ts.map +1 -0
- package/dist/{ui/dashboard.js → views/vanilla/Dashboard.js} +11 -7
- package/dist/views/vanilla/Dashboard.js.map +1 -0
- package/dist/views/vanilla/Layout.d.ts +13 -0
- package/dist/views/vanilla/Layout.d.ts.map +1 -0
- package/dist/{ui/layout.js → views/vanilla/Layout.js} +8 -15
- package/dist/views/vanilla/Layout.js.map +1 -0
- package/dist/views/vanilla/_html.d.ts +28 -0
- package/dist/views/vanilla/_html.d.ts.map +1 -0
- package/dist/views/vanilla/_html.js +56 -0
- package/dist/views/vanilla/_html.js.map +1 -0
- package/dist/views/vanilla/index.d.ts +4 -0
- package/dist/views/vanilla/index.d.ts.map +1 -0
- package/dist/views/vanilla/index.js +4 -0
- package/dist/views/vanilla/index.js.map +1 -0
- package/package.json +9 -8
- package/dist/aggregators/cache.d.ts +0 -11
- package/dist/aggregators/cache.d.ts.map +0 -1
- package/dist/aggregators/cache.js.map +0 -1
- package/dist/aggregators/exception.d.ts +0 -11
- package/dist/aggregators/exception.d.ts.map +0 -1
- package/dist/aggregators/exception.js.map +0 -1
- package/dist/aggregators/query.d.ts.map +0 -1
- package/dist/aggregators/query.js.map +0 -1
- package/dist/aggregators/queue.d.ts +0 -12
- package/dist/aggregators/queue.d.ts.map +0 -1
- package/dist/aggregators/queue.js +0 -43
- package/dist/aggregators/queue.js.map +0 -1
- package/dist/aggregators/request.d.ts.map +0 -1
- package/dist/aggregators/request.js.map +0 -1
- package/dist/aggregators/server.d.ts.map +0 -1
- package/dist/aggregators/server.js.map +0 -1
- package/dist/aggregators/user.d.ts.map +0 -1
- package/dist/aggregators/user.js.map +0 -1
- package/dist/ui/dashboard.d.ts +0 -5
- package/dist/ui/dashboard.d.ts.map +0 -1
- package/dist/ui/dashboard.js.map +0 -1
- package/dist/ui/layout.d.ts +0 -6
- package/dist/ui/layout.d.ts.map +0 -1
- package/dist/ui/layout.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @rudderjs/pulse
|
|
2
2
|
|
|
3
|
-
Application performance monitoring for RudderJS —
|
|
3
|
+
Application performance monitoring for RudderJS — records request throughput, queue metrics, cache hit rates, exceptions, active users, slow queries, and server resource usage.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -53,12 +53,12 @@ const overview = await Pulse.overview(since)
|
|
|
53
53
|
|------|--------|
|
|
54
54
|
| `request_count` | Request middleware |
|
|
55
55
|
| `request_duration` | Request middleware |
|
|
56
|
-
| `queue_throughput` | Queue
|
|
57
|
-
| `queue_wait_time` | Queue
|
|
58
|
-
| `cache_hits` / `cache_misses` | Cache
|
|
59
|
-
| `exceptions` | Exception
|
|
60
|
-
| `active_users` | User
|
|
61
|
-
| `server_cpu` / `server_memory` | Server
|
|
56
|
+
| `queue_throughput` | Queue recorder |
|
|
57
|
+
| `queue_wait_time` | Queue recorder |
|
|
58
|
+
| `cache_hits` / `cache_misses` | Cache recorder |
|
|
59
|
+
| `exceptions` | Exception recorder |
|
|
60
|
+
| `active_users` | User recorder middleware |
|
|
61
|
+
| `server_cpu` / `server_memory` | Server recorder (periodic) |
|
|
62
62
|
|
|
63
63
|
## Storage Drivers
|
|
64
64
|
|
|
@@ -88,17 +88,17 @@ export default {
|
|
|
88
88
|
} satisfies PulseConfig
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
##
|
|
91
|
+
## Recorders
|
|
92
92
|
|
|
93
|
-
Pulse auto-registers
|
|
93
|
+
Pulse auto-registers recorders based on config:
|
|
94
94
|
|
|
95
|
-
- **
|
|
96
|
-
- **
|
|
97
|
-
- **
|
|
98
|
-
- **
|
|
99
|
-
- **
|
|
100
|
-
- **
|
|
101
|
-
- **
|
|
95
|
+
- **RequestRecorder** — Tracks request throughput and duration via middleware
|
|
96
|
+
- **QueueRecorder** — Tracks queue throughput and wait times
|
|
97
|
+
- **CacheRecorder** — Tracks cache hit/miss rates
|
|
98
|
+
- **ExceptionRecorder** — Counts unhandled exceptions
|
|
99
|
+
- **QueryRecorder** — Records slow database queries
|
|
100
|
+
- **UserRecorder** — Tracks unique active users via middleware
|
|
101
|
+
- **ServerRecorder** — Periodically records CPU and memory usage
|
|
102
102
|
|
|
103
103
|
## Notes
|
|
104
104
|
|
package/boost/guidelines.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What This Package Does
|
|
4
4
|
|
|
5
|
-
Pulse is an application metrics dashboard for RudderJS applications. It
|
|
5
|
+
Pulse is an application metrics dashboard for RudderJS applications. It records time-series data (request throughput, cache hit rates, queue metrics, server stats) into 1-minute buckets and exposes a JSON API + a single-page dashboard at `/pulse`.
|
|
6
6
|
|
|
7
7
|
## Architecture
|
|
8
8
|
|
|
@@ -10,18 +10,28 @@ Two data models:
|
|
|
10
10
|
1. **Aggregates** — Time-bucketed metrics (1-minute resolution). Used for throughput, duration, hit rates.
|
|
11
11
|
2. **Entries** — Individual notable events (slow requests, slow queries, exceptions, failed jobs).
|
|
12
12
|
|
|
13
|
-
Seven
|
|
14
|
-
- `
|
|
15
|
-
- `
|
|
16
|
-
- `
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
13
|
+
Seven recorders collect data:
|
|
14
|
+
- `RequestRecorder` — middleware: request count + duration
|
|
15
|
+
- `QueueRecorder` — wraps adapter: throughput + wait time + failures
|
|
16
|
+
- `CacheRecorder` — wraps adapter: hit/miss counting
|
|
17
|
+
- `ExceptionRecorder` — exception reporter hook
|
|
18
|
+
- `UserRecorder` — middleware: unique users per minute
|
|
19
|
+
- `QueryRecorder` — ORM hook: slow query detection
|
|
20
|
+
- `ServerRecorder` — periodic: CPU + memory
|
|
21
|
+
|
|
22
|
+
### File Layout
|
|
23
|
+
|
|
24
|
+
- `src/index.ts` — `PulseProvider`, `Pulse` facade, `PulseRegistry`, public re-exports
|
|
25
|
+
- `src/types.ts` — `PulseAggregate`, `PulseEntry`, `Recorder`, `PulseStorage`, `PulseConfig`
|
|
26
|
+
- `src/storage.ts` — `MemoryStorage`, `SqliteStorage`
|
|
27
|
+
- `src/recorders/` — seven recorder classes (request, queue, cache, exception, query, user, server)
|
|
28
|
+
- `src/routes.ts` — `registerPulseRoutes(storage, opts)` — UI + API route registration. Mirrors `@rudderjs/telescope`'s `registerTelescopeRoutes()`.
|
|
29
|
+
- `src/api/routes.ts` — pure handler functions (`getOverview`, `getRequests`, `listSlowRequests`, `authMiddleware`, …) called from `routes.ts`. Holds no router calls.
|
|
30
|
+
- `src/views/vanilla/` — UI: `Layout`, `Dashboard` (single page), `_html` (auto-escape helper), `index.ts` barrel.
|
|
21
31
|
|
|
22
32
|
## Key Patterns
|
|
23
33
|
|
|
24
|
-
-
|
|
34
|
+
- Recorders implement the `Recorder` interface with a `register()` method
|
|
25
35
|
- `storage.record(type, value, key?)` increments a 1-minute bucket aggregate
|
|
26
36
|
- `storage.storeEntry(type, content)` records individual notable events
|
|
27
37
|
- API endpoints support `?period=1h|6h|24h|7d` for time range selection
|
|
@@ -29,5 +39,6 @@ Seven aggregators collect data:
|
|
|
29
39
|
## Do NOT
|
|
30
40
|
|
|
31
41
|
- Import peer dependencies statically — always use dynamic `import()` with try/catch
|
|
32
|
-
- Record Pulse's own API requests (
|
|
42
|
+
- Record Pulse's own API requests (RequestRecorder skips `/pulse*`)
|
|
33
43
|
- Store high-cardinality keys in aggregates — keep `key` to queue names, route patterns, not full URLs
|
|
44
|
+
- Use the old `*Aggregator` class names — renamed to `*Recorder` in v6 to align with Laravel Pulse vocabulary
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import type { AppRequest, AppResponse, MiddlewareHandler } from '@rudderjs/contracts';
|
|
1
2
|
import type { PulseStorage, PulseConfig } from '../types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
3
|
+
export declare function getOverview(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
4
|
+
export declare function getRequests(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
5
|
+
export declare function listSlowRequests(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
6
|
+
export declare function getQueues(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
7
|
+
export declare function listSlowQueries(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
8
|
+
export declare function getExceptions(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
9
|
+
export declare function getCache(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
10
|
+
export declare function getUsers(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
11
|
+
export declare function getServers(storage: PulseStorage, req: AppRequest, res: AppResponse): Promise<void>;
|
|
12
|
+
export declare function authMiddleware(config: Pick<PulseConfig, 'auth'>): MiddlewareHandler;
|
|
6
13
|
//# sourceMappingURL=routes.d.ts.map
|
package/dist/api/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAyC5D,wBAAsB,WAAW,CAC/B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,UAAU,CAC9B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAM,UAAU,EACnB,GAAG,EAAM,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CASf;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAWnF"}
|
package/dist/api/routes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ─── Period parsing ───────────────────────────────────────
|
|
2
2
|
const PERIODS = {
|
|
3
3
|
'1h': 60 * 60 * 1000,
|
|
4
4
|
'6h': 6 * 60 * 60 * 1000,
|
|
@@ -9,139 +9,6 @@ function sinceFromPeriod(period) {
|
|
|
9
9
|
const ms = PERIODS[period] ?? PERIODS['1h'];
|
|
10
10
|
return new Date(Date.now() - ms);
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Register all Pulse API routes on the router.
|
|
14
|
-
*/
|
|
15
|
-
export async function registerRoutes(storage, config) {
|
|
16
|
-
const { router } = await import('@rudderjs/router');
|
|
17
|
-
const basePath = `/${config.path ?? 'pulse'}`;
|
|
18
|
-
const prefix = `${basePath}/api`;
|
|
19
|
-
const middleware = config.auth ? [authMiddleware(config)] : [];
|
|
20
|
-
// ── Dashboard UI ─────────────────────────────────────────
|
|
21
|
-
router.get(basePath, (_req, res) => {
|
|
22
|
-
res.header('Content-Type', 'text/html').send(dashboardPage(prefix));
|
|
23
|
-
}, middleware);
|
|
24
|
-
// ── Overview ─────────────────────────────────────────────
|
|
25
|
-
router.get(`${prefix}/overview`, async (req, res) => {
|
|
26
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
27
|
-
const aggregates = await storage.overview(since);
|
|
28
|
-
// Group by type and compute summary stats
|
|
29
|
-
const summary = {};
|
|
30
|
-
for (const agg of aggregates) {
|
|
31
|
-
if (!summary[agg.type]) {
|
|
32
|
-
summary[agg.type] = { count: 0, sum: 0, min: null, max: null, buckets: 0 };
|
|
33
|
-
}
|
|
34
|
-
const s = summary[agg.type];
|
|
35
|
-
s.count += agg.count;
|
|
36
|
-
s.sum += agg.sum;
|
|
37
|
-
s.buckets += 1;
|
|
38
|
-
if (agg.min !== null && (s.min === null || agg.min < s.min))
|
|
39
|
-
s.min = agg.min;
|
|
40
|
-
if (agg.max !== null && (s.max === null || agg.max > s.max))
|
|
41
|
-
s.max = agg.max;
|
|
42
|
-
}
|
|
43
|
-
// Compute averages
|
|
44
|
-
const metrics = {};
|
|
45
|
-
for (const [type, s] of Object.entries(summary)) {
|
|
46
|
-
metrics[type] = {
|
|
47
|
-
total: s.count,
|
|
48
|
-
avg: s.count > 0 ? Math.round((s.sum / s.count) * 100) / 100 : 0,
|
|
49
|
-
min: s.min,
|
|
50
|
-
max: s.max,
|
|
51
|
-
buckets: s.buckets,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
res.json({ period: req.query['period'] ?? '1h', metrics });
|
|
55
|
-
}, middleware);
|
|
56
|
-
// ── Request metrics ──────────────────────────────────────
|
|
57
|
-
router.get(`${prefix}/requests`, async (req, res) => {
|
|
58
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
59
|
-
const counts = await storage.aggregates('request_count', since);
|
|
60
|
-
const durations = await storage.aggregates('request_duration', since);
|
|
61
|
-
res.json({
|
|
62
|
-
throughput: counts.map(bucketToJson),
|
|
63
|
-
duration: durations.map(a => ({
|
|
64
|
-
...bucketToJson(a),
|
|
65
|
-
avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0,
|
|
66
|
-
})),
|
|
67
|
-
});
|
|
68
|
-
}, middleware);
|
|
69
|
-
// ── Slow requests ────────────────────────────────────────
|
|
70
|
-
router.get(`${prefix}/slow-requests`, async (req, res) => {
|
|
71
|
-
const entries = await storage.entries('slow_request', {
|
|
72
|
-
page: parseInt(req.query['page'] ?? '1', 10),
|
|
73
|
-
perPage: parseInt(req.query['per_page'] ?? '50', 10),
|
|
74
|
-
});
|
|
75
|
-
res.json({ data: entries });
|
|
76
|
-
}, middleware);
|
|
77
|
-
// ── Queue metrics ────────────────────────────────────────
|
|
78
|
-
router.get(`${prefix}/queues`, async (req, res) => {
|
|
79
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
80
|
-
const throughput = await storage.aggregates('queue_throughput', since);
|
|
81
|
-
const waitTimes = await storage.aggregates('queue_wait_time', since);
|
|
82
|
-
res.json({
|
|
83
|
-
throughput: throughput.map(bucketToJson),
|
|
84
|
-
wait_time: waitTimes.map(a => ({
|
|
85
|
-
...bucketToJson(a),
|
|
86
|
-
avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0,
|
|
87
|
-
})),
|
|
88
|
-
});
|
|
89
|
-
}, middleware);
|
|
90
|
-
// ── Slow queries ─────────────────────────────────────────
|
|
91
|
-
router.get(`${prefix}/slow-queries`, async (req, res) => {
|
|
92
|
-
const entries = await storage.entries('slow_query', {
|
|
93
|
-
page: parseInt(req.query['page'] ?? '1', 10),
|
|
94
|
-
perPage: parseInt(req.query['per_page'] ?? '50', 10),
|
|
95
|
-
});
|
|
96
|
-
res.json({ data: entries });
|
|
97
|
-
}, middleware);
|
|
98
|
-
// ── Exceptions ───────────────────────────────────────────
|
|
99
|
-
router.get(`${prefix}/exceptions`, async (req, res) => {
|
|
100
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
101
|
-
const aggregates = await storage.aggregates('exceptions', since);
|
|
102
|
-
const entries = await storage.entries('exception', {
|
|
103
|
-
page: parseInt(req.query['page'] ?? '1', 10),
|
|
104
|
-
perPage: parseInt(req.query['per_page'] ?? '20', 10),
|
|
105
|
-
});
|
|
106
|
-
res.json({
|
|
107
|
-
over_time: aggregates.map(bucketToJson),
|
|
108
|
-
recent: entries,
|
|
109
|
-
});
|
|
110
|
-
}, middleware);
|
|
111
|
-
// ── Cache ────────────────────────────────────────────────
|
|
112
|
-
router.get(`${prefix}/cache`, async (req, res) => {
|
|
113
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
114
|
-
const hits = await storage.aggregates('cache_hits', since);
|
|
115
|
-
const misses = await storage.aggregates('cache_misses', since);
|
|
116
|
-
const totalHits = hits.reduce((s, a) => s + a.count, 0);
|
|
117
|
-
const totalMisses = misses.reduce((s, a) => s + a.count, 0);
|
|
118
|
-
const total = totalHits + totalMisses;
|
|
119
|
-
const hitRate = total > 0 ? Math.round((totalHits / total) * 10000) / 100 : 0;
|
|
120
|
-
res.json({
|
|
121
|
-
hit_rate: hitRate,
|
|
122
|
-
total_hits: totalHits,
|
|
123
|
-
total_misses: totalMisses,
|
|
124
|
-
hits: hits.map(bucketToJson),
|
|
125
|
-
misses: misses.map(bucketToJson),
|
|
126
|
-
});
|
|
127
|
-
}, middleware);
|
|
128
|
-
// ── Active users ─────────────────────────────────────────
|
|
129
|
-
router.get(`${prefix}/users`, async (req, res) => {
|
|
130
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
131
|
-
const aggregates = await storage.aggregates('active_users', since);
|
|
132
|
-
res.json({ data: aggregates.map(bucketToJson) });
|
|
133
|
-
}, middleware);
|
|
134
|
-
// ── Server stats ─────────────────────────────────────────
|
|
135
|
-
router.get(`${prefix}/servers`, async (req, res) => {
|
|
136
|
-
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
137
|
-
const cpu = await storage.aggregates('server_cpu', since);
|
|
138
|
-
const memory = await storage.aggregates('server_memory', since);
|
|
139
|
-
res.json({
|
|
140
|
-
cpu: cpu.map(a => ({ ...bucketToJson(a), avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0 })),
|
|
141
|
-
memory: memory.map(a => ({ ...bucketToJson(a), avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0 })),
|
|
142
|
-
});
|
|
143
|
-
}, middleware);
|
|
144
|
-
}
|
|
145
12
|
function bucketToJson(agg) {
|
|
146
13
|
return {
|
|
147
14
|
bucket: agg.bucket.toISOString(),
|
|
@@ -152,7 +19,122 @@ function bucketToJson(agg) {
|
|
|
152
19
|
max: agg.max,
|
|
153
20
|
};
|
|
154
21
|
}
|
|
155
|
-
|
|
22
|
+
// ─── Handlers ──────────────────────────────────────────────
|
|
23
|
+
//
|
|
24
|
+
// Pure handler functions invoked from `../routes.ts`. Kept separate from
|
|
25
|
+
// route registration so they can be reused or unit-tested without
|
|
26
|
+
// spinning up a router.
|
|
27
|
+
export async function getOverview(storage, req, res) {
|
|
28
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
29
|
+
const aggregates = await storage.overview(since);
|
|
30
|
+
const summary = {};
|
|
31
|
+
for (const agg of aggregates) {
|
|
32
|
+
if (!summary[agg.type]) {
|
|
33
|
+
summary[agg.type] = { count: 0, sum: 0, min: null, max: null, buckets: 0 };
|
|
34
|
+
}
|
|
35
|
+
const s = summary[agg.type];
|
|
36
|
+
s.count += agg.count;
|
|
37
|
+
s.sum += agg.sum;
|
|
38
|
+
s.buckets += 1;
|
|
39
|
+
if (agg.min !== null && (s.min === null || agg.min < s.min))
|
|
40
|
+
s.min = agg.min;
|
|
41
|
+
if (agg.max !== null && (s.max === null || agg.max > s.max))
|
|
42
|
+
s.max = agg.max;
|
|
43
|
+
}
|
|
44
|
+
const metrics = {};
|
|
45
|
+
for (const [type, s] of Object.entries(summary)) {
|
|
46
|
+
metrics[type] = {
|
|
47
|
+
total: s.count,
|
|
48
|
+
avg: s.count > 0 ? Math.round((s.sum / s.count) * 100) / 100 : 0,
|
|
49
|
+
min: s.min,
|
|
50
|
+
max: s.max,
|
|
51
|
+
buckets: s.buckets,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
res.json({ period: req.query['period'] ?? '1h', metrics });
|
|
55
|
+
}
|
|
56
|
+
export async function getRequests(storage, req, res) {
|
|
57
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
58
|
+
const counts = await storage.aggregates('request_count', since);
|
|
59
|
+
const durations = await storage.aggregates('request_duration', since);
|
|
60
|
+
res.json({
|
|
61
|
+
throughput: counts.map(bucketToJson),
|
|
62
|
+
duration: durations.map(a => ({
|
|
63
|
+
...bucketToJson(a),
|
|
64
|
+
avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0,
|
|
65
|
+
})),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export async function listSlowRequests(storage, req, res) {
|
|
69
|
+
const entries = await storage.entries('slow_request', {
|
|
70
|
+
page: parseInt(req.query['page'] ?? '1', 10),
|
|
71
|
+
perPage: parseInt(req.query['per_page'] ?? '50', 10),
|
|
72
|
+
});
|
|
73
|
+
res.json({ data: entries });
|
|
74
|
+
}
|
|
75
|
+
export async function getQueues(storage, req, res) {
|
|
76
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
77
|
+
const throughput = await storage.aggregates('queue_throughput', since);
|
|
78
|
+
const waitTimes = await storage.aggregates('queue_wait_time', since);
|
|
79
|
+
res.json({
|
|
80
|
+
throughput: throughput.map(bucketToJson),
|
|
81
|
+
wait_time: waitTimes.map(a => ({
|
|
82
|
+
...bucketToJson(a),
|
|
83
|
+
avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0,
|
|
84
|
+
})),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export async function listSlowQueries(storage, req, res) {
|
|
88
|
+
const entries = await storage.entries('slow_query', {
|
|
89
|
+
page: parseInt(req.query['page'] ?? '1', 10),
|
|
90
|
+
perPage: parseInt(req.query['per_page'] ?? '50', 10),
|
|
91
|
+
});
|
|
92
|
+
res.json({ data: entries });
|
|
93
|
+
}
|
|
94
|
+
export async function getExceptions(storage, req, res) {
|
|
95
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
96
|
+
const aggregates = await storage.aggregates('exceptions', since);
|
|
97
|
+
const entries = await storage.entries('exception', {
|
|
98
|
+
page: parseInt(req.query['page'] ?? '1', 10),
|
|
99
|
+
perPage: parseInt(req.query['per_page'] ?? '20', 10),
|
|
100
|
+
});
|
|
101
|
+
res.json({
|
|
102
|
+
over_time: aggregates.map(bucketToJson),
|
|
103
|
+
recent: entries,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export async function getCache(storage, req, res) {
|
|
107
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
108
|
+
const hits = await storage.aggregates('cache_hits', since);
|
|
109
|
+
const misses = await storage.aggregates('cache_misses', since);
|
|
110
|
+
const totalHits = hits.reduce((s, a) => s + a.count, 0);
|
|
111
|
+
const totalMisses = misses.reduce((s, a) => s + a.count, 0);
|
|
112
|
+
const total = totalHits + totalMisses;
|
|
113
|
+
const hitRate = total > 0 ? Math.round((totalHits / total) * 10000) / 100 : 0;
|
|
114
|
+
res.json({
|
|
115
|
+
hit_rate: hitRate,
|
|
116
|
+
total_hits: totalHits,
|
|
117
|
+
total_misses: totalMisses,
|
|
118
|
+
hits: hits.map(bucketToJson),
|
|
119
|
+
misses: misses.map(bucketToJson),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export async function getUsers(storage, req, res) {
|
|
123
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
124
|
+
const aggregates = await storage.aggregates('active_users', since);
|
|
125
|
+
res.json({ data: aggregates.map(bucketToJson) });
|
|
126
|
+
}
|
|
127
|
+
export async function getServers(storage, req, res) {
|
|
128
|
+
const since = sinceFromPeriod(req.query['period'] ?? '1h');
|
|
129
|
+
const cpu = await storage.aggregates('server_cpu', since);
|
|
130
|
+
const memory = await storage.aggregates('server_memory', since);
|
|
131
|
+
res.json({
|
|
132
|
+
cpu: cpu.map(a => ({ ...bucketToJson(a), avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0 })),
|
|
133
|
+
memory: memory.map(a => ({ ...bucketToJson(a), avg: a.count > 0 ? Math.round((a.sum / a.count) * 100) / 100 : 0 })),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// ─── Auth Middleware ───────────────────────────────────────
|
|
137
|
+
export function authMiddleware(config) {
|
|
156
138
|
return async (req, res, next) => {
|
|
157
139
|
if (config.auth) {
|
|
158
140
|
const allowed = await config.auth(req);
|
package/dist/api/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mapp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AM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACtC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAA;gBAClD,OAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ServiceProvider } from '@rudderjs/core';
|
|
2
|
-
import { type PulseConfig, type PulseStorage, type PulseAggregate, type PulseEntry, type MetricType, type EntryType, type
|
|
3
|
-
export type { PulseConfig, PulseStorage, PulseAggregate, PulseEntry, MetricType, EntryType,
|
|
2
|
+
import { type PulseConfig, type PulseStorage, type PulseAggregate, type PulseEntry, type MetricType, type EntryType, type Recorder, type EntryListOptions } from './types.js';
|
|
3
|
+
export type { PulseConfig, PulseStorage, PulseAggregate, PulseEntry, MetricType, EntryType, Recorder, EntryListOptions };
|
|
4
4
|
export { MemoryStorage, SqliteStorage } from './storage.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
5
|
+
export { RequestRecorder } from './recorders/request.js';
|
|
6
|
+
export { QueueRecorder } from './recorders/queue.js';
|
|
7
|
+
export { CacheRecorder } from './recorders/cache.js';
|
|
8
|
+
export { ExceptionRecorder } from './recorders/exception.js';
|
|
9
|
+
export { UserRecorder } from './recorders/user.js';
|
|
10
|
+
export { QueryRecorder } from './recorders/query.js';
|
|
11
|
+
export { ServerRecorder } from './recorders/server.js';
|
|
12
|
+
export { registerPulseRoutes, type RegisterPulseRoutesOptions } from './routes.js';
|
|
12
13
|
export declare class PulseRegistry {
|
|
13
14
|
private static storage;
|
|
14
15
|
static set(storage: PulseStorage): void;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,gBAAgB,CAAA;AAUxD,OAAO,EAEL,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EACzE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,gBAAgB,CAAA;AAUxD,OAAO,EAEL,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EACzE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EACtE,MAAM,YAAY,CAAA;AAInB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;AACxH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAIlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,OAAO,CAA4B;IAElD,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IACvC,MAAM,CAAC,GAAG,IAAI,YAAY,GAAG,IAAI;IACjC,mEAAmE;IACnE,MAAM,CAAC,KAAK,IAAI,IAAI;CACrB;AAID,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAC,KAAK;IAMpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzF,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAInH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIjG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAG3E;AAID;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,eAAe;IAChD,QAAQ,IAAI,IAAI;IAQV,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA8E5B"}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ServiceProvider, config } from '@rudderjs/core';
|
|
2
2
|
import { MemoryStorage, SqliteStorage } from './storage.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { RequestRecorder } from './recorders/request.js';
|
|
4
|
+
import { QueueRecorder } from './recorders/queue.js';
|
|
5
|
+
import { CacheRecorder } from './recorders/cache.js';
|
|
6
|
+
import { ExceptionRecorder } from './recorders/exception.js';
|
|
7
|
+
import { UserRecorder } from './recorders/user.js';
|
|
8
|
+
import { QueryRecorder } from './recorders/query.js';
|
|
9
|
+
import { ServerRecorder } from './recorders/server.js';
|
|
10
|
+
import { registerPulseRoutes } from './routes.js';
|
|
11
11
|
import { defaultConfig, } from './types.js';
|
|
12
12
|
export { MemoryStorage, SqliteStorage } from './storage.js';
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
13
|
+
export { RequestRecorder } from './recorders/request.js';
|
|
14
|
+
export { QueueRecorder } from './recorders/queue.js';
|
|
15
|
+
export { CacheRecorder } from './recorders/cache.js';
|
|
16
|
+
export { ExceptionRecorder } from './recorders/exception.js';
|
|
17
|
+
export { UserRecorder } from './recorders/user.js';
|
|
18
|
+
export { QueryRecorder } from './recorders/query.js';
|
|
19
|
+
export { ServerRecorder } from './recorders/server.js';
|
|
20
|
+
export { registerPulseRoutes } from './routes.js';
|
|
20
21
|
// ─── Pulse Registry ────────────────────────────────────────
|
|
21
22
|
export class PulseRegistry {
|
|
22
23
|
static storage = null;
|
|
@@ -106,36 +107,39 @@ export class PulseProvider extends ServiceProvider {
|
|
|
106
107
|
}, interval);
|
|
107
108
|
timer.unref();
|
|
108
109
|
}
|
|
109
|
-
// ── Register
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
const
|
|
110
|
+
// ── Register recorders ────────────────────────────────
|
|
111
|
+
const requestRec = new RequestRecorder(storage, resolved);
|
|
112
|
+
const userRec = new UserRecorder(storage);
|
|
113
|
+
const recorders = [];
|
|
113
114
|
if (resolved.recordQueues)
|
|
114
|
-
|
|
115
|
+
recorders.push(new QueueRecorder(storage));
|
|
115
116
|
if (resolved.recordCache)
|
|
116
|
-
|
|
117
|
+
recorders.push(new CacheRecorder(storage));
|
|
117
118
|
if (resolved.recordExceptions)
|
|
118
|
-
|
|
119
|
+
recorders.push(new ExceptionRecorder(storage));
|
|
119
120
|
if (resolved.recordServers)
|
|
120
|
-
|
|
121
|
-
// Query
|
|
122
|
-
|
|
123
|
-
for (const
|
|
124
|
-
await
|
|
121
|
+
recorders.push(new ServerRecorder(storage, resolved.serverStatsIntervalMs));
|
|
122
|
+
// Query recorder for slow queries
|
|
123
|
+
recorders.push(new QueryRecorder(storage, resolved));
|
|
124
|
+
for (const rec of recorders) {
|
|
125
|
+
await rec.register();
|
|
125
126
|
}
|
|
126
127
|
// ── Register middleware ───────────────────────────────
|
|
127
128
|
try {
|
|
128
129
|
const { router } = await import('@rudderjs/router');
|
|
129
130
|
if (resolved.recordRequests)
|
|
130
|
-
router.use(
|
|
131
|
+
router.use(requestRec.middleware());
|
|
131
132
|
if (resolved.recordUsers)
|
|
132
|
-
router.use(
|
|
133
|
+
router.use(userRec.middleware());
|
|
133
134
|
}
|
|
134
135
|
catch {
|
|
135
136
|
// @rudderjs/router not available
|
|
136
137
|
}
|
|
137
|
-
// ── Register API routes
|
|
138
|
-
await
|
|
138
|
+
// ── Register UI + API routes ──────────────────────────
|
|
139
|
+
await registerPulseRoutes(storage, {
|
|
140
|
+
path: resolved.path,
|
|
141
|
+
...(resolved.auth ? { auth: resolved.auth } : {}),
|
|
142
|
+
});
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE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3
|
+
* Tracks cache hit/miss ratio by wrapping the CacheRegistry adapter.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CacheRecorder implements Recorder {
|
|
6
|
+
private readonly storage;
|
|
7
|
+
readonly name = "Cache Recorder";
|
|
8
|
+
constructor(storage: PulseStorage);
|
|
9
|
+
register(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=cache.d.ts.map
|