@adonis-agora/telescope 0.3.3 → 0.5.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/CHANGELOG.md +10 -0
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +6 -0
- package/dist/configure.js.map +1 -1
- package/dist/providers/telescope_ai_provider.d.ts +9 -1
- package/dist/providers/telescope_ai_provider.d.ts.map +1 -1
- package/dist/providers/telescope_ai_provider.js +22 -2
- package/dist/providers/telescope_ai_provider.js.map +1 -1
- package/dist/providers/telescope_alerts_provider.d.ts +1 -0
- package/dist/providers/telescope_alerts_provider.d.ts.map +1 -1
- package/dist/providers/telescope_alerts_provider.js +37 -1
- package/dist/providers/telescope_alerts_provider.js.map +1 -1
- package/dist/providers/telescope_mcp_provider.d.ts +26 -0
- package/dist/providers/telescope_mcp_provider.d.ts.map +1 -0
- package/dist/providers/telescope_mcp_provider.js +114 -0
- package/dist/providers/telescope_mcp_provider.js.map +1 -0
- package/dist/providers/telescope_provider.d.ts +8 -0
- package/dist/providers/telescope_provider.d.ts.map +1 -1
- package/dist/providers/telescope_provider.js +56 -1
- package/dist/providers/telescope_provider.js.map +1 -1
- package/dist/providers/telescope_ui_provider.d.ts +2 -0
- package/dist/providers/telescope_ui_provider.d.ts.map +1 -1
- package/dist/providers/telescope_ui_provider.js +106 -22
- package/dist/providers/telescope_ui_provider.js.map +1 -1
- package/dist/providers/telescope_watchers_provider.d.ts +13 -2
- package/dist/providers/telescope_watchers_provider.d.ts.map +1 -1
- package/dist/providers/telescope_watchers_provider.js +57 -7
- package/dist/providers/telescope_watchers_provider.js.map +1 -1
- package/dist/src/ai/define_config.d.ts +39 -7
- package/dist/src/ai/define_config.d.ts.map +1 -1
- package/dist/src/ai/define_config.js +14 -4
- package/dist/src/ai/define_config.js.map +1 -1
- package/dist/src/ai/diagnosis_coordinator.d.ts +106 -0
- package/dist/src/ai/diagnosis_coordinator.d.ts.map +1 -0
- package/dist/src/ai/diagnosis_coordinator.js +143 -0
- package/dist/src/ai/diagnosis_coordinator.js.map +1 -0
- package/dist/src/ai/factory.d.ts +8 -5
- package/dist/src/ai/factory.d.ts.map +1 -1
- package/dist/src/ai/factory.js +20 -8
- package/dist/src/ai/factory.js.map +1 -1
- package/dist/src/ai/index.d.ts +3 -1
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +3 -1
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/alerts/alert_rule.d.ts +79 -11
- package/dist/src/alerts/alert_rule.d.ts.map +1 -1
- package/dist/src/alerts/alerter.d.ts +11 -1
- package/dist/src/alerts/alerter.d.ts.map +1 -1
- package/dist/src/alerts/alerter.js +21 -1
- package/dist/src/alerts/alerter.js.map +1 -1
- package/dist/src/alerts/alerter_service.d.ts +103 -0
- package/dist/src/alerts/alerter_service.d.ts.map +1 -0
- package/dist/src/alerts/alerter_service.js +215 -0
- package/dist/src/alerts/alerter_service.js.map +1 -0
- package/dist/src/alerts/index.d.ts +4 -2
- package/dist/src/alerts/index.d.ts.map +1 -1
- package/dist/src/alerts/index.js +4 -2
- package/dist/src/alerts/index.js.map +1 -1
- package/dist/src/alerts/slack_format.d.ts.map +1 -1
- package/dist/src/alerts/slack_format.js +35 -2
- package/dist/src/alerts/slack_format.js.map +1 -1
- package/dist/src/client_errors/config.d.ts +66 -0
- package/dist/src/client_errors/config.d.ts.map +1 -0
- package/dist/src/client_errors/config.js +17 -0
- package/dist/src/client_errors/config.js.map +1 -0
- package/dist/src/client_errors/index.d.ts +5 -0
- package/dist/src/client_errors/index.d.ts.map +1 -0
- package/dist/src/client_errors/index.js +5 -0
- package/dist/src/client_errors/index.js.map +1 -0
- package/dist/src/client_errors/ingestor.d.ts +87 -0
- package/dist/src/client_errors/ingestor.d.ts.map +1 -0
- package/dist/src/client_errors/ingestor.js +135 -0
- package/dist/src/client_errors/ingestor.js.map +1 -0
- package/dist/src/client_errors/rate_limiter.d.ts +53 -0
- package/dist/src/client_errors/rate_limiter.d.ts.map +1 -0
- package/dist/src/client_errors/rate_limiter.js +83 -0
- package/dist/src/client_errors/rate_limiter.js.map +1 -0
- package/dist/src/client_errors/validation.d.ts +62 -0
- package/dist/src/client_errors/validation.d.ts.map +1 -0
- package/dist/src/client_errors/validation.js +109 -0
- package/dist/src/client_errors/validation.js.map +1 -0
- package/dist/src/define_config.d.ts +120 -0
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +41 -0
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/entry.d.ts +20 -0
- package/dist/src/entry.d.ts.map +1 -1
- package/dist/src/entry.js +20 -0
- package/dist/src/entry.js.map +1 -1
- package/dist/src/index.d.ts +17 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +16 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/define_config.d.ts +57 -0
- package/dist/src/mcp/define_config.d.ts.map +1 -0
- package/dist/src/mcp/define_config.js +35 -0
- package/dist/src/mcp/define_config.js.map +1 -0
- package/dist/src/mcp/index.d.ts +7 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +7 -0
- package/dist/src/mcp/index.js.map +1 -0
- package/dist/src/mcp/server.d.ts +89 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +279 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/metrics/pulse.d.ts +158 -0
- package/dist/src/metrics/pulse.d.ts.map +1 -0
- package/dist/src/metrics/pulse.js +414 -0
- package/dist/src/metrics/pulse.js.map +1 -0
- package/dist/src/overload_guard.d.ts +77 -0
- package/dist/src/overload_guard.d.ts.map +1 -0
- package/dist/src/overload_guard.js +134 -0
- package/dist/src/overload_guard.js.map +1 -0
- package/dist/src/pruner.d.ts +93 -0
- package/dist/src/pruner.d.ts.map +1 -0
- package/dist/src/pruner.js +120 -0
- package/dist/src/pruner.js.map +1 -0
- package/dist/src/registry.d.ts +26 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +19 -0
- package/dist/src/registry.js.map +1 -1
- package/dist/src/service.d.ts +16 -1
- package/dist/src/service.d.ts.map +1 -1
- package/dist/src/service.js +19 -1
- package/dist/src/service.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +20 -0
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +89 -4
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/telescope_middleware.d.ts.map +1 -1
- package/dist/src/telescope_middleware.js +3 -1
- package/dist/src/telescope_middleware.js.map +1 -1
- package/dist/src/ui/api.d.ts +9 -1
- package/dist/src/ui/api.d.ts.map +1 -1
- package/dist/src/ui/api.js +23 -1
- package/dist/src/ui/api.js.map +1 -1
- package/dist/src/ui/auth.d.ts +112 -0
- package/dist/src/ui/auth.d.ts.map +1 -0
- package/dist/src/ui/auth.js +130 -0
- package/dist/src/ui/auth.js.map +1 -0
- package/dist/src/ui/dashboard_auth.d.ts +34 -0
- package/dist/src/ui/dashboard_auth.d.ts.map +1 -0
- package/dist/src/ui/dashboard_auth.js +57 -0
- package/dist/src/ui/dashboard_auth.js.map +1 -0
- package/dist/src/ui/define_config.d.ts +15 -0
- package/dist/src/ui/define_config.d.ts.map +1 -1
- package/dist/src/ui/define_config.js +4 -0
- package/dist/src/ui/define_config.js.map +1 -1
- package/dist/src/ui/index.d.ts +7 -1
- package/dist/src/ui/index.d.ts.map +1 -1
- package/dist/src/ui/index.js +6 -1
- package/dist/src/ui/index.js.map +1 -1
- package/dist/src/ui/login_page.d.ts +23 -0
- package/dist/src/ui/login_page.d.ts.map +1 -0
- package/dist/src/ui/login_page.js +170 -0
- package/dist/src/ui/login_page.js.map +1 -0
- package/dist/src/ui/session_cookie.d.ts +42 -0
- package/dist/src/ui/session_cookie.d.ts.map +1 -0
- package/dist/src/ui/session_cookie.js +97 -0
- package/dist/src/ui/session_cookie.js.map +1 -0
- package/dist/src/watchers/define_config.d.ts +115 -12
- package/dist/src/watchers/define_config.d.ts.map +1 -1
- package/dist/src/watchers/define_config.js +48 -11
- package/dist/src/watchers/define_config.js.map +1 -1
- package/dist/src/watchers/http_client_watcher.d.ts +91 -31
- package/dist/src/watchers/http_client_watcher.d.ts.map +1 -1
- package/dist/src/watchers/http_client_watcher.js +161 -53
- package/dist/src/watchers/http_client_watcher.js.map +1 -1
- package/dist/src/watchers/index.d.ts +9 -5
- package/dist/src/watchers/index.d.ts.map +1 -1
- package/dist/src/watchers/index.js +6 -2
- package/dist/src/watchers/index.js.map +1 -1
- package/dist/src/watchers/lucid_query_watcher.d.ts +20 -2
- package/dist/src/watchers/lucid_query_watcher.d.ts.map +1 -1
- package/dist/src/watchers/lucid_query_watcher.js +44 -10
- package/dist/src/watchers/lucid_query_watcher.js.map +1 -1
- package/dist/src/watchers/profiling_watcher.d.ts +144 -0
- package/dist/src/watchers/profiling_watcher.d.ts.map +1 -0
- package/dist/src/watchers/profiling_watcher.js +231 -0
- package/dist/src/watchers/profiling_watcher.js.map +1 -0
- package/dist/src/watchers/query_family_hash.d.ts +7 -2
- package/dist/src/watchers/query_family_hash.d.ts.map +1 -1
- package/dist/src/watchers/query_family_hash.js +8 -3
- package/dist/src/watchers/query_family_hash.js.map +1 -1
- package/dist/src/watchers/record.d.ts.map +1 -1
- package/dist/src/watchers/record.js +4 -0
- package/dist/src/watchers/record.js.map +1 -1
- package/dist/src/watchers/schedule_watcher.d.ts +143 -0
- package/dist/src/watchers/schedule_watcher.d.ts.map +1 -0
- package/dist/src/watchers/schedule_watcher.js +195 -0
- package/dist/src/watchers/schedule_watcher.js.map +1 -0
- package/dist/stubs/config/telescope.stub +0 -65
- package/dist/stubs/config/telescope_ai.stub +0 -36
- package/dist/stubs/config/telescope_alerts.stub +0 -47
- package/dist/stubs/config/telescope_mcp.stub +0 -0
- package/dist/stubs/config/telescope_ui.stub +0 -53
- package/dist/stubs/config/telescope_watchers.stub +0 -41
- package/dist/stubs/database/migrations/create_telescope_entries_table.stub +2 -2
- package/package.json +12 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RecordInput } from '../entry.js';
|
|
2
|
-
/** Options for {@link HttpClientWatcher}. */
|
|
2
|
+
/** Options for {@link HttpClientWatcher} / {@link instrumentFetch}. */
|
|
3
3
|
export interface HttpClientWatcherOptions {
|
|
4
4
|
/** Outbound calls at/above this many ms get a `slow` tag. Default 1000. */
|
|
5
5
|
slowMs?: number;
|
|
@@ -7,6 +7,19 @@ export interface HttpClientWatcherOptions {
|
|
|
7
7
|
clock?: {
|
|
8
8
|
now(): number;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Hosts whose calls are NOT recorded (exact host match, case-insensitive; the
|
|
12
|
+
* host may include a port, e.g. `localhost:6379`). Use to drop noisy internal
|
|
13
|
+
* targets — a remote telescope store, a metrics sink — from the timeline.
|
|
14
|
+
*/
|
|
15
|
+
ignoreHosts?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, record the request/response body SIZES (bytes, never the bytes
|
|
18
|
+
* themselves) into the entry content. Request size is read from `init.body`;
|
|
19
|
+
* response size from the `content-length` header (the response stream is never
|
|
20
|
+
* consumed). Default `false`.
|
|
21
|
+
*/
|
|
22
|
+
captureBodies?: boolean;
|
|
10
23
|
}
|
|
11
24
|
/** The recorded body of an `http-client` entry. */
|
|
12
25
|
export interface HttpClientEntryContent {
|
|
@@ -22,53 +35,100 @@ export interface HttpClientEntryContent {
|
|
|
22
35
|
durationMs: number;
|
|
23
36
|
/** The active trace id at call time, or `null`. */
|
|
24
37
|
traceId: string | null;
|
|
38
|
+
/** Request body size in bytes when `captureBodies` is on and measurable, else `null`. */
|
|
39
|
+
requestBytes: number | null;
|
|
40
|
+
/** Response body size (from `content-length`) when `captureBodies` is on, else `null`. */
|
|
41
|
+
responseBytes: number | null;
|
|
42
|
+
/** The transport error message on a network failure, else `null`. */
|
|
43
|
+
error: string | null;
|
|
44
|
+
}
|
|
45
|
+
/** A single captured outbound call — the input to {@link buildHttpClientEntry}
|
|
46
|
+
* and the manual {@link HttpClientWatcher.record} helper. */
|
|
47
|
+
export interface OutgoingCall {
|
|
48
|
+
method: string;
|
|
49
|
+
url: string;
|
|
50
|
+
host: string | null;
|
|
51
|
+
statusCode: number | null;
|
|
52
|
+
durationMs: number;
|
|
53
|
+
requestBytes?: number | null;
|
|
54
|
+
responseBytes?: number | null;
|
|
55
|
+
error?: string | null;
|
|
25
56
|
}
|
|
26
57
|
type FetchFn = typeof globalThis.fetch;
|
|
27
58
|
type FetchInit = Parameters<FetchFn>[1];
|
|
28
|
-
/** Mark a `RequestInit` so
|
|
29
|
-
*
|
|
30
|
-
*
|
|
59
|
+
/** Mark a `RequestInit` so an instrumented fetch skips recording the call it
|
|
60
|
+
* belongs to. Use for telescope's own outbound fetches (remote store, alert
|
|
61
|
+
* webhooks) so the watcher never records — or recurses on — itself. */
|
|
31
62
|
export declare function markInternalFetch(init: FetchInit): FetchInit;
|
|
32
63
|
/**
|
|
33
|
-
* Records
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
64
|
+
* Records OUTBOUND HTTP calls as `http-client` telescope entries — **opt-in, with
|
|
65
|
+
* no global monkey-patching**. AdonisJS has no single built-in HTTP client, so
|
|
66
|
+
* this never replaces `globalThis.fetch`; instead you wrap a `fetch`
|
|
67
|
+
* implementation with {@link HttpClientWatcher.instrumentFetch} (or the
|
|
68
|
+
* standalone {@link instrumentFetch}) and hand the wrapper to your client, or
|
|
69
|
+
* record a non-`fetch` call yourself via {@link HttpClientWatcher.record}.
|
|
37
70
|
*
|
|
38
71
|
* The wrapper never alters the host's call: it awaits the real `fetch`, records
|
|
39
|
-
* fire-and-forget
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
72
|
+
* fire-and-forget through {@link safeRecord} (which honours the overload-shed
|
|
73
|
+
* `paused` flag and applies redaction/sampling on the store's write path), and
|
|
74
|
+
* always re-throws a network error. Calls to an `ignoreHosts` target, and
|
|
75
|
+
* telescope's own outbound fetches (marked via {@link markInternalFetch}), are
|
|
76
|
+
* skipped.
|
|
43
77
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
78
|
+
* Each entry carries `familyHash` (`METHOD host/normalized-path`) and
|
|
79
|
+
* `durationMs`, so it feeds the Pulse `slowOutgoing` hotspot card directly.
|
|
80
|
+
*
|
|
81
|
+
* Idiomatic Adonis: a plain class, no DI decorators. The provider constructs it
|
|
82
|
+
* from `config/telescope_watchers.ts` and calls {@link start} to publish it as
|
|
83
|
+
* the default backing a bare `instrumentFetch(fetch)`; {@link stop} unpublishes.
|
|
84
|
+
* Neither touches any global.
|
|
47
85
|
*/
|
|
48
86
|
export declare class HttpClientWatcher {
|
|
49
87
|
readonly type: "http-client";
|
|
50
88
|
private readonly slowMs;
|
|
51
89
|
private readonly clock;
|
|
52
|
-
|
|
53
|
-
private
|
|
90
|
+
private readonly ignoreHosts;
|
|
91
|
+
private readonly captureBodies;
|
|
54
92
|
constructor(options?: HttpClientWatcherOptions);
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
93
|
+
/** Publish this configured instance as the default that a bare
|
|
94
|
+
* {@link instrumentFetch} (called with no explicit options) inherits config
|
|
95
|
+
* from. Does NOT patch any global — instrumentation stays opt-in. Named
|
|
96
|
+
* `start`/`stop` to match the other watchers' provider lifecycle. */
|
|
57
97
|
start(): void;
|
|
58
|
-
/**
|
|
59
|
-
* current wrapper (avoids clobbering a wrapper a later instance installed). */
|
|
98
|
+
/** Unpublish this instance as the default (if it is). Never touches globals. */
|
|
60
99
|
stop(): void;
|
|
61
|
-
/**
|
|
62
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Wrap a `fetch` implementation so every call it makes is recorded as an
|
|
102
|
+
* `http-client` entry — WITHOUT mutating any global. The returned function has
|
|
103
|
+
* `fetch`'s signature; pass it to your HTTP client, or call it directly.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const trackedFetch = new HttpClientWatcher().instrumentFetch(globalThis.fetch)
|
|
107
|
+
* await trackedFetch('https://api.stripe.com/v1/charges')
|
|
108
|
+
*/
|
|
109
|
+
instrumentFetch(fetchImpl?: FetchFn): FetchFn;
|
|
110
|
+
/**
|
|
111
|
+
* Record one already-completed outbound call — the small helper for HTTP
|
|
112
|
+
* clients that are NOT `fetch`-based (axios, got, an undici stream). Compute
|
|
113
|
+
* the fields at your call site and hand them here; recording is fire-and-forget
|
|
114
|
+
* and never throws. Honours `ignoreHosts` and the overload-shed flag.
|
|
115
|
+
*/
|
|
116
|
+
record(call: OutgoingCall): void;
|
|
63
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Wrap a `fetch` implementation so its calls are recorded — the standalone,
|
|
120
|
+
* zero-boilerplate opt-in hook. With no `options`, it inherits the config the
|
|
121
|
+
* provider published via {@link HttpClientWatcher.start} (falling back to
|
|
122
|
+
* defaults when telescope's watcher isn't wired). Pass `options` to instrument
|
|
123
|
+
* with an isolated, explicitly-configured watcher.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* import { instrumentFetch } from '@adonis-agora/telescope/watchers'
|
|
127
|
+
* const trackedFetch = instrumentFetch(globalThis.fetch)
|
|
128
|
+
*/
|
|
129
|
+
export declare function instrumentFetch(fetchImpl?: FetchFn, options?: HttpClientWatcherOptions): FetchFn;
|
|
64
130
|
/** Map a captured outbound call to a telescope {@link RecordInput}. Exported so
|
|
65
|
-
* the entry shape can be unit-tested without
|
|
66
|
-
export declare function buildHttpClientEntry(call:
|
|
67
|
-
method: string;
|
|
68
|
-
url: string;
|
|
69
|
-
host: string | null;
|
|
70
|
-
statusCode: number | null;
|
|
71
|
-
durationMs: number;
|
|
72
|
-
}, slowMs?: number): RecordInput<HttpClientEntryContent>;
|
|
131
|
+
* the entry shape can be unit-tested without instrumenting a real client. */
|
|
132
|
+
export declare function buildHttpClientEntry(call: OutgoingCall, slowMs?: number): RecordInput<HttpClientEntryContent>;
|
|
73
133
|
export {};
|
|
74
134
|
//# sourceMappingURL=http_client_watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_client_watcher.d.ts","sourceRoot":"","sources":["../../../src/watchers/http_client_watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1D,
|
|
1
|
+
{"version":3,"file":"http_client_watcher.d.ts","sourceRoot":"","sources":["../../../src/watchers/http_client_watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1D,uEAAuE;AACvE,MAAM,WAAW,wBAAwB;IACvC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,KAAK,CAAC,EAAE;QAAE,GAAG,IAAI,MAAM,CAAA;KAAE,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,mDAAmD;AACnD,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAC;IACZ,uFAAuF;IACvF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,uEAAuE;IACvE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,yFAAyF;IACzF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0FAA0F;IAC1F,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qEAAqE;IACrE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;8DAC8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,M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,EAClB,MAAM,SAAkB,GACvB,WAAW,CAAC,sBAAsB,CAAC,CA6BrC"}
|
|
@@ -9,14 +9,24 @@ const DEFAULT_SLOW_MS = 1000;
|
|
|
9
9
|
* before it ever reaches the (separately redacted) entry content. */
|
|
10
10
|
const SENSITIVE_PARAM = /(token|secret|password|passwd|api[-_]?key|access[-_]?key|auth|credential)/i;
|
|
11
11
|
const REDACTED = '[REDACTED]';
|
|
12
|
-
/** Marks our wrapper so the global `fetch` is patched exactly once even if two
|
|
13
|
-
* copies of this package load. `Symbol.for` (the global registry) is deliberate:
|
|
14
|
-
* both copies resolve the same marker and neither double-wraps the other. */
|
|
15
|
-
const PATCHED = Symbol.for('@agora/telescope:httpClientPatched');
|
|
16
12
|
/** Marks an `init` (RequestInit) as telescope's OWN outbound call so the wrapper
|
|
17
13
|
* skips recording it — the recursion guard for any internal fetch (e.g. a
|
|
18
|
-
*
|
|
14
|
+
* remote store / alert webhook performing a `fetch` through an instrumented
|
|
15
|
+
* client). */
|
|
19
16
|
const INTERNAL = Symbol.for('@agora/telescope:internalFetch');
|
|
17
|
+
/** Cross-copy-stable slot holding the provider-configured default watcher, so a
|
|
18
|
+
* bare `instrumentFetch(fetch)` (no options) inherits the app's configured
|
|
19
|
+
* `slowMs` / `ignoreHosts` / `captureBodies`. A `Symbol.for` global slot (not a
|
|
20
|
+
* module local) keeps two copies of this package in agreement — the same stance
|
|
21
|
+
* the runtime registry uses. */
|
|
22
|
+
const DEFAULT_SLOT = Symbol.for('@agora/telescope:defaultHttpClientWatcher');
|
|
23
|
+
const slotHost = globalThis;
|
|
24
|
+
function setDefaultHttpClientWatcher(watcher) {
|
|
25
|
+
slotHost[DEFAULT_SLOT] = watcher;
|
|
26
|
+
}
|
|
27
|
+
function getDefaultHttpClientWatcher() {
|
|
28
|
+
return slotHost[DEFAULT_SLOT] ?? null;
|
|
29
|
+
}
|
|
20
30
|
/**
|
|
21
31
|
* Sanitize a raw URL for storage: strip userinfo (`user:pass@`) and mask
|
|
22
32
|
* sensitive query-param VALUES, returning `{ url, host }`. A relative/invalid
|
|
@@ -55,89 +65,182 @@ function describeRequest(input, init) {
|
|
|
55
65
|
const { url, host } = sanitizeUrl(rawUrl);
|
|
56
66
|
return { method: method.toUpperCase(), url, host };
|
|
57
67
|
}
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
68
|
+
/** Best-effort byte size of a fetch request body, without consuming a stream.
|
|
69
|
+
* Returns `null` for shapes whose size can't be read cheaply (ReadableStream,
|
|
70
|
+
* FormData, a `Request`'s stream body). Never throws. */
|
|
71
|
+
function requestByteLength(init) {
|
|
72
|
+
const value = init && 'body' in init ? init.body : undefined;
|
|
73
|
+
if (value === undefined || value === null)
|
|
74
|
+
return null;
|
|
75
|
+
try {
|
|
76
|
+
if (typeof value === 'string')
|
|
77
|
+
return Buffer.byteLength(value);
|
|
78
|
+
if (value instanceof URLSearchParams)
|
|
79
|
+
return Buffer.byteLength(value.toString());
|
|
80
|
+
if (value instanceof ArrayBuffer)
|
|
81
|
+
return value.byteLength;
|
|
82
|
+
if (ArrayBuffer.isView(value))
|
|
83
|
+
return value.byteLength;
|
|
84
|
+
const size = value.size;
|
|
85
|
+
if (typeof size === 'number')
|
|
86
|
+
return size; // Blob / File
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/** Response body size from the `content-length` header, or `null`. The header is
|
|
94
|
+
* read (not the stream), so the host's `response.json()`/`.text()` is untouched. */
|
|
95
|
+
function responseByteLength(response) {
|
|
96
|
+
const raw = response.headers?.get?.('content-length');
|
|
97
|
+
if (raw === null || raw === undefined)
|
|
98
|
+
return null;
|
|
99
|
+
const value = Number(raw);
|
|
100
|
+
return Number.isFinite(value) ? value : null;
|
|
101
|
+
}
|
|
102
|
+
/** Mark a `RequestInit` so an instrumented fetch skips recording the call it
|
|
103
|
+
* belongs to. Use for telescope's own outbound fetches (remote store, alert
|
|
104
|
+
* webhooks) so the watcher never records — or recurses on — itself. */
|
|
61
105
|
export function markInternalFetch(init) {
|
|
62
106
|
const next = (init ?? {});
|
|
63
107
|
next[INTERNAL] = true;
|
|
64
108
|
return next;
|
|
65
109
|
}
|
|
66
110
|
/**
|
|
67
|
-
* Records
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
111
|
+
* Records OUTBOUND HTTP calls as `http-client` telescope entries — **opt-in, with
|
|
112
|
+
* no global monkey-patching**. AdonisJS has no single built-in HTTP client, so
|
|
113
|
+
* this never replaces `globalThis.fetch`; instead you wrap a `fetch`
|
|
114
|
+
* implementation with {@link HttpClientWatcher.instrumentFetch} (or the
|
|
115
|
+
* standalone {@link instrumentFetch}) and hand the wrapper to your client, or
|
|
116
|
+
* record a non-`fetch` call yourself via {@link HttpClientWatcher.record}.
|
|
71
117
|
*
|
|
72
118
|
* The wrapper never alters the host's call: it awaits the real `fetch`, records
|
|
73
|
-
* fire-and-forget
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
119
|
+
* fire-and-forget through {@link safeRecord} (which honours the overload-shed
|
|
120
|
+
* `paused` flag and applies redaction/sampling on the store's write path), and
|
|
121
|
+
* always re-throws a network error. Calls to an `ignoreHosts` target, and
|
|
122
|
+
* telescope's own outbound fetches (marked via {@link markInternalFetch}), are
|
|
123
|
+
* skipped.
|
|
124
|
+
*
|
|
125
|
+
* Each entry carries `familyHash` (`METHOD host/normalized-path`) and
|
|
126
|
+
* `durationMs`, so it feeds the Pulse `slowOutgoing` hotspot card directly.
|
|
77
127
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
128
|
+
* Idiomatic Adonis: a plain class, no DI decorators. The provider constructs it
|
|
129
|
+
* from `config/telescope_watchers.ts` and calls {@link start} to publish it as
|
|
130
|
+
* the default backing a bare `instrumentFetch(fetch)`; {@link stop} unpublishes.
|
|
131
|
+
* Neither touches any global.
|
|
81
132
|
*/
|
|
82
133
|
export class HttpClientWatcher {
|
|
83
134
|
type = EntryType.HttpClient;
|
|
84
135
|
slowMs;
|
|
85
136
|
clock;
|
|
86
|
-
|
|
87
|
-
|
|
137
|
+
ignoreHosts;
|
|
138
|
+
captureBodies;
|
|
88
139
|
constructor(options = {}) {
|
|
89
140
|
this.slowMs = options.slowMs ?? DEFAULT_SLOW_MS;
|
|
90
141
|
this.clock = options.clock ?? { now: () => Date.now() };
|
|
142
|
+
this.ignoreHosts = new Set((options.ignoreHosts ?? []).map((host) => host.toLowerCase()));
|
|
143
|
+
this.captureBodies = options.captureBodies ?? false;
|
|
91
144
|
}
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
145
|
+
/** Publish this configured instance as the default that a bare
|
|
146
|
+
* {@link instrumentFetch} (called with no explicit options) inherits config
|
|
147
|
+
* from. Does NOT patch any global — instrumentation stays opt-in. Named
|
|
148
|
+
* `start`/`stop` to match the other watchers' provider lifecycle. */
|
|
94
149
|
start() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
150
|
+
setDefaultHttpClientWatcher(this);
|
|
151
|
+
}
|
|
152
|
+
/** Unpublish this instance as the default (if it is). Never touches globals. */
|
|
153
|
+
stop() {
|
|
154
|
+
if (getDefaultHttpClientWatcher() === this)
|
|
155
|
+
setDefaultHttpClientWatcher(null);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Wrap a `fetch` implementation so every call it makes is recorded as an
|
|
159
|
+
* `http-client` entry — WITHOUT mutating any global. The returned function has
|
|
160
|
+
* `fetch`'s signature; pass it to your HTTP client, or call it directly.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* const trackedFetch = new HttpClientWatcher().instrumentFetch(globalThis.fetch)
|
|
164
|
+
* await trackedFetch('https://api.stripe.com/v1/charges')
|
|
165
|
+
*/
|
|
166
|
+
instrumentFetch(fetchImpl = globalThis.fetch) {
|
|
167
|
+
if (typeof fetchImpl !== 'function') {
|
|
168
|
+
throw new TypeError('instrumentFetch: a fetch implementation is required.');
|
|
169
|
+
}
|
|
99
170
|
const watcher = this;
|
|
100
|
-
const
|
|
101
|
-
// Skip
|
|
102
|
-
// guard for any internal fetch.
|
|
171
|
+
const wrapped = async function instrumentedFetch(input, init) {
|
|
172
|
+
// Skip telescope's own outbound calls — the recursion guard.
|
|
103
173
|
if (init && init[INTERNAL]) {
|
|
104
|
-
return
|
|
174
|
+
return fetchImpl(input, init);
|
|
105
175
|
}
|
|
106
|
-
const startedAt = watcher.clock.now();
|
|
107
176
|
const { method, url, host } = describeRequest(input, init);
|
|
177
|
+
// An ignored host is passed straight through, unrecorded and un-timed.
|
|
178
|
+
if (host !== null && watcher.ignoreHosts.has(host.toLowerCase())) {
|
|
179
|
+
return fetchImpl(input, init);
|
|
180
|
+
}
|
|
181
|
+
const startedAt = watcher.clock.now();
|
|
182
|
+
const requestBytes = watcher.captureBodies ? requestByteLength(init) : null;
|
|
108
183
|
try {
|
|
109
|
-
const response = await
|
|
110
|
-
watcher.record(
|
|
184
|
+
const response = await fetchImpl(input, init);
|
|
185
|
+
watcher.record({
|
|
186
|
+
method,
|
|
187
|
+
url,
|
|
188
|
+
host,
|
|
189
|
+
statusCode: response.status,
|
|
190
|
+
durationMs: watcher.clock.now() - startedAt,
|
|
191
|
+
requestBytes,
|
|
192
|
+
responseBytes: watcher.captureBodies ? responseByteLength(response) : null,
|
|
193
|
+
error: null,
|
|
194
|
+
});
|
|
111
195
|
return response;
|
|
112
196
|
}
|
|
113
197
|
catch (error) {
|
|
114
|
-
watcher.record(
|
|
198
|
+
watcher.record({
|
|
199
|
+
method,
|
|
200
|
+
url,
|
|
201
|
+
host,
|
|
202
|
+
statusCode: null,
|
|
203
|
+
durationMs: watcher.clock.now() - startedAt,
|
|
204
|
+
requestBytes,
|
|
205
|
+
responseBytes: null,
|
|
206
|
+
error: error instanceof Error ? error.message : String(error),
|
|
207
|
+
});
|
|
115
208
|
throw error; // never swallow the host's network error
|
|
116
209
|
}
|
|
117
210
|
};
|
|
118
|
-
|
|
119
|
-
patched.__telescopeOriginal__ = original;
|
|
120
|
-
globalThis.fetch = patched;
|
|
121
|
-
this.installed = true;
|
|
211
|
+
return wrapped;
|
|
122
212
|
}
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
|
|
213
|
+
/**
|
|
214
|
+
* Record one already-completed outbound call — the small helper for HTTP
|
|
215
|
+
* clients that are NOT `fetch`-based (axios, got, an undici stream). Compute
|
|
216
|
+
* the fields at your call site and hand them here; recording is fire-and-forget
|
|
217
|
+
* and never throws. Honours `ignoreHosts` and the overload-shed flag.
|
|
218
|
+
*/
|
|
219
|
+
record(call) {
|
|
220
|
+
if (call.host !== null && this.ignoreHosts.has(call.host.toLowerCase()))
|
|
127
221
|
return;
|
|
128
|
-
this.
|
|
129
|
-
const current = globalThis.fetch;
|
|
130
|
-
if (current?.[PATCHED] && current.__telescopeOriginal__) {
|
|
131
|
-
globalThis.fetch = current.__telescopeOriginal__;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/** Build + record an entry, swallowing every failure via {@link safeRecord}. */
|
|
135
|
-
record(method, url, host, statusCode, durationMs) {
|
|
136
|
-
safeRecord(buildHttpClientEntry({ method, url, host, statusCode, durationMs }, this.slowMs), 'HttpClientWatcher');
|
|
222
|
+
safeRecord(buildHttpClientEntry(call, this.slowMs), 'HttpClientWatcher');
|
|
137
223
|
}
|
|
138
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Wrap a `fetch` implementation so its calls are recorded — the standalone,
|
|
227
|
+
* zero-boilerplate opt-in hook. With no `options`, it inherits the config the
|
|
228
|
+
* provider published via {@link HttpClientWatcher.start} (falling back to
|
|
229
|
+
* defaults when telescope's watcher isn't wired). Pass `options` to instrument
|
|
230
|
+
* with an isolated, explicitly-configured watcher.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* import { instrumentFetch } from '@adonis-agora/telescope/watchers'
|
|
234
|
+
* const trackedFetch = instrumentFetch(globalThis.fetch)
|
|
235
|
+
*/
|
|
236
|
+
export function instrumentFetch(fetchImpl = globalThis.fetch, options) {
|
|
237
|
+
const watcher = options
|
|
238
|
+
? new HttpClientWatcher(options)
|
|
239
|
+
: (getDefaultHttpClientWatcher() ?? new HttpClientWatcher());
|
|
240
|
+
return watcher.instrumentFetch(fetchImpl);
|
|
241
|
+
}
|
|
139
242
|
/** Map a captured outbound call to a telescope {@link RecordInput}. Exported so
|
|
140
|
-
* the entry shape can be unit-tested without
|
|
243
|
+
* the entry shape can be unit-tested without instrumenting a real client. */
|
|
141
244
|
export function buildHttpClientEntry(call, slowMs = DEFAULT_SLOW_MS) {
|
|
142
245
|
const traceId = currentTraceId();
|
|
143
246
|
const content = {
|
|
@@ -147,6 +250,9 @@ export function buildHttpClientEntry(call, slowMs = DEFAULT_SLOW_MS) {
|
|
|
147
250
|
statusCode: call.statusCode,
|
|
148
251
|
durationMs: Math.max(0, call.durationMs),
|
|
149
252
|
traceId,
|
|
253
|
+
requestBytes: call.requestBytes ?? null,
|
|
254
|
+
responseBytes: call.responseBytes ?? null,
|
|
255
|
+
error: call.error ?? null,
|
|
150
256
|
};
|
|
151
257
|
const tags = ['http-client'];
|
|
152
258
|
if (content.host)
|
|
@@ -158,6 +264,8 @@ export function buildHttpClientEntry(call, slowMs = DEFAULT_SLOW_MS) {
|
|
|
158
264
|
tags.push('slow');
|
|
159
265
|
return {
|
|
160
266
|
type: EntryType.HttpClient,
|
|
267
|
+
// Group by method + host + normalized path so the same external endpoint
|
|
268
|
+
// aggregates regardless of ids — the Pulse slow-outgoing hotspot key.
|
|
161
269
|
familyHash: normalizeHttpTarget(content.method, content.url),
|
|
162
270
|
content,
|
|
163
271
|
durationMs: content.durationMs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_client_watcher.js","sourceRoot":"","sources":["../../../src/watchers/http_client_watcher.ts"],"names":[],"mappings":"AAAA,OAA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AAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;QACxC,OAAO;QACP,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI;QACvC,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;QACzC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;KAC1B,CAAC;IACF,MAAM,IAAI,GAAa,CAAC,aAAa,CAAC,CAAC;IACvC,IAAI,OAAO,CAAC,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,+FAA+F;IAC/F,IAAI,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,UAAU,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClF,IAAI,OAAO,CAAC,UAAU,IAAI,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpD,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,UAAU;QAC1B,yEAAyE;QACzE,sEAAsE;QACtE,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC;QAC5D,OAAO;QACP,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO;QACP,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.5.0";
|
|
3
3
|
export type { EmitterLike, Watcher } from './emitter.js';
|
|
4
4
|
export { resolveStore, safeRecord } from './record.js';
|
|
5
5
|
export { buildQueryEntry, DB_QUERY_EVENT, LucidQueryWatcher } from './lucid_query_watcher.js';
|
|
6
|
-
export type { DbQueryEventLike, QueryEntryContent } from './lucid_query_watcher.js';
|
|
6
|
+
export type { DbQueryEventLike, LucidQueryWatcherOptions, QueryEntryContent, } from './lucid_query_watcher.js';
|
|
7
7
|
export { queryFamilyHash } from './query_family_hash.js';
|
|
8
8
|
export { buildMailEntry, MAIL_SENT_EVENT, MailWatcher } from './mail_watcher.js';
|
|
9
9
|
export type { MailEntryContent, MailSentEventLike } from './mail_watcher.js';
|
|
10
10
|
export { buildCacheEntry, CACHE_EVENTS, CacheWatcher } from './cache_watcher.js';
|
|
11
11
|
export type { CacheEntryContent, CacheEventLike, CacheOperation } from './cache_watcher.js';
|
|
12
|
-
export { buildHttpClientEntry, HttpClientWatcher, markInternalFetch, } from './http_client_watcher.js';
|
|
13
|
-
export type { HttpClientEntryContent, HttpClientWatcherOptions, } from './http_client_watcher.js';
|
|
12
|
+
export { buildHttpClientEntry, HttpClientWatcher, instrumentFetch, markInternalFetch, } from './http_client_watcher.js';
|
|
13
|
+
export type { HttpClientEntryContent, HttpClientWatcherOptions, OutgoingCall, } from './http_client_watcher.js';
|
|
14
14
|
export { normalizeHttpTarget } from './normalize_http_target.js';
|
|
15
15
|
export { buildLogEntry, extractLog, LOG_LEVELS, LogsWatcher } from './logs_watcher.js';
|
|
16
16
|
export type { LogEntryContent, LoggerLike, LogLevel, LogsWatcherOptions, } from './logs_watcher.js';
|
|
@@ -20,6 +20,10 @@ export { buildEventEntry, DEFAULT_IGNORED_EVENTS, EventsWatcher, hasOnAny, } fro
|
|
|
20
20
|
export type { EmitterAnyLike, EventEntryContent } from './events_watcher.js';
|
|
21
21
|
export { buildRedisEntry, RedisWatcher } from './redis_watcher.js';
|
|
22
22
|
export type { RedisClientLike, RedisCommandLike, RedisConnectionLike, RedisEntryContent, RedisManagerLike, } from './redis_watcher.js';
|
|
23
|
+
export { buildProfileEntry, PROFILE_ENTRY_TYPE, profile, ProfilingWatcher, startProfile, } from './profiling_watcher.js';
|
|
24
|
+
export type { CompletedProfile, ProfileEntryContent, ProfileMark, ProfileSession, ProfileStatus, ProfilingWatcherOptions, } from './profiling_watcher.js';
|
|
25
|
+
export { buildScheduleEntry, recordScheduledRun, SCHEDULED_TASK_ENTRY_TYPE, ScheduleWatcher, scheduleTask, } from './schedule_watcher.js';
|
|
26
|
+
export type { ScheduleEntryContent, ScheduledRun, ScheduledTaskOptions, ScheduleKind, ScheduleRunStatus, ScheduleWatcherOptions, } from './schedule_watcher.js';
|
|
23
27
|
export { DEFAULT_WATCHERS, defineConfig, resolveConfig, } from './define_config.js';
|
|
24
|
-
export type { ResolvedTelescopeWatchersConfig, TelescopeWatchersConfig, WatcherName, } from './define_config.js';
|
|
28
|
+
export type { HttpClientWatcherConfig, ProfilingWatcherConfig, QueryWatcherConfig, ResolvedHttpClientWatcherConfig, ResolvedProfilingWatcherConfig, ResolvedQueryWatcherConfig, ResolvedScheduleWatcherConfig, ResolvedTelescopeWatchersConfig, ScheduleWatcherConfig, TelescopeWatchersConfig, WatcherName, } from './define_config.js';
|
|
25
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/watchers/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/watchers/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,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AM,qBAAqB,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,aAAa,EACb,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,0BAA0B,EAC1B,6BAA6B,EAC7B,+BAA+B,EAC/B,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.5.0';
|
|
3
3
|
// — runtime recording (advanced) —
|
|
4
4
|
export { resolveStore, safeRecord } from './record.js';
|
|
5
5
|
// — Lucid query watcher (the headline watcher) —
|
|
@@ -10,7 +10,7 @@ export { buildMailEntry, MAIL_SENT_EVENT, MailWatcher } from './mail_watcher.js'
|
|
|
10
10
|
// — cache watcher —
|
|
11
11
|
export { buildCacheEntry, CACHE_EVENTS, CacheWatcher } from './cache_watcher.js';
|
|
12
12
|
// — http-client (outbound) watcher —
|
|
13
|
-
export { buildHttpClientEntry, HttpClientWatcher, markInternalFetch, } from './http_client_watcher.js';
|
|
13
|
+
export { buildHttpClientEntry, HttpClientWatcher, instrumentFetch, markInternalFetch, } from './http_client_watcher.js';
|
|
14
14
|
export { normalizeHttpTarget } from './normalize_http_target.js';
|
|
15
15
|
// — logs watcher —
|
|
16
16
|
export { buildLogEntry, extractLog, LOG_LEVELS, LogsWatcher } from './logs_watcher.js';
|
|
@@ -20,6 +20,10 @@ export { buildJobEntry, QUEUE_EXECUTE_CHANNEL, QueueWatcher } from './queue_watc
|
|
|
20
20
|
export { buildEventEntry, DEFAULT_IGNORED_EVENTS, EventsWatcher, hasOnAny, } from './events_watcher.js';
|
|
21
21
|
// — redis watcher (optional peer: @adonisjs/redis) —
|
|
22
22
|
export { buildRedisEntry, RedisWatcher } from './redis_watcher.js';
|
|
23
|
+
// — profiling watcher (user-driven timing spans; opt-in helpers) —
|
|
24
|
+
export { buildProfileEntry, PROFILE_ENTRY_TYPE, profile, ProfilingWatcher, startProfile, } from './profiling_watcher.js';
|
|
25
|
+
// — schedule watcher (scheduled-task runs; explicit wrapper integration) —
|
|
26
|
+
export { buildScheduleEntry, recordScheduledRun, SCHEDULED_TASK_ENTRY_TYPE, ScheduleWatcher, scheduleTask, } from './schedule_watcher.js';
|
|
23
27
|
// — config —
|
|
24
28
|
export { DEFAULT_WATCHERS, defineConfig, resolveConfig, } from './define_config.js';
|
|
25
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/watchers/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAK/B,mCAAmC;AACnC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,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B,EAClB,OAAO,EACP,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAUhC,2EAA2E;AAC3E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,YAAY,GACb,MAAM,uBAAuB,CAAC;AAU/B,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,6 +2,18 @@ import { type RecordInput } from '../entry.js';
|
|
|
2
2
|
import type { EmitterLike, Watcher } from './emitter.js';
|
|
3
3
|
/** The Lucid event name this watcher subscribes to. */
|
|
4
4
|
export declare const DB_QUERY_EVENT = "db:query";
|
|
5
|
+
/** Construction-time tuning for {@link LucidQueryWatcher} — the resolved slice of
|
|
6
|
+
* `config/telescope_watchers.ts`'s `query` block the watcher acts on. */
|
|
7
|
+
export interface LucidQueryWatcherOptions {
|
|
8
|
+
/** Queries at/above this many ms get a `slow` tag. Default 500. */
|
|
9
|
+
slowMs?: number;
|
|
10
|
+
/** Keep the raw bound VALUES instead of redacting them. Default `false`. */
|
|
11
|
+
captureBindings?: boolean;
|
|
12
|
+
/** Connection names (case-insensitive) whose queries are not recorded. */
|
|
13
|
+
ignoreConnections?: string[];
|
|
14
|
+
/** Normalize SQL into the `familyHash` grouping key. Default `true`. */
|
|
15
|
+
normalize?: boolean;
|
|
16
|
+
}
|
|
5
17
|
/**
|
|
6
18
|
* The shape of the data `@adonisjs/lucid` emits on `db:query`. Mirrored
|
|
7
19
|
* structurally from `@adonisjs/lucid`'s `DbQueryEventNode` (verified against the
|
|
@@ -54,11 +66,17 @@ export interface QueryEntryContent {
|
|
|
54
66
|
export declare class LucidQueryWatcher implements Watcher {
|
|
55
67
|
readonly type: "query";
|
|
56
68
|
private unsubscribe;
|
|
69
|
+
private readonly slowMs;
|
|
70
|
+
private readonly captureBindings;
|
|
71
|
+
private readonly ignoreConnections;
|
|
72
|
+
private readonly normalize;
|
|
73
|
+
constructor(options?: LucidQueryWatcherOptions);
|
|
57
74
|
start(emitter: EmitterLike): void;
|
|
58
75
|
stop(): void;
|
|
59
76
|
/** Validate + record a single `db:query` payload, never throwing. */
|
|
60
77
|
private handle;
|
|
61
78
|
}
|
|
62
|
-
/** Map a Lucid `db:query` payload to a telescope {@link RecordInput}.
|
|
63
|
-
|
|
79
|
+
/** Map a Lucid `db:query` payload to a telescope {@link RecordInput}. Exported so
|
|
80
|
+
* the entry shape can be unit-tested without a running emitter. */
|
|
81
|
+
export declare function buildQueryEntry(event: DbQueryEventLike, options?: LucidQueryWatcherOptions): RecordInput<QueryEntryContent>;
|
|
64
82
|
//# sourceMappingURL=lucid_query_watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucid_query_watcher.d.ts","sourceRoot":"","sources":["../../../src/watchers/lucid_query_watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIzD,uDAAuD;AACvD,eAAO,MAAM,cAAc,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"lucid_query_watcher.d.ts","sourceRoot":"","sources":["../../../src/watchers/lucid_query_watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIzD,uDAAuD;AACvD,eAAO,MAAM,cAAc,aAAa,CAAC;AAQzC;0EAC0E;AAC1E,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,wEAAwE;IAC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