adonisjs-server-stats 1.12.3 → 1.14.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 +11 -6
- package/dist/configure.js +6 -1
- package/dist/core/collectors/collector.d.ts +83 -0
- package/dist/core/core/types.d.ts +186 -0
- package/dist/core/debug/types.d.ts +467 -0
- package/dist/core/index.js +184 -169
- package/dist/core/types.d.ts +855 -167
- package/dist/react/{CacheSection-CX2duJuc.js → CacheSection-DkLtukWz.js} +1 -1
- package/dist/react/{CacheTab-CgT4t0oZ.js → CacheTab-DWeXnEBI.js} +51 -46
- package/dist/react/ConfigContent-Bwvfl_G7.js +350 -0
- package/dist/react/{ConfigSection-Dt0FyeaW.js → ConfigSection-DaVbFPDg.js} +2 -2
- package/dist/react/{ConfigTab-KtiTtsrj.js → ConfigTab-D4640WJZ.js} +2 -2
- package/dist/react/{CustomPaneTab-15QoEplP.js → CustomPaneTab-DglmAVMC.js} +1 -1
- package/dist/react/{EmailsSection-YcJYR5eA.js → EmailsSection-vYx6ExTb.js} +1 -1
- package/dist/react/{EmailsTab-CUjubln_.js → EmailsTab-DKDrRmRH.js} +54 -49
- package/dist/react/{EventsSection-GGPoYSNv.js → EventsSection-CapH5xut.js} +1 -1
- package/dist/react/{EventsTab-Wdwr0_ny.js → EventsTab-BNVEySAm.js} +1 -1
- package/dist/react/{InternalsContent-BNOnSoi9.js → InternalsContent-C9lIA92C.js} +1 -1
- package/dist/react/{InternalsSection-BwrTfpjA.js → InternalsSection-lOv_UcSV.js} +1 -1
- package/dist/react/{InternalsTab--RD-L1dX.js → InternalsTab-BygoSorC.js} +1 -1
- package/dist/react/{JobsSection-BqqIh_DR.js → JobsSection-ZIQsJWid.js} +1 -1
- package/dist/react/{JobsTab-CBrU-ryL.js → JobsTab-DXQzXrDt.js} +1 -1
- package/dist/react/{LogEntryRow-BOrRkhRU.js → LogEntryRow-BWkHE51-.js} +1 -1
- package/dist/react/{LogsSection-Cm_lphM6.js → LogsSection-ConXdBkL.js} +2 -2
- package/dist/react/LogsTab-CJM47LPn.js +82 -0
- package/dist/react/{OverviewSection-XF7bakyM.js → OverviewSection-DOMu2qvl.js} +131 -131
- package/dist/react/{QueriesSection-DsQBKrNK.js → QueriesSection-DFsaOSJI.js} +1 -1
- package/dist/react/{QueriesTab-CxCC1GVq.js → QueriesTab-CY9CG_7L.js} +1 -1
- package/dist/react/RequestsSection-CC-eVHsl.js +326 -0
- package/dist/react/{RoutesSection-D0y5JQP4.js → RoutesSection-p1DMq41y.js} +1 -1
- package/dist/react/{RoutesTab-Y_alJVMV.js → RoutesTab-Cnqy8UcK.js} +1 -1
- package/dist/react/{SplitPaneWrapper-CZl1ouIT.js → SplitPaneWrapper-XgkA0QxE.js} +1 -1
- package/dist/react/{TimelineTab-HyqZpfbp.js → TimelineTab-1YOERxe5.js} +3 -3
- package/dist/react/index-DOSlCpZ9.js +1159 -0
- package/dist/react/index.js +1 -1
- package/dist/react/useApiClient-CtEG7rHs.js +11 -0
- package/dist/src/collectors/adonisjs_queue_collector.d.ts +21 -0
- package/dist/src/collectors/adonisjs_queue_collector.js +61 -0
- package/dist/src/collectors/auto_detect.js +8 -2
- package/dist/src/collectors/index.d.ts +2 -0
- package/dist/src/collectors/index.js +1 -0
- package/dist/src/collectors/queue_collector.js +22 -6
- package/dist/src/config/deprecation_migration.js +11 -0
- package/dist/src/dashboard/cache_handlers.js +22 -2
- package/dist/src/dashboard/flush_manager.d.ts +2 -0
- package/dist/src/dashboard/flush_manager.js +17 -0
- package/dist/src/dashboard/inspector_manager.d.ts +4 -4
- package/dist/src/dashboard/inspector_manager.js +20 -10
- package/dist/src/dashboard/integrations/adonisjs_queue_inspector.d.ts +42 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_inspector.js +135 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_store.d.ts +166 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_store.js +629 -0
- package/dist/src/dashboard/integrations/config_inspector.d.ts +0 -1
- package/dist/src/dashboard/integrations/config_inspector.js +4 -2
- package/dist/src/dashboard/integrations/index.d.ts +4 -1
- package/dist/src/dashboard/integrations/index.js +2 -0
- package/dist/src/dashboard/integrations/queue_inspector.d.ts +5 -61
- package/dist/src/dashboard/integrations/queue_inspector.js +5 -1
- package/dist/src/dashboard/integrations/queue_inspector_contract.d.ts +73 -0
- package/dist/src/dashboard/integrations/queue_inspector_contract.js +15 -0
- package/dist/src/dashboard/paginate_helper.d.ts +5 -0
- package/dist/src/dashboard/paginate_helper.js +16 -4
- package/dist/src/dashboard/query_explain_handler.d.ts +6 -1
- package/dist/src/dashboard/query_explain_handler.js +12 -2
- package/dist/src/dashboard/write_queue.d.ts +13 -0
- package/dist/src/dashboard/write_queue.js +34 -2
- package/dist/src/debug/debug_store.js +8 -1
- package/dist/src/debug/event_collector.js +4 -0
- package/dist/src/debug/query_collector.js +2 -0
- package/dist/src/debug/ring_buffer.js +8 -1
- package/dist/src/debug/trace_collector.js +34 -10
- package/dist/src/debug/types.d.ts +2 -0
- package/dist/src/define_config.js +1 -0
- package/dist/src/edge/client/dashboard.js +2 -2
- package/dist/src/edge/client/debug-panel-deferred.js +1 -1
- package/dist/src/edge/client/stats-bar.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +5 -5
- package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
- package/dist/src/engine/request_metrics.js +8 -10
- package/dist/src/log_stream/log_stream_service.d.ts +1 -0
- package/dist/src/log_stream/log_stream_service.js +7 -5
- package/dist/src/prometheus/prometheus_collector.d.ts +9 -0
- package/dist/src/prometheus/prometheus_collector.js +11 -0
- package/dist/src/provider/dashboard_init.js +15 -0
- package/dist/src/provider/dashboard_setup.js +9 -2
- package/dist/src/provider/email_bridge.d.ts +14 -3
- package/dist/src/provider/email_bridge.js +25 -3
- package/dist/src/provider/email_helpers.d.ts +9 -1
- package/dist/src/provider/email_helpers.js +32 -4
- package/dist/src/provider/pino_hook.d.ts +8 -0
- package/dist/src/provider/pino_hook.js +19 -1
- package/dist/src/provider/provider_helpers_extra.d.ts +2 -0
- package/dist/src/provider/provider_helpers_extra.js +17 -2
- package/dist/src/provider/server_stats_provider.js +19 -1
- package/dist/src/provider/shutdown_helpers.js +2 -0
- package/dist/src/provider/toolbar_setup.js +32 -17
- package/dist/src/routes/dashboard_routes.js +96 -62
- package/dist/src/routes/debug_routes.js +45 -35
- package/dist/src/routes/no_session_middleware.d.ts +6 -3
- package/dist/src/routes/no_session_middleware.js +7 -3
- package/dist/src/routes/register_routes.d.ts +8 -0
- package/dist/src/routes/register_routes.js +19 -0
- package/dist/src/types.d.ts +31 -0
- package/dist/src/utils/app_import.js +12 -4
- package/dist/vue/CacheSection-CxEBVVkF.js +156 -0
- package/dist/vue/ConfigSection-BiRAiaHj.js +415 -0
- package/dist/vue/EmailsSection-Dl44qyqY.js +208 -0
- package/dist/vue/{EmailsTab-CwIF1fik.js → EmailsTab-Diya54CP.js} +6 -5
- package/dist/vue/{EventsSection-BpgkWIwM.js → EventsSection-CWjeitjU.js} +1 -1
- package/dist/vue/{InternalsTab-521fxYYj.js → InternalsTab-Z3c82glB.js} +15 -15
- package/dist/vue/{JobsSection-DrghFEKL.js → JobsSection-DOBb4LjZ.js} +1 -1
- package/dist/vue/LogsSection-CXx-HOWJ.js +260 -0
- package/dist/vue/{OverviewSection-BAgZTPjY.js → OverviewSection-CyfNQ8uV.js} +318 -302
- package/dist/vue/{QueriesSection-CUpwhp7u.js → QueriesSection-CXBsFp-y.js} +1 -1
- package/dist/vue/{RequestsSection-D8P2xpF2.js → RequestsSection-YTIaZGZd.js} +151 -145
- package/dist/vue/{RoutesSection-0qB81hTT.js → RoutesSection-CDKMey49.js} +1 -1
- package/dist/vue/composables/useApiClient.d.ts +8 -1
- package/dist/vue/index-14x39RI_.js +1239 -0
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +16 -3
- package/dist/react/ConfigContent-CnsEI4j3.js +0 -397
- package/dist/react/LogsTab-jKwv9G7Q.js +0 -79
- package/dist/react/RequestsSection-D8cMbZU0.js +0 -321
- package/dist/react/index-CsprmgzI.js +0 -1121
- package/dist/react/useApiClient-BVtNCmnL.js +0 -9
- package/dist/vue/CacheSection-DRqV3YX2.js +0 -149
- package/dist/vue/ConfigSection-C6pQCHAL.js +0 -576
- package/dist/vue/EmailsSection-BTNw3ZU2.js +0 -206
- package/dist/vue/LogsSection-BDxx9Bfi.js +0 -258
- package/dist/vue/index-30jLw-_w.js +0 -1232
- /package/dist/core/{api-client.d.ts → core/api-client.d.ts} +0 -0
- /package/dist/core/{config-utils.d.ts → core/config-utils.d.ts} +0 -0
- /package/dist/core/{constants.d.ts → core/constants.d.ts} +0 -0
- /package/dist/core/{dashboard-api.d.ts → core/dashboard-api.d.ts} +0 -0
- /package/dist/core/{dashboard-data-controller.d.ts → core/dashboard-data-controller.d.ts} +0 -0
- /package/dist/core/{dashboard-data-helpers.d.ts → core/dashboard-data-helpers.d.ts} +0 -0
- /package/dist/core/{debug-data-controller.d.ts → core/debug-data-controller.d.ts} +0 -0
- /package/dist/core/{define-config-helpers.d.ts → core/define-config-helpers.d.ts} +0 -0
- /package/dist/core/{explain-utils.d.ts → core/explain-utils.d.ts} +0 -0
- /package/dist/core/{feature-detect-helpers.d.ts → core/feature-detect-helpers.d.ts} +0 -0
- /package/dist/core/{feature-detect.d.ts → core/feature-detect.d.ts} +0 -0
- /package/dist/core/{field-resolvers.d.ts → core/field-resolvers.d.ts} +0 -0
- /package/dist/core/{formatters-helpers.d.ts → core/formatters-helpers.d.ts} +0 -0
- /package/dist/core/{formatters.d.ts → core/formatters.d.ts} +0 -0
- /package/dist/core/{history-buffer.d.ts → core/history-buffer.d.ts} +0 -0
- /package/dist/core/{icons.d.ts → core/icons.d.ts} +0 -0
- /package/dist/core/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/core/{internals-utils.d.ts → core/internals-utils.d.ts} +0 -0
- /package/dist/core/{job-utils.d.ts → core/job-utils.d.ts} +0 -0
- /package/dist/core/{log-utils-helpers.d.ts → core/log-utils-helpers.d.ts} +0 -0
- /package/dist/core/{log-utils.d.ts → core/log-utils.d.ts} +0 -0
- /package/dist/core/{metrics.d.ts → core/metrics.d.ts} +0 -0
- /package/dist/core/{pagination.d.ts → core/pagination.d.ts} +0 -0
- /package/dist/core/{queries-columns.d.ts → core/queries-columns.d.ts} +0 -0
- /package/dist/core/{queries-controller.d.ts → core/queries-controller.d.ts} +0 -0
- /package/dist/core/{query-utils.d.ts → core/query-utils.d.ts} +0 -0
- /package/dist/core/{resizable-columns.d.ts → core/resizable-columns.d.ts} +0 -0
- /package/dist/core/{routes.d.ts → core/routes.d.ts} +0 -0
- /package/dist/core/{server-stats-controller.d.ts → core/server-stats-controller.d.ts} +0 -0
- /package/dist/core/{sparkline.d.ts → core/sparkline.d.ts} +0 -0
- /package/dist/core/{split-pane.d.ts → core/split-pane.d.ts} +0 -0
- /package/dist/core/{theme.d.ts → core/theme.d.ts} +0 -0
- /package/dist/core/{trace-utils.d.ts → core/trace-utils.d.ts} +0 -0
- /package/dist/core/{transmit-adapter.d.ts → core/transmit-adapter.d.ts} +0 -0
- /package/dist/core/{transmit-helpers.d.ts → core/transmit-helpers.d.ts} +0 -0
- /package/dist/core/{types-dashboard.d.ts → core/types-dashboard.d.ts} +0 -0
- /package/dist/core/{types-diagnostics.d.ts → core/types-diagnostics.d.ts} +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { QueueJobSummary, QueueJobDetail, QueueJobListResult } from './queue_inspector.js';
|
|
2
|
+
/** JobStatus as stored in the queue_jobs table / Redis hashes. */
|
|
3
|
+
type BoringJobStatus = 'pending' | 'active' | 'delayed' | 'completed' | 'failed';
|
|
4
|
+
/** JobData — the JSON blob stored in queue_jobs.data / Redis ::data hash. */
|
|
5
|
+
interface BoringJobData {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
payload?: unknown;
|
|
9
|
+
attempts: number;
|
|
10
|
+
priority?: number;
|
|
11
|
+
nextRetryAt?: Date;
|
|
12
|
+
stalledCount?: number;
|
|
13
|
+
groupId?: string;
|
|
14
|
+
/** Unix ms timestamp set when the job was dispatched. */
|
|
15
|
+
createdAt?: number;
|
|
16
|
+
/** Not persisted per-row; best-effort from static job options. */
|
|
17
|
+
maxRetries?: number;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** JobRecord — returned by adapter.getJob / stored in completed|failed hashes. */
|
|
21
|
+
interface BoringJobRecord {
|
|
22
|
+
status: BoringJobStatus;
|
|
23
|
+
data: BoringJobData;
|
|
24
|
+
finishedAt?: number;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Minimal Lucid db service interface. */
|
|
28
|
+
interface LucidDb {
|
|
29
|
+
primaryConnectionName: string;
|
|
30
|
+
connection(name?: string): {
|
|
31
|
+
getWriteClient(): unknown;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Minimal @adonisjs/redis manager interface. */
|
|
35
|
+
interface AdonisRedisManager {
|
|
36
|
+
connection(name?: string): AdonisRedisConnection;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Minimal ioredis-compatible connection interface.
|
|
40
|
+
* All methods present on a real ioredis client that we call.
|
|
41
|
+
*/
|
|
42
|
+
interface AdonisRedisConnection {
|
|
43
|
+
zcard(key: string): Promise<number>;
|
|
44
|
+
hlen(key: string): Promise<number>;
|
|
45
|
+
zrange(key: string, start: number, stop: number): Promise<string[]>;
|
|
46
|
+
hget(key: string, field: string): Promise<string | null>;
|
|
47
|
+
hscan(key: string, cursor: string, countKeyword: string, count: string): Promise<[string, string[]]>;
|
|
48
|
+
hset(key: string, field: string, value: string): Promise<number>;
|
|
49
|
+
zadd(key: string, score: number, member: string): Promise<number>;
|
|
50
|
+
hdel(key: string, field: string): Promise<number>;
|
|
51
|
+
zrem(key: string, member: string): Promise<number>;
|
|
52
|
+
zscore(key: string, member: string): Promise<string | null>;
|
|
53
|
+
hkeys(key: string): Promise<string[]>;
|
|
54
|
+
}
|
|
55
|
+
/** Minimal adapter interface (only what we need for driver detection). */
|
|
56
|
+
interface BoringAdapter {
|
|
57
|
+
constructor: {
|
|
58
|
+
name: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Minimal QueueManagerSingleton (only what we call). */
|
|
62
|
+
interface BoringQueueManager {
|
|
63
|
+
use(name?: string): BoringAdapter;
|
|
64
|
+
}
|
|
65
|
+
/** Config shape for @adonisjs/queue. */
|
|
66
|
+
interface QueueConfig {
|
|
67
|
+
default?: string;
|
|
68
|
+
adapters?: Record<string, {
|
|
69
|
+
connectionName?: string;
|
|
70
|
+
}>;
|
|
71
|
+
queues?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
/** Job counts aggregated across all configured queues. */
|
|
74
|
+
export interface QueueCounts {
|
|
75
|
+
active: number;
|
|
76
|
+
waiting: number;
|
|
77
|
+
delayed: number;
|
|
78
|
+
completed: number;
|
|
79
|
+
failed: number;
|
|
80
|
+
}
|
|
81
|
+
/** Thin interface implemented by both the database and redis readers. */
|
|
82
|
+
export interface QueueStoreReader {
|
|
83
|
+
getCounts(): Promise<QueueCounts>;
|
|
84
|
+
listJobs(status: QueueJobSummary['status'] | 'all', page: number, perPage: number): Promise<QueueJobListResult>;
|
|
85
|
+
getJob(id: string): Promise<QueueJobDetail | null>;
|
|
86
|
+
retryJob(id: string): Promise<boolean>;
|
|
87
|
+
getWorkerCount(): Promise<number>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Map a @boringnode `JobRecord` (plus optional DB `acquired_at` timestamp) to
|
|
91
|
+
* the `QueueJobSummary` shape used by the dashboard.
|
|
92
|
+
*
|
|
93
|
+
* Known gaps (no per-row data; documented inline):
|
|
94
|
+
* - `progress`: always 0 — @boringnode/queue does not persist per-row progress.
|
|
95
|
+
* - `returnValue`: always null — not stored in the queue table/hash.
|
|
96
|
+
* - `maxAttempts`: best-effort from `data.maxRetries`; falls back to `attempts`.
|
|
97
|
+
* - `stackTrace`: collapsed to `[record.error]`; no real stack trace in store.
|
|
98
|
+
*
|
|
99
|
+
* @param record The raw job record from the store.
|
|
100
|
+
* @param acquiredAtMs Unix-ms timestamp from DB `acquired_at` column, or null.
|
|
101
|
+
*/
|
|
102
|
+
export declare function mapJobRecordToSummary(record: BoringJobRecord, acquiredAtMs: number | null): QueueJobSummary;
|
|
103
|
+
/** Pre-resolved services, accepted by the factory for both call paths. */
|
|
104
|
+
export interface QueueStoreReaderServices {
|
|
105
|
+
queueManager: BoringQueueManager;
|
|
106
|
+
config: QueueConfig;
|
|
107
|
+
/** Lucid db instance — required for the database driver. */
|
|
108
|
+
db?: LucidDb;
|
|
109
|
+
/** AdonisJS redis manager — required for the redis driver. */
|
|
110
|
+
redis?: AdonisRedisManager;
|
|
111
|
+
/** Override the database/redis connection name derived from config. */
|
|
112
|
+
connectionName?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Build a {@link QueueStoreReader} from already-resolved services.
|
|
116
|
+
*
|
|
117
|
+
* Both the inspector path (`app.container.make`) and the collector path
|
|
118
|
+
* (`appImport`) resolve their own services and pass them here.
|
|
119
|
+
* Returns a safe-defaults no-op reader if driver detection fails or the
|
|
120
|
+
* required service (db or redis) is absent.
|
|
121
|
+
*/
|
|
122
|
+
export declare function buildQueueStoreReader(services: QueueStoreReaderServices): QueueStoreReader;
|
|
123
|
+
/** Minimal shape of the AdonisJS Application instance we depend on. */
|
|
124
|
+
interface ApplicationLike {
|
|
125
|
+
config: {
|
|
126
|
+
get(key: string): unknown;
|
|
127
|
+
};
|
|
128
|
+
container: {
|
|
129
|
+
make(binding: string): Promise<unknown>;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Resolve services from an AdonisJS Application instance and build a store reader.
|
|
134
|
+
*
|
|
135
|
+
* This is the canonical resolver: the queue config lives in the app's
|
|
136
|
+
* `config/queue.ts` (there is no package-level config export), so it can only
|
|
137
|
+
* be read from `app.config.get('queue')`. Both the inspector and collector
|
|
138
|
+
* paths funnel through here.
|
|
139
|
+
*
|
|
140
|
+
* Returns null if @adonisjs/queue is not registered (e.g. wrong environment).
|
|
141
|
+
*/
|
|
142
|
+
export declare function resolveFromApplication(app: ApplicationLike): Promise<QueueStoreReader | null>;
|
|
143
|
+
/**
|
|
144
|
+
* Resolve services for the inspector path.
|
|
145
|
+
*
|
|
146
|
+
* Accepts either a full Application-like object (with `config` + `container`)
|
|
147
|
+
* or a bare container (legacy). When given a bare container it resolves the
|
|
148
|
+
* application via the `app` binding to read the queue config.
|
|
149
|
+
*
|
|
150
|
+
* Returns null if @adonisjs/queue is not registered (e.g. wrong environment).
|
|
151
|
+
*/
|
|
152
|
+
export declare function resolveFromContainer(appOrContainer: ApplicationLike | {
|
|
153
|
+
make(binding: string): Promise<unknown>;
|
|
154
|
+
}): Promise<QueueStoreReader | null>;
|
|
155
|
+
/**
|
|
156
|
+
* Resolve services via `appImport` and build a store reader.
|
|
157
|
+
*
|
|
158
|
+
* Designed for the collector path where no IoC container reference is held.
|
|
159
|
+
* Resolves the running Application via `@adonisjs/core/services/app` (the same
|
|
160
|
+
* service the official `@adonisjs/queue` package uses), then reads the queue
|
|
161
|
+
* config and services from it.
|
|
162
|
+
*
|
|
163
|
+
* Returns null if @adonisjs/queue is not installed in the host application.
|
|
164
|
+
*/
|
|
165
|
+
export declare function resolveFromAppImport(): Promise<QueueStoreReader | null>;
|
|
166
|
+
export {};
|