nucleus-core-ts 0.10.147 → 0.10.151
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/LICENSE +48 -48
- package/dist/.build-ok +1 -1
- package/dist/fe/components/AuthorizationPage/labels.js +13 -13
- package/dist/fe/components/Captcha/labels.js +17 -17
- package/dist/fe/components/ChatPanel/helpers.js +17 -17
- package/dist/fe/components/ChatPanel/labels.js +16 -16
- package/dist/fe/components/DataTable/labels.js +16 -16
- package/dist/fe/components/DevicesPage/components/DeviceCard.js +15 -15
- package/dist/fe/components/DevicesPage/components/DevicesPage.js +9 -9
- package/dist/fe/components/DevicesPage/labels.js +12 -12
- package/dist/fe/components/ForgotPasswordPage/labels.js +8 -8
- package/dist/fe/components/FormBuilder/components/FormField.js +5 -5
- package/dist/fe/components/FormBuilder/utils/fieldMapping.js +9 -9
- package/dist/fe/components/IntegrationsPage/components/ConnectionAuthFields.js +8 -8
- package/dist/fe/components/IntegrationsPage/components/ConnectionBasicFields.js +3 -3
- package/dist/fe/components/IntegrationsPage/components/ConnectionExport.js +23 -23
- package/dist/fe/components/IntegrationsPage/components/ConnectionForm.js +22 -22
- package/dist/fe/components/IntegrationsPage/components/ConnectionList.js +7 -7
- package/dist/fe/components/IntegrationsPage/components/ConnectionOauthFields.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/ConnectionSettingsTab.js +24 -24
- package/dist/fe/components/IntegrationsPage/components/ConnectionSwitcher.js +19 -19
- package/dist/fe/components/IntegrationsPage/components/ConnectionTabs.js +15 -15
- package/dist/fe/components/IntegrationsPage/components/ConnectionTest.js +21 -21
- package/dist/fe/components/IntegrationsPage/components/ConnectionTransfer.js +18 -18
- package/dist/fe/components/IntegrationsPage/components/CredentialFields.js +19 -19
- package/dist/fe/components/IntegrationsPage/components/CredentialSlotRow.js +8 -8
- package/dist/fe/components/IntegrationsPage/components/EndpointForm.js +7 -7
- package/dist/fe/components/IntegrationsPage/components/EndpointFormFields.js +12 -12
- package/dist/fe/components/IntegrationsPage/components/EndpointList.js +7 -7
- package/dist/fe/components/IntegrationsPage/components/EndpointSample.js +36 -36
- package/dist/fe/components/IntegrationsPage/components/EndpointsTab.js +29 -29
- package/dist/fe/components/IntegrationsPage/components/FieldMappingRow.js +7 -7
- package/dist/fe/components/IntegrationsPage/components/FieldMappingRows.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/IntegrationsPage.js +60 -60
- package/dist/fe/components/IntegrationsPage/components/MappingAccountFields.js +15 -15
- package/dist/fe/components/IntegrationsPage/components/MappingEditor.js +9 -9
- package/dist/fe/components/IntegrationsPage/components/MappingList.js +23 -23
- package/dist/fe/components/IntegrationsPage/components/MappingPasswordField.js +12 -12
- package/dist/fe/components/IntegrationsPage/components/MappingScheduleFields.js +23 -23
- package/dist/fe/components/IntegrationsPage/components/MappingWriteModeFields.js +31 -31
- package/dist/fe/components/IntegrationsPage/components/MappingsTab.js +56 -56
- package/dist/fe/components/IntegrationsPage/components/PaginationFields.js +11 -11
- package/dist/fe/components/IntegrationsPage/components/ParamBindingRows.js +15 -15
- package/dist/fe/components/IntegrationsPage/components/Primitives.js +28 -28
- package/dist/fe/components/IntegrationsPage/components/ReferenceCheckRows.js +9 -9
- package/dist/fe/components/IntegrationsPage/components/RunConfirmStep.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/RunHistory.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/RunHistoryRow.js +9 -9
- package/dist/fe/components/IntegrationsPage/components/RunPanel.js +40 -40
- package/dist/fe/components/IntegrationsPage/components/RunPasswordField.js +18 -18
- package/dist/fe/components/IntegrationsPage/components/RunPlanIssues.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/RunPlanReferences.js +12 -12
- package/dist/fe/components/IntegrationsPage/components/RunPlanSuggestions.js +11 -11
- package/dist/fe/components/IntegrationsPage/components/RunPlanSummary.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/RunProgressBar.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/RunRevertConflicts.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/Skeletons.js +7 -7
- package/dist/fe/components/IntegrationsPage/components/authOptions.js +4 -4
- package/dist/fe/components/IntegrationsPage/components/connectionDraft.js +27 -27
- package/dist/fe/components/IntegrationsPage/components/credentialSlots.js +25 -25
- package/dist/fe/components/IntegrationsPage/components/deleteIsConfirmed.js +9 -9
- package/dist/fe/components/IntegrationsPage/components/fieldMappingOptions.js +4 -4
- package/dist/fe/components/IntegrationsPage/components/formSupport.js +34 -34
- package/dist/fe/components/IntegrationsPage/components/jsonArray.js +14 -14
- package/dist/fe/components/IntegrationsPage/components/jsonObjectField.js +15 -15
- package/dist/fe/components/IntegrationsPage/components/mappingDraft.js +10 -10
- package/dist/fe/components/IntegrationsPage/components/mappingStaleness.js +22 -22
- package/dist/fe/components/IntegrationsPage/components/nextRuns.js +8 -8
- package/dist/fe/components/IntegrationsPage/components/passwordIsNeeded.js +13 -13
- package/dist/fe/components/IntegrationsPage/components/pathParams.js +6 -6
- package/dist/fe/components/IntegrationsPage/components/runFormat.js +18 -18
- package/dist/fe/components/IntegrationsPage/components/settleOwnership.js +18 -18
- package/dist/fe/components/IntegrationsPage/components/useInfiniteList.js +8 -8
- package/dist/fe/components/IntegrationsPage/store/index.js +20 -20
- package/dist/fe/components/IntegrationsPage/store/upsertInto.js +12 -12
- package/dist/fe/components/IntegrationsPage/text/context.js +6 -6
- package/dist/fe/components/IntegrationsPage/text/index.js +18 -18
- package/dist/fe/components/IntegrationsPage/theme/index.js +29 -29
- package/dist/fe/components/IntegrationsPage/types/records.js +10 -10
- package/dist/fe/components/IntegrationsPage/types/results.js +3 -3
- package/dist/fe/components/NotificationCenter/labels.js +17 -17
- package/dist/fe/components/ProfilePage/labels.js +10 -10
- package/dist/fe/components/ResetPasswordPage/labels.js +4 -4
- package/dist/fe/components/SetPasswordPage/labels.js +11 -11
- package/dist/fe/components/UsersPage/labels.js +14 -14
- package/dist/fe/utils/columnUtils.js +24 -24
- package/dist/fe/utils/searchFold.js +36 -36
- package/dist/index.js +6 -6
- package/dist/server.js +6 -6
- package/dist/src/Client/Proxy/authz.js +4 -4
- package/dist/src/Client/Proxy/httpProxy.js +136 -136
- package/dist/src/Client/Proxy/largeBody.js +29 -29
- package/dist/src/Client/Proxy/utils.js +32 -32
- package/dist/src/Client/Proxy/wsProxy.js +59 -59
- package/dist/src/Managers/Redis/index.d.ts +14 -0
- package/dist/src/Nucleus/routes/auth/admin/impersonationStore.d.ts +3 -4
- package/dist/src/Nucleus/routes/auth/refresh/issuedPair.d.ts +67 -0
- package/dist/src/Nucleus/routes/auth/refresh/recordIssued.d.ts +15 -6
- package/dist/src/Nucleus/routes/auth/refresh/refreshChain.d.ts +56 -0
- package/dist/src/Services/Auth/SessionStore/utils.d.ts +2 -0
- package/dist/src/Shared/cron.js +71 -71
- package/dist/src/Shared/redactSecrets.js +156 -156
- package/dist/src/Shared/redaction/bare.js +61 -61
- package/dist/src/Shared/redaction/floor.js +48 -48
- package/dist/src/Shared/redaction/freeText.js +70 -70
- package/dist/src/Shared/redaction/json.js +30 -30
- package/dist/src/Shared/redaction/lists.js +23 -23
- package/dist/src/Shared/redaction/markers.js +28 -28
- package/dist/src/Shared/redaction/names.js +49 -49
- package/dist/src/Shared/redaction/pairs.js +54 -54
- package/dist/src/Shared/redaction/secretString.js +29 -29
- package/dist/src/Shared/redaction/structured.js +52 -52
- package/dist/src/Shared/redaction/walk.js +25 -25
- package/infra/scripts/generate-project.ts +766 -766
- package/infra/templates/README.md +57 -57
- package/infra/templates/backend/.dockerignore +9 -9
- package/infra/templates/backend/.env.example +15 -15
- package/infra/templates/backend/README.md +28 -28
- package/infra/templates/backend/azure-pipelines.yml +135 -135
- package/infra/templates/backend/k8s/Dockerfile +31 -31
- package/infra/templates/backend/k8s/configmap.yaml +26 -26
- package/infra/templates/backend/k8s/deployment.yaml +85 -85
- package/infra/templates/backend/k8s/pvc.yaml +12 -12
- package/infra/templates/backend/k8s/service.yaml +13 -13
- package/infra/templates/backend/tsconfig.json +22 -22
- package/infra/templates/frontend/.dockerignore +10 -10
- package/infra/templates/frontend/.env.example +8 -8
- package/infra/templates/frontend/.env.local.example +10 -10
- package/infra/templates/frontend/README.md +69 -69
- package/infra/templates/frontend/app/[tablename]/page.tsx +37 -37
- package/infra/templates/frontend/app/_components/AuthWrapper/index.tsx +63 -63
- package/infra/templates/frontend/app/authorization/page.tsx +43 -43
- package/infra/templates/frontend/app/change-password/page.tsx +23 -23
- package/infra/templates/frontend/app/devices/page.tsx +127 -127
- package/infra/templates/frontend/app/forgot-password/page.tsx +20 -20
- package/infra/templates/frontend/app/globals.css +28 -28
- package/infra/templates/frontend/app/layout.tsx +35 -35
- package/infra/templates/frontend/app/login/page.tsx +33 -33
- package/infra/templates/frontend/app/page.tsx +565 -565
- package/infra/templates/frontend/app/profile/page.tsx +92 -92
- package/infra/templates/frontend/app/register/page.tsx +27 -27
- package/infra/templates/frontend/app/reset-password/page.tsx +60 -60
- package/infra/templates/frontend/app/set-password/page.tsx +43 -43
- package/infra/templates/frontend/app/ui-docs/page.tsx +52 -52
- package/infra/templates/frontend/app/users/page.tsx +52 -52
- package/infra/templates/frontend/app/verify-email/page.tsx +41 -41
- package/infra/templates/frontend/app/verify-magic-link/page.tsx +46 -46
- package/infra/templates/frontend/azure-pipelines.yml +137 -137
- package/infra/templates/frontend/code-and-design-principles.md +438 -438
- package/infra/templates/frontend/k8s/Dockerfile +50 -50
- package/infra/templates/frontend/k8s/configmap.yaml +18 -18
- package/infra/templates/frontend/k8s/deployment.yaml +72 -72
- package/infra/templates/frontend/k8s/ingress.yaml +36 -36
- package/infra/templates/frontend/k8s/service.yaml +14 -14
- package/infra/templates/frontend/lib/api/endpoints.ts +37 -37
- package/infra/templates/frontend/lib/api/factory.ts +44 -44
- package/infra/templates/frontend/lib/api/hook.ts +10 -10
- package/infra/templates/frontend/next.config.ts +19 -19
- package/infra/templates/frontend/package.json +34 -34
- package/infra/templates/frontend/postcss.config.mjs +5 -5
- package/infra/templates/frontend/server.ts +114 -114
- package/infra/templates/frontend/tsconfig.json +23 -23
- package/package.json +1 -1
- package/public/components/CTA.tsx +25 -25
- package/public/components/Capabilities.tsx +67 -67
- package/public/components/Features.tsx +107 -107
- package/public/components/Footer.tsx +58 -58
- package/public/components/Hero.tsx +51 -51
- package/public/components/Managers.tsx +55 -55
- package/public/components/Nav.tsx +91 -91
- package/public/components/Stack.tsx +36 -36
- package/public/components/docs/Docs.tsx +60 -60
- package/public/components/docs/DocsContent.tsx +176 -176
- package/public/components/docs/DocsRightSidebar.tsx +53 -53
- package/public/components/docs/DocsSidebar.tsx +54 -54
- package/public/components/docs/content/authentication.ts +836 -836
- package/public/components/docs/content/authorization.ts +268 -268
- package/public/components/docs/content/backupRestore.ts +173 -173
- package/public/components/docs/content/clientModule.ts +287 -287
- package/public/components/docs/content/entityCrud.ts +682 -682
- package/public/components/docs/content/monitoring.ts +313 -313
- package/public/components/docs/content/multiTenant.ts +269 -269
- package/public/components/docs/content/oauthApiKeys.ts +325 -325
- package/public/components/docs/content/pubsub.ts +131 -131
- package/public/components/docs/content/storageCdn.ts +171 -171
- package/public/components/docs/content/verification.ts +289 -289
- package/public/components/docs/docsData.ts +113 -113
- package/public/components/docs/index.ts +6 -6
- package/public/components/index.ts +9 -9
- package/public/docs.css +629 -629
- package/public/index.html +81 -81
- package/public/index.tsx +42 -42
- package/public/store.ts +76 -76
- package/public/styles.css +858 -858
- package/schemas/config.nucleus.json +2651 -2651
- package/scripts/audit-purge-noise.ts +120 -120
- package/scripts/build.ts +582 -582
- package/scripts/generate-system-tables-types.ts +18 -18
- package/scripts/generate-types-schema.test.ts +73 -73
- package/scripts/generate-types-schema.ts +1284 -1284
- package/scripts/packagedScripts.test.ts +87 -87
- package/scripts/publish.ts +276 -276
- package/scripts/skillCitations.test.ts +107 -107
- package/scripts/verify-publishable.ts +40 -40
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
import type { DocItem } from '../docsData'
|
|
2
|
-
|
|
3
|
-
export const monitoringItems: DocItem[] = [
|
|
4
|
-
{
|
|
5
|
-
id: 'monitoring-system',
|
|
6
|
-
title: 'Monitoring System',
|
|
7
|
-
subItems: [
|
|
8
|
-
{
|
|
9
|
-
id: 'monitoring-overview',
|
|
10
|
-
title: 'Monitoring Overview',
|
|
11
|
-
content: `
|
|
12
|
-
## Monitoring Overview
|
|
13
|
-
|
|
14
|
-
Nucleus includes two monitoring systems: **Application Monitoring** (request metrics, error tracking, alerts) and **Live Monitoring** (real-time memory/CPU/request streaming via SSE).
|
|
15
|
-
|
|
16
|
-
### Application Monitoring
|
|
17
|
-
|
|
18
|
-
Tracks request-level metrics across your API:
|
|
19
|
-
|
|
20
|
-
| Metric Category | What It Tracks |
|
|
21
|
-
|----------------|----------------|
|
|
22
|
-
| **Requests** | Total count, per-endpoint breakdown, method distribution |
|
|
23
|
-
| **Response Time** | Average, p50, p95, p99 latencies |
|
|
24
|
-
| **Errors** | Error count, error rate, status code distribution |
|
|
25
|
-
| **Rate Limits** | Blocked requests, rate limit hits per endpoint |
|
|
26
|
-
|
|
27
|
-
### System Monitoring
|
|
28
|
-
|
|
29
|
-
Tracks server-level resource usage:
|
|
30
|
-
|
|
31
|
-
| Metric | Description |
|
|
32
|
-
|--------|-------------|
|
|
33
|
-
| **CPU** | Usage percentage, load average |
|
|
34
|
-
| **Memory** | RSS, heap used/total, external, array buffers |
|
|
35
|
-
| **Disk** | Usage percentage (if enabled) |
|
|
36
|
-
| **Network** | Connection count (if enabled) |
|
|
37
|
-
| **Process** | Uptime, event loop lag |
|
|
38
|
-
|
|
39
|
-
### Database Monitoring
|
|
40
|
-
|
|
41
|
-
Collected from \`pg_stat_activity\` / \`pg_stat_database\`, scoped to the current database:
|
|
42
|
-
|
|
43
|
-
| Metric | Description |
|
|
44
|
-
|--------|-------------|
|
|
45
|
-
| **Connections** | Active/idle/total backends |
|
|
46
|
-
| **Query Time** | Avg active execution time per transaction (PostgreSQL 14+) |
|
|
47
|
-
| **Slow Queries** | Currently active queries exceeding \`slowQueryThreshold\` |
|
|
48
|
-
|
|
49
|
-
### Redis Monitoring
|
|
50
|
-
|
|
51
|
-
Collected via the Redis \`INFO\` command (direct Redis mode only — unavailable when \`redis.withDapr\` is true):
|
|
52
|
-
|
|
53
|
-
| Metric | Description |
|
|
54
|
-
|--------|-------------|
|
|
55
|
-
| **Memory** | Used / peak memory |
|
|
56
|
-
| **Connections** | Connected clients |
|
|
57
|
-
| **Operations** | Total commands, instantaneous ops/sec |
|
|
58
|
-
| **Hit Rate** | Keyspace hits vs misses (%) |
|
|
59
|
-
|
|
60
|
-
### Alert System
|
|
61
|
-
|
|
62
|
-
When metrics exceed configured thresholds, alerts are triggered:
|
|
63
|
-
|
|
64
|
-
\`\`\`json
|
|
65
|
-
{
|
|
66
|
-
"monitoring": {
|
|
67
|
-
"alerts": {
|
|
68
|
-
"enabled": true,
|
|
69
|
-
"email": {
|
|
70
|
-
"enabled": true,
|
|
71
|
-
"recipients": ["ops@yourapp.com"]
|
|
72
|
-
},
|
|
73
|
-
"thresholds": {
|
|
74
|
-
"cpuPercent": 90,
|
|
75
|
-
"memoryPercent": 85,
|
|
76
|
-
"diskPercent": 90,
|
|
77
|
-
"errorRatePercent": 5,
|
|
78
|
-
"responseTimeMs": 2000,
|
|
79
|
-
"rateLimitBlocksPerMinute": 100
|
|
80
|
-
},
|
|
81
|
-
"cooldown": "5m"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
\`\`\`
|
|
86
|
-
|
|
87
|
-
The \`cooldown\` prevents alert spam — after an alert fires, the same alert won't fire again for the cooldown duration.
|
|
88
|
-
`,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: 'monitoring-config',
|
|
92
|
-
title: 'Full Configuration',
|
|
93
|
-
content: `
|
|
94
|
-
## Monitoring Configuration
|
|
95
|
-
|
|
96
|
-
\`\`\`json
|
|
97
|
-
{
|
|
98
|
-
"monitoring": {
|
|
99
|
-
"enabled": true,
|
|
100
|
-
"system": {
|
|
101
|
-
"enabled": true,
|
|
102
|
-
"collectInterval": "10s",
|
|
103
|
-
"metrics": {
|
|
104
|
-
"cpu": true,
|
|
105
|
-
"memory": true,
|
|
106
|
-
"disk": true,
|
|
107
|
-
"network": true,
|
|
108
|
-
"process": true
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"application": {
|
|
112
|
-
"enabled": true,
|
|
113
|
-
"metrics": {
|
|
114
|
-
"requests": true,
|
|
115
|
-
"responseTime": true,
|
|
116
|
-
"errors": true,
|
|
117
|
-
"rateLimits": true
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
"database": {
|
|
121
|
-
"enabled": true,
|
|
122
|
-
"metrics": {
|
|
123
|
-
"connections": true,
|
|
124
|
-
"queryTime": true,
|
|
125
|
-
"slowQueryThreshold": "500ms"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"redis": {
|
|
129
|
-
"enabled": true
|
|
130
|
-
},
|
|
131
|
-
"persistence": {
|
|
132
|
-
"enabled": true,
|
|
133
|
-
"flushInterval": "60s",
|
|
134
|
-
"retentionDays": 7
|
|
135
|
-
},
|
|
136
|
-
"endpoints": {
|
|
137
|
-
"enabled": true,
|
|
138
|
-
"basePath": "/monitoring",
|
|
139
|
-
"stream": {
|
|
140
|
-
"enabled": true,
|
|
141
|
-
"path": "/stream",
|
|
142
|
-
"interval": "5s"
|
|
143
|
-
},
|
|
144
|
-
"snapshot": {
|
|
145
|
-
"enabled": true,
|
|
146
|
-
"path": "/snapshot"
|
|
147
|
-
},
|
|
148
|
-
"history": {
|
|
149
|
-
"enabled": true,
|
|
150
|
-
"path": "/history",
|
|
151
|
-
"maxMinutes": 60
|
|
152
|
-
},
|
|
153
|
-
"alerts": {
|
|
154
|
-
"enabled": true,
|
|
155
|
-
"path": "/alerts"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
\`\`\`
|
|
161
|
-
|
|
162
|
-
### Monitoring Endpoints
|
|
163
|
-
|
|
164
|
-
| Endpoint | Description |
|
|
165
|
-
|----------|-------------|
|
|
166
|
-
| \`GET /monitoring/snapshot\` | Current metrics snapshot |
|
|
167
|
-
| \`GET /monitoring/stream\` | SSE stream of metric updates |
|
|
168
|
-
| \`GET /monitoring/history?minutes=30\` | Historical metrics |
|
|
169
|
-
| \`GET /monitoring/alerts\` | Recent alert history |
|
|
170
|
-
|
|
171
|
-
### Persistence
|
|
172
|
-
|
|
173
|
-
When \`persistence.enabled\` is on (default), collected metric points are flushed to the \`monitoring_metrics\` system table every \`flushInterval\` and rows older than \`retentionDays\` are pruned daily. The table is part of the generated schema only when monitoring is enabled — re-run \`nucleus-generate\` after enabling monitoring.
|
|
174
|
-
`,
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
id: 'live-monitoring',
|
|
180
|
-
title: 'Live Monitoring',
|
|
181
|
-
subItems: [
|
|
182
|
-
{
|
|
183
|
-
id: 'live-monitoring-overview',
|
|
184
|
-
title: 'Live Monitoring (SSE)',
|
|
185
|
-
content: `
|
|
186
|
-
## Live Monitoring — Real-Time SSE Stream
|
|
187
|
-
|
|
188
|
-
Live Monitoring provides an in-memory, real-time monitoring service that streams server health data via Server-Sent Events (SSE). It's designed for admin dashboards that need live visibility into server state.
|
|
189
|
-
|
|
190
|
-
### What It Tracks
|
|
191
|
-
|
|
192
|
-
| Category | Data |
|
|
193
|
-
|----------|------|
|
|
194
|
-
| **Memory** | RSS, heap used/total, external, array buffers — sampled at configurable intervals |
|
|
195
|
-
| **CPU** | Usage percentage — sampled at configurable intervals |
|
|
196
|
-
| **Requests** | Every HTTP request: method, path, status, duration, user ID, IP |
|
|
197
|
-
| **Dapr Events** | Dapr sidecar interactions (if Dapr is enabled) |
|
|
198
|
-
| **WebSocket** | WS connection events and message counts |
|
|
199
|
-
|
|
200
|
-
All data is stored in circular buffers with configurable limits — no database, no persistence. This keeps it zero-cost for production.
|
|
201
|
-
|
|
202
|
-
### SSE Stream
|
|
203
|
-
|
|
204
|
-
\`\`\`
|
|
205
|
-
GET /live-monitoring/logs/stream
|
|
206
|
-
\`\`\`
|
|
207
|
-
|
|
208
|
-
The stream sends two event types:
|
|
209
|
-
|
|
210
|
-
**snapshot** — Sent once on connection. Contains all current buffered data (memory logs, CPU logs, recent requests, Dapr events, WS events, worker info).
|
|
211
|
-
|
|
212
|
-
**update** — Sent at \`streamInterval\` (default: 2s). Contains only new data since the last update.
|
|
213
|
-
|
|
214
|
-
### Other Endpoints
|
|
215
|
-
|
|
216
|
-
| Endpoint | Description |
|
|
217
|
-
|----------|-------------|
|
|
218
|
-
| \`GET /live-monitoring/health\` | Service health check |
|
|
219
|
-
| \`GET /live-monitoring/settings\` | Current monitoring settings |
|
|
220
|
-
| \`PATCH /live-monitoring/settings\` | Update settings at runtime |
|
|
221
|
-
| \`GET /live-monitoring/logs\` | One-shot snapshot of all buffered data |
|
|
222
|
-
|
|
223
|
-
### Runtime Settings
|
|
224
|
-
|
|
225
|
-
You can toggle monitoring features and adjust intervals without restarting:
|
|
226
|
-
|
|
227
|
-
\`\`\`bash
|
|
228
|
-
PATCH /live-monitoring/settings
|
|
229
|
-
Content-Type: application/json
|
|
230
|
-
|
|
231
|
-
{
|
|
232
|
-
"logMemory": true,
|
|
233
|
-
"logCpu": true,
|
|
234
|
-
"memoryLogInterval": 5000,
|
|
235
|
-
"cpuLogInterval": 5000,
|
|
236
|
-
"memoryLogLimit": 100,
|
|
237
|
-
"requestLogLimit": 200
|
|
238
|
-
}
|
|
239
|
-
\`\`\`
|
|
240
|
-
|
|
241
|
-
### Configuration
|
|
242
|
-
|
|
243
|
-
\`\`\`json
|
|
244
|
-
{
|
|
245
|
-
"liveMonitoring": {
|
|
246
|
-
"enabled": true,
|
|
247
|
-
"logMemory": true,
|
|
248
|
-
"logCpu": true,
|
|
249
|
-
"logDapr": false,
|
|
250
|
-
"logWebSocket": false,
|
|
251
|
-
"memoryLogInterval": 5000,
|
|
252
|
-
"cpuLogInterval": 5000,
|
|
253
|
-
"memoryLogLimit": 100,
|
|
254
|
-
"cpuLogLimit": 100,
|
|
255
|
-
"daprLogLimit": 50,
|
|
256
|
-
"wsLogLimit": 50,
|
|
257
|
-
"requestLogLimit": 200,
|
|
258
|
-
"streamInterval": 2000,
|
|
259
|
-
"basePath": "/live-monitoring"
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
\`\`\`
|
|
263
|
-
`,
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
id: 'health-endpoint',
|
|
267
|
-
title: 'Health Checks',
|
|
268
|
-
content: `
|
|
269
|
-
## Health Checks
|
|
270
|
-
|
|
271
|
-
Nucleus automatically creates a health check endpoint:
|
|
272
|
-
|
|
273
|
-
\`\`\`
|
|
274
|
-
GET /health
|
|
275
|
-
\`\`\`
|
|
276
|
-
|
|
277
|
-
### Response
|
|
278
|
-
|
|
279
|
-
\`\`\`json
|
|
280
|
-
{
|
|
281
|
-
"status": "ok",
|
|
282
|
-
"appId": "my-api",
|
|
283
|
-
"timestamp": "2024-01-15T10:30:00Z",
|
|
284
|
-
"uptime": 86400
|
|
285
|
-
}
|
|
286
|
-
\`\`\`
|
|
287
|
-
|
|
288
|
-
This endpoint is always public (no authentication required) and is used by:
|
|
289
|
-
- **Kubernetes liveness/readiness probes**
|
|
290
|
-
- **Load balancer health checks**
|
|
291
|
-
- **External monitoring services**
|
|
292
|
-
|
|
293
|
-
### Kubernetes Probe Example
|
|
294
|
-
|
|
295
|
-
\`\`\`yaml
|
|
296
|
-
livenessProbe:
|
|
297
|
-
httpGet:
|
|
298
|
-
path: /health
|
|
299
|
-
port: 9000
|
|
300
|
-
initialDelaySeconds: 30
|
|
301
|
-
periodSeconds: 10
|
|
302
|
-
readinessProbe:
|
|
303
|
-
httpGet:
|
|
304
|
-
path: /health
|
|
305
|
-
port: 9000
|
|
306
|
-
initialDelaySeconds: 5
|
|
307
|
-
periodSeconds: 5
|
|
308
|
-
\`\`\`
|
|
309
|
-
`,
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
},
|
|
313
|
-
]
|
|
1
|
+
import type { DocItem } from '../docsData'
|
|
2
|
+
|
|
3
|
+
export const monitoringItems: DocItem[] = [
|
|
4
|
+
{
|
|
5
|
+
id: 'monitoring-system',
|
|
6
|
+
title: 'Monitoring System',
|
|
7
|
+
subItems: [
|
|
8
|
+
{
|
|
9
|
+
id: 'monitoring-overview',
|
|
10
|
+
title: 'Monitoring Overview',
|
|
11
|
+
content: `
|
|
12
|
+
## Monitoring Overview
|
|
13
|
+
|
|
14
|
+
Nucleus includes two monitoring systems: **Application Monitoring** (request metrics, error tracking, alerts) and **Live Monitoring** (real-time memory/CPU/request streaming via SSE).
|
|
15
|
+
|
|
16
|
+
### Application Monitoring
|
|
17
|
+
|
|
18
|
+
Tracks request-level metrics across your API:
|
|
19
|
+
|
|
20
|
+
| Metric Category | What It Tracks |
|
|
21
|
+
|----------------|----------------|
|
|
22
|
+
| **Requests** | Total count, per-endpoint breakdown, method distribution |
|
|
23
|
+
| **Response Time** | Average, p50, p95, p99 latencies |
|
|
24
|
+
| **Errors** | Error count, error rate, status code distribution |
|
|
25
|
+
| **Rate Limits** | Blocked requests, rate limit hits per endpoint |
|
|
26
|
+
|
|
27
|
+
### System Monitoring
|
|
28
|
+
|
|
29
|
+
Tracks server-level resource usage:
|
|
30
|
+
|
|
31
|
+
| Metric | Description |
|
|
32
|
+
|--------|-------------|
|
|
33
|
+
| **CPU** | Usage percentage, load average |
|
|
34
|
+
| **Memory** | RSS, heap used/total, external, array buffers |
|
|
35
|
+
| **Disk** | Usage percentage (if enabled) |
|
|
36
|
+
| **Network** | Connection count (if enabled) |
|
|
37
|
+
| **Process** | Uptime, event loop lag |
|
|
38
|
+
|
|
39
|
+
### Database Monitoring
|
|
40
|
+
|
|
41
|
+
Collected from \`pg_stat_activity\` / \`pg_stat_database\`, scoped to the current database:
|
|
42
|
+
|
|
43
|
+
| Metric | Description |
|
|
44
|
+
|--------|-------------|
|
|
45
|
+
| **Connections** | Active/idle/total backends |
|
|
46
|
+
| **Query Time** | Avg active execution time per transaction (PostgreSQL 14+) |
|
|
47
|
+
| **Slow Queries** | Currently active queries exceeding \`slowQueryThreshold\` |
|
|
48
|
+
|
|
49
|
+
### Redis Monitoring
|
|
50
|
+
|
|
51
|
+
Collected via the Redis \`INFO\` command (direct Redis mode only — unavailable when \`redis.withDapr\` is true):
|
|
52
|
+
|
|
53
|
+
| Metric | Description |
|
|
54
|
+
|--------|-------------|
|
|
55
|
+
| **Memory** | Used / peak memory |
|
|
56
|
+
| **Connections** | Connected clients |
|
|
57
|
+
| **Operations** | Total commands, instantaneous ops/sec |
|
|
58
|
+
| **Hit Rate** | Keyspace hits vs misses (%) |
|
|
59
|
+
|
|
60
|
+
### Alert System
|
|
61
|
+
|
|
62
|
+
When metrics exceed configured thresholds, alerts are triggered:
|
|
63
|
+
|
|
64
|
+
\`\`\`json
|
|
65
|
+
{
|
|
66
|
+
"monitoring": {
|
|
67
|
+
"alerts": {
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"email": {
|
|
70
|
+
"enabled": true,
|
|
71
|
+
"recipients": ["ops@yourapp.com"]
|
|
72
|
+
},
|
|
73
|
+
"thresholds": {
|
|
74
|
+
"cpuPercent": 90,
|
|
75
|
+
"memoryPercent": 85,
|
|
76
|
+
"diskPercent": 90,
|
|
77
|
+
"errorRatePercent": 5,
|
|
78
|
+
"responseTimeMs": 2000,
|
|
79
|
+
"rateLimitBlocksPerMinute": 100
|
|
80
|
+
},
|
|
81
|
+
"cooldown": "5m"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
The \`cooldown\` prevents alert spam — after an alert fires, the same alert won't fire again for the cooldown duration.
|
|
88
|
+
`,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'monitoring-config',
|
|
92
|
+
title: 'Full Configuration',
|
|
93
|
+
content: `
|
|
94
|
+
## Monitoring Configuration
|
|
95
|
+
|
|
96
|
+
\`\`\`json
|
|
97
|
+
{
|
|
98
|
+
"monitoring": {
|
|
99
|
+
"enabled": true,
|
|
100
|
+
"system": {
|
|
101
|
+
"enabled": true,
|
|
102
|
+
"collectInterval": "10s",
|
|
103
|
+
"metrics": {
|
|
104
|
+
"cpu": true,
|
|
105
|
+
"memory": true,
|
|
106
|
+
"disk": true,
|
|
107
|
+
"network": true,
|
|
108
|
+
"process": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"application": {
|
|
112
|
+
"enabled": true,
|
|
113
|
+
"metrics": {
|
|
114
|
+
"requests": true,
|
|
115
|
+
"responseTime": true,
|
|
116
|
+
"errors": true,
|
|
117
|
+
"rateLimits": true
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"database": {
|
|
121
|
+
"enabled": true,
|
|
122
|
+
"metrics": {
|
|
123
|
+
"connections": true,
|
|
124
|
+
"queryTime": true,
|
|
125
|
+
"slowQueryThreshold": "500ms"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"redis": {
|
|
129
|
+
"enabled": true
|
|
130
|
+
},
|
|
131
|
+
"persistence": {
|
|
132
|
+
"enabled": true,
|
|
133
|
+
"flushInterval": "60s",
|
|
134
|
+
"retentionDays": 7
|
|
135
|
+
},
|
|
136
|
+
"endpoints": {
|
|
137
|
+
"enabled": true,
|
|
138
|
+
"basePath": "/monitoring",
|
|
139
|
+
"stream": {
|
|
140
|
+
"enabled": true,
|
|
141
|
+
"path": "/stream",
|
|
142
|
+
"interval": "5s"
|
|
143
|
+
},
|
|
144
|
+
"snapshot": {
|
|
145
|
+
"enabled": true,
|
|
146
|
+
"path": "/snapshot"
|
|
147
|
+
},
|
|
148
|
+
"history": {
|
|
149
|
+
"enabled": true,
|
|
150
|
+
"path": "/history",
|
|
151
|
+
"maxMinutes": 60
|
|
152
|
+
},
|
|
153
|
+
"alerts": {
|
|
154
|
+
"enabled": true,
|
|
155
|
+
"path": "/alerts"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
\`\`\`
|
|
161
|
+
|
|
162
|
+
### Monitoring Endpoints
|
|
163
|
+
|
|
164
|
+
| Endpoint | Description |
|
|
165
|
+
|----------|-------------|
|
|
166
|
+
| \`GET /monitoring/snapshot\` | Current metrics snapshot |
|
|
167
|
+
| \`GET /monitoring/stream\` | SSE stream of metric updates |
|
|
168
|
+
| \`GET /monitoring/history?minutes=30\` | Historical metrics |
|
|
169
|
+
| \`GET /monitoring/alerts\` | Recent alert history |
|
|
170
|
+
|
|
171
|
+
### Persistence
|
|
172
|
+
|
|
173
|
+
When \`persistence.enabled\` is on (default), collected metric points are flushed to the \`monitoring_metrics\` system table every \`flushInterval\` and rows older than \`retentionDays\` are pruned daily. The table is part of the generated schema only when monitoring is enabled — re-run \`nucleus-generate\` after enabling monitoring.
|
|
174
|
+
`,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 'live-monitoring',
|
|
180
|
+
title: 'Live Monitoring',
|
|
181
|
+
subItems: [
|
|
182
|
+
{
|
|
183
|
+
id: 'live-monitoring-overview',
|
|
184
|
+
title: 'Live Monitoring (SSE)',
|
|
185
|
+
content: `
|
|
186
|
+
## Live Monitoring — Real-Time SSE Stream
|
|
187
|
+
|
|
188
|
+
Live Monitoring provides an in-memory, real-time monitoring service that streams server health data via Server-Sent Events (SSE). It's designed for admin dashboards that need live visibility into server state.
|
|
189
|
+
|
|
190
|
+
### What It Tracks
|
|
191
|
+
|
|
192
|
+
| Category | Data |
|
|
193
|
+
|----------|------|
|
|
194
|
+
| **Memory** | RSS, heap used/total, external, array buffers — sampled at configurable intervals |
|
|
195
|
+
| **CPU** | Usage percentage — sampled at configurable intervals |
|
|
196
|
+
| **Requests** | Every HTTP request: method, path, status, duration, user ID, IP |
|
|
197
|
+
| **Dapr Events** | Dapr sidecar interactions (if Dapr is enabled) |
|
|
198
|
+
| **WebSocket** | WS connection events and message counts |
|
|
199
|
+
|
|
200
|
+
All data is stored in circular buffers with configurable limits — no database, no persistence. This keeps it zero-cost for production.
|
|
201
|
+
|
|
202
|
+
### SSE Stream
|
|
203
|
+
|
|
204
|
+
\`\`\`
|
|
205
|
+
GET /live-monitoring/logs/stream
|
|
206
|
+
\`\`\`
|
|
207
|
+
|
|
208
|
+
The stream sends two event types:
|
|
209
|
+
|
|
210
|
+
**snapshot** — Sent once on connection. Contains all current buffered data (memory logs, CPU logs, recent requests, Dapr events, WS events, worker info).
|
|
211
|
+
|
|
212
|
+
**update** — Sent at \`streamInterval\` (default: 2s). Contains only new data since the last update.
|
|
213
|
+
|
|
214
|
+
### Other Endpoints
|
|
215
|
+
|
|
216
|
+
| Endpoint | Description |
|
|
217
|
+
|----------|-------------|
|
|
218
|
+
| \`GET /live-monitoring/health\` | Service health check |
|
|
219
|
+
| \`GET /live-monitoring/settings\` | Current monitoring settings |
|
|
220
|
+
| \`PATCH /live-monitoring/settings\` | Update settings at runtime |
|
|
221
|
+
| \`GET /live-monitoring/logs\` | One-shot snapshot of all buffered data |
|
|
222
|
+
|
|
223
|
+
### Runtime Settings
|
|
224
|
+
|
|
225
|
+
You can toggle monitoring features and adjust intervals without restarting:
|
|
226
|
+
|
|
227
|
+
\`\`\`bash
|
|
228
|
+
PATCH /live-monitoring/settings
|
|
229
|
+
Content-Type: application/json
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
"logMemory": true,
|
|
233
|
+
"logCpu": true,
|
|
234
|
+
"memoryLogInterval": 5000,
|
|
235
|
+
"cpuLogInterval": 5000,
|
|
236
|
+
"memoryLogLimit": 100,
|
|
237
|
+
"requestLogLimit": 200
|
|
238
|
+
}
|
|
239
|
+
\`\`\`
|
|
240
|
+
|
|
241
|
+
### Configuration
|
|
242
|
+
|
|
243
|
+
\`\`\`json
|
|
244
|
+
{
|
|
245
|
+
"liveMonitoring": {
|
|
246
|
+
"enabled": true,
|
|
247
|
+
"logMemory": true,
|
|
248
|
+
"logCpu": true,
|
|
249
|
+
"logDapr": false,
|
|
250
|
+
"logWebSocket": false,
|
|
251
|
+
"memoryLogInterval": 5000,
|
|
252
|
+
"cpuLogInterval": 5000,
|
|
253
|
+
"memoryLogLimit": 100,
|
|
254
|
+
"cpuLogLimit": 100,
|
|
255
|
+
"daprLogLimit": 50,
|
|
256
|
+
"wsLogLimit": 50,
|
|
257
|
+
"requestLogLimit": 200,
|
|
258
|
+
"streamInterval": 2000,
|
|
259
|
+
"basePath": "/live-monitoring"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
\`\`\`
|
|
263
|
+
`,
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: 'health-endpoint',
|
|
267
|
+
title: 'Health Checks',
|
|
268
|
+
content: `
|
|
269
|
+
## Health Checks
|
|
270
|
+
|
|
271
|
+
Nucleus automatically creates a health check endpoint:
|
|
272
|
+
|
|
273
|
+
\`\`\`
|
|
274
|
+
GET /health
|
|
275
|
+
\`\`\`
|
|
276
|
+
|
|
277
|
+
### Response
|
|
278
|
+
|
|
279
|
+
\`\`\`json
|
|
280
|
+
{
|
|
281
|
+
"status": "ok",
|
|
282
|
+
"appId": "my-api",
|
|
283
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
|
284
|
+
"uptime": 86400
|
|
285
|
+
}
|
|
286
|
+
\`\`\`
|
|
287
|
+
|
|
288
|
+
This endpoint is always public (no authentication required) and is used by:
|
|
289
|
+
- **Kubernetes liveness/readiness probes**
|
|
290
|
+
- **Load balancer health checks**
|
|
291
|
+
- **External monitoring services**
|
|
292
|
+
|
|
293
|
+
### Kubernetes Probe Example
|
|
294
|
+
|
|
295
|
+
\`\`\`yaml
|
|
296
|
+
livenessProbe:
|
|
297
|
+
httpGet:
|
|
298
|
+
path: /health
|
|
299
|
+
port: 9000
|
|
300
|
+
initialDelaySeconds: 30
|
|
301
|
+
periodSeconds: 10
|
|
302
|
+
readinessProbe:
|
|
303
|
+
httpGet:
|
|
304
|
+
path: /health
|
|
305
|
+
port: 9000
|
|
306
|
+
initialDelaySeconds: 5
|
|
307
|
+
periodSeconds: 5
|
|
308
|
+
\`\`\`
|
|
309
|
+
`,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
]
|