@tracepanel/js 0.3.4 → 0.4.1
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 +50 -4
- package/dist/agent.d.ts +23 -1
- package/dist/agent.js +72 -22
- package/dist/agent.js.map +1 -1
- package/dist/body.d.ts +32 -0
- package/dist/body.js +314 -0
- package/dist/body.js.map +1 -0
- package/dist/bullmq.d.ts +76 -1
- package/dist/bullmq.js +215 -6
- package/dist/bullmq.js.map +1 -1
- package/dist/bun.js +81 -11
- package/dist/bun.js.map +1 -1
- package/dist/config.d.ts +20 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/console.d.ts +5 -0
- package/dist/console.js +16 -0
- package/dist/console.js.map +1 -1
- package/dist/express.js +94 -23
- package/dist/express.js.map +1 -1
- package/dist/headers.js +54 -8
- package/dist/headers.js.map +1 -1
- package/dist/inspector.d.ts +9 -0
- package/dist/inspector.js +47 -0
- package/dist/inspector.js.map +1 -0
- package/dist/locals.d.ts +51 -0
- package/dist/locals.js +269 -0
- package/dist/locals.js.map +1 -0
- package/dist/loggers.d.ts +50 -0
- package/dist/loggers.js +201 -0
- package/dist/loggers.js.map +1 -0
- package/dist/model.d.ts +23 -2
- package/dist/model.js.map +1 -1
- package/dist/next.js +6 -0
- package/dist/next.js.map +1 -1
- package/dist/nuxt-plugin.d.ts +1 -0
- package/dist/nuxt-plugin.js +6 -0
- package/dist/nuxt-plugin.js.map +1 -1
- package/dist/processor.d.ts +23 -2
- package/dist/processor.js +61 -14
- package/dist/processor.js.map +1 -1
- package/dist/profile.d.ts +63 -0
- package/dist/profile.js +300 -0
- package/dist/profile.js.map +1 -0
- package/dist/request.d.ts +61 -0
- package/dist/request.js +244 -0
- package/dist/request.js.map +1 -0
- package/dist/session.d.ts +10 -0
- package/dist/session.js +45 -0
- package/dist/session.js.map +1 -0
- package/dist/setup.js +10 -1
- package/dist/setup.js.map +1 -1
- package/dist/stack.d.ts +27 -3
- package/dist/stack.js +106 -9
- package/dist/stack.js.map +1 -1
- package/dist/widget.d.ts +24 -0
- package/dist/widget.js +62 -1
- package/dist/widget.js.map +1 -1
- package/package.json +16 -4
package/dist/body.js
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// A request's body as the app reads it, for the frameworks that read it from the stream themselves (Next.js, Nuxt,
|
|
2
|
+
// Bun.serve and the handlers under `withTracepanel()`): a tap sees each piece on its way to the app and keeps a copy
|
|
3
|
+
// of the start, up to the most a trace keeps. It never reads the stream itself: a body the app doesn't read is not
|
|
4
|
+
// recorded, and nothing waits for it. The app gets every byte as it came, at the pace it reads them, so an upload
|
|
5
|
+
// still streams; the tap never holds more than MAX_BODY bytes of it.
|
|
6
|
+
//
|
|
7
|
+
// A multipart form is read as it passes: its fields' values (up to MAX_BODY in all), and its files by name and size,
|
|
8
|
+
// counted, never kept. JSON or a URL-encoded form past MAX_BODY isn't recorded: its secrets can't be masked from a
|
|
9
|
+
// part of it. Text past it is cut.
|
|
10
|
+
import { cut, formText, headerValue, kindOf, MAX_BODY, readBody } from "./request.js";
|
|
11
|
+
const TAP = Symbol.for("tracepanel.body");
|
|
12
|
+
/** How long a part's headers may be before a form isn't read as one. */
|
|
13
|
+
const MAX_PART_HEADERS = 16_384;
|
|
14
|
+
const HEADERS_END = Buffer.from("\r\n\r\n");
|
|
15
|
+
/** A multipart form's fields and files, read from its pieces as they pass, the files' contents counted, not kept. */
|
|
16
|
+
class Multipart {
|
|
17
|
+
fields = [];
|
|
18
|
+
files = [];
|
|
19
|
+
/** Some of the form was left out: past MAX_BODY. */
|
|
20
|
+
overflow = false;
|
|
21
|
+
done = false;
|
|
22
|
+
broken = false;
|
|
23
|
+
delimiter;
|
|
24
|
+
// The first boundary comes without the line break before it: one goes in front, so every boundary looks alike.
|
|
25
|
+
pending = Buffer.from("\r\n");
|
|
26
|
+
state = "body";
|
|
27
|
+
part;
|
|
28
|
+
budget = MAX_BODY + 1;
|
|
29
|
+
constructor(boundary) {
|
|
30
|
+
this.delimiter = Buffer.from(`\r\n--${boundary}`);
|
|
31
|
+
}
|
|
32
|
+
feed(chunk) {
|
|
33
|
+
if (this.done || this.broken)
|
|
34
|
+
return;
|
|
35
|
+
this.pending = this.pending.length > 0 ? Buffer.concat([this.pending, chunk]) : chunk;
|
|
36
|
+
for (;;) {
|
|
37
|
+
if (this.state === "body") {
|
|
38
|
+
const at = this.pending.indexOf(this.delimiter);
|
|
39
|
+
if (at < 0) {
|
|
40
|
+
// All but what could be the start of a boundary is the part's.
|
|
41
|
+
const safe = Math.max(0, this.pending.length - this.delimiter.length + 1);
|
|
42
|
+
this.take(this.pending.subarray(0, safe));
|
|
43
|
+
this.pending = this.pending.subarray(safe);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.take(this.pending.subarray(0, at));
|
|
47
|
+
this.close();
|
|
48
|
+
this.pending = this.pending.subarray(at + this.delimiter.length);
|
|
49
|
+
this.state = "after";
|
|
50
|
+
}
|
|
51
|
+
if (this.state === "after") {
|
|
52
|
+
if (this.pending.length < 2)
|
|
53
|
+
return;
|
|
54
|
+
if (this.pending[0] === 0x2d && this.pending[1] === 0x2d) {
|
|
55
|
+
this.done = true;
|
|
56
|
+
this.pending = Buffer.alloc(0);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.state = "headers";
|
|
60
|
+
}
|
|
61
|
+
const end = this.pending.indexOf(HEADERS_END);
|
|
62
|
+
if (end < 0) {
|
|
63
|
+
if (this.pending.length > MAX_PART_HEADERS)
|
|
64
|
+
this.broken = true;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.open(this.pending.subarray(0, end).toString("utf8"));
|
|
68
|
+
this.pending = this.pending.subarray(end + HEADERS_END.length);
|
|
69
|
+
this.state = "body";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The part's headers, the rest of the boundary's line before them. */
|
|
73
|
+
open(block) {
|
|
74
|
+
const disposition = block
|
|
75
|
+
.split("\r\n")
|
|
76
|
+
.slice(1)
|
|
77
|
+
.find((line) => line.toLowerCase().startsWith("content-disposition:"));
|
|
78
|
+
const params = parameters(disposition?.slice(disposition.indexOf(":") + 1) ?? "");
|
|
79
|
+
const { name, filename } = params;
|
|
80
|
+
this.part = undefined;
|
|
81
|
+
if (name === undefined)
|
|
82
|
+
return;
|
|
83
|
+
// Its names count toward what the form keeps, as its values do.
|
|
84
|
+
const cost = name.length + (filename?.length ?? 0);
|
|
85
|
+
if (cost > this.budget) {
|
|
86
|
+
this.overflow = true;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.budget -= cost;
|
|
90
|
+
this.part = { name, filename, size: 0, value: [] };
|
|
91
|
+
}
|
|
92
|
+
take(bytes) {
|
|
93
|
+
const part = this.part;
|
|
94
|
+
if (!part || bytes.length === 0)
|
|
95
|
+
return;
|
|
96
|
+
part.size += bytes.length;
|
|
97
|
+
if (part.filename !== undefined)
|
|
98
|
+
return;
|
|
99
|
+
const kept = bytes.subarray(0, Math.max(0, this.budget));
|
|
100
|
+
if (kept.length < bytes.length)
|
|
101
|
+
this.overflow = true;
|
|
102
|
+
// A copy: the piece is the app's, and it may reuse its memory.
|
|
103
|
+
if (kept.length > 0)
|
|
104
|
+
part.value.push(Buffer.from(kept));
|
|
105
|
+
this.budget -= kept.length;
|
|
106
|
+
}
|
|
107
|
+
close() {
|
|
108
|
+
const part = this.part;
|
|
109
|
+
this.part = undefined;
|
|
110
|
+
if (!part)
|
|
111
|
+
return;
|
|
112
|
+
if (part.filename !== undefined)
|
|
113
|
+
this.files.push([part.name, part.filename, part.size]);
|
|
114
|
+
else
|
|
115
|
+
this.fields.push([part.name, Buffer.concat(part.value).toString("utf8")]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** A header's parameters (`form-data; name="a"; filename="b.png"`), `filename*` decoded and preferred. */
|
|
119
|
+
function parameters(header) {
|
|
120
|
+
const found = {};
|
|
121
|
+
for (const match of header.matchAll(/;\s*([^=;\s]+)\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^;]*))/g)) {
|
|
122
|
+
const name = (match[1] ?? "").toLowerCase();
|
|
123
|
+
const value = match[2] !== undefined ? match[2].replace(/\\(.)/g, "$1") : (match[3] ?? "").trim();
|
|
124
|
+
if (name === "filename*") {
|
|
125
|
+
const encoded = value.replace(/^[^']*'[^']*'/, "");
|
|
126
|
+
try {
|
|
127
|
+
found.filename = decodeURIComponent(encoded);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
found.filename = encoded;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (!(name in found))
|
|
134
|
+
found[name] = value;
|
|
135
|
+
}
|
|
136
|
+
return found;
|
|
137
|
+
}
|
|
138
|
+
/** The boundary a multipart form's Content-Type names. */
|
|
139
|
+
function boundaryOf(contentType) {
|
|
140
|
+
const match = /;\s*boundary=(?:"([^"]+)"|([^;\s]+))/i.exec(contentType);
|
|
141
|
+
return match?.[1] ?? match?.[2];
|
|
142
|
+
}
|
|
143
|
+
/** What the app read of a request's body, kept as it passed: its start, its size, and whether it read it all. */
|
|
144
|
+
export class BodyTap {
|
|
145
|
+
contentType;
|
|
146
|
+
kept = [];
|
|
147
|
+
size = 0;
|
|
148
|
+
ended = false;
|
|
149
|
+
form;
|
|
150
|
+
constructor(contentType) {
|
|
151
|
+
this.contentType = contentType;
|
|
152
|
+
const boundary = kindOf(contentType) === "multipart/form-data" ? boundaryOf(contentType) : undefined;
|
|
153
|
+
this.form = boundary ? new Multipart(boundary) : undefined;
|
|
154
|
+
}
|
|
155
|
+
/** A piece of the body on its way to the app. */
|
|
156
|
+
feed(chunk) {
|
|
157
|
+
// Read again after it ended (Next.js hands a middleware's copy of the body to the route): counted once.
|
|
158
|
+
if (this.ended)
|
|
159
|
+
return;
|
|
160
|
+
const piece = toBuffer(chunk);
|
|
161
|
+
if (!piece || piece.length === 0)
|
|
162
|
+
return;
|
|
163
|
+
if (this.form)
|
|
164
|
+
this.form.feed(piece);
|
|
165
|
+
// Kept up to the limit, and a byte past it to know it was cut; never the rest of an upload.
|
|
166
|
+
else if (this.size <= MAX_BODY)
|
|
167
|
+
this.kept.push(Buffer.from(piece.subarray(0, MAX_BODY + 1 - this.size)));
|
|
168
|
+
this.size += piece.length;
|
|
169
|
+
}
|
|
170
|
+
/** The app read the body to its end. */
|
|
171
|
+
end() {
|
|
172
|
+
this.ended = true;
|
|
173
|
+
}
|
|
174
|
+
/** http.request.body, as far as the app read it. */
|
|
175
|
+
attrs() {
|
|
176
|
+
if (this.form) {
|
|
177
|
+
if (!this.form.done)
|
|
178
|
+
return {};
|
|
179
|
+
const text = formText(this.form.fields, this.form.files);
|
|
180
|
+
if (!text)
|
|
181
|
+
return {};
|
|
182
|
+
return this.form.overflow ? { ...cut(text), "http.request.body.truncated": true } : cut(text);
|
|
183
|
+
}
|
|
184
|
+
const data = Buffer.concat(this.kept);
|
|
185
|
+
const found = readBody(this.contentType, data, this.ended && this.size <= MAX_BODY);
|
|
186
|
+
// Its characters more than one byte each, the body was cut before MAX_BODY characters.
|
|
187
|
+
if ("http.request.body" in found && this.size > data.length)
|
|
188
|
+
found["http.request.body.truncated"] = true;
|
|
189
|
+
return found;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function toBuffer(chunk) {
|
|
193
|
+
if (Buffer.isBuffer(chunk))
|
|
194
|
+
return chunk;
|
|
195
|
+
if (chunk instanceof Uint8Array)
|
|
196
|
+
return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
197
|
+
if (typeof chunk === "string")
|
|
198
|
+
return Buffer.from(chunk);
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A Node request whose body pieces pass the tap on their way to the app: every reader of a stream (a `data`
|
|
203
|
+
* listener, `read()`, async iteration, `pipe()`) gets them through its `emit("data")`. The tap is the request's from
|
|
204
|
+
* then on (`tapOf`). A framework that puts another stream's `emit` on the request (Next.js does, for a body a
|
|
205
|
+
* middleware read too) gets it tapped as well.
|
|
206
|
+
*/
|
|
207
|
+
export function tapIncoming(req) {
|
|
208
|
+
const tap = new BodyTap(headerValue(req.headers["content-type"]) ?? "");
|
|
209
|
+
let emit = req.emit;
|
|
210
|
+
const tapped = function (event, ...args) {
|
|
211
|
+
try {
|
|
212
|
+
if (event === "data")
|
|
213
|
+
tap.feed(args[0]);
|
|
214
|
+
else if (event === "end")
|
|
215
|
+
tap.end();
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
// The app's body goes on whatever the tap makes of it.
|
|
219
|
+
}
|
|
220
|
+
return emit.call(this, event, ...args);
|
|
221
|
+
};
|
|
222
|
+
Object.defineProperty(req, "emit", {
|
|
223
|
+
configurable: true,
|
|
224
|
+
get: () => tapped,
|
|
225
|
+
set: (value) => {
|
|
226
|
+
emit = value;
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
req[TAP] = tap;
|
|
230
|
+
return tap;
|
|
231
|
+
}
|
|
232
|
+
/** The tap on a Node request's body, if it has one. */
|
|
233
|
+
export function tapOf(req) {
|
|
234
|
+
return req?.[TAP];
|
|
235
|
+
}
|
|
236
|
+
const READERS = ["arrayBuffer", "blob", "bytes", "formData", "json", "text"];
|
|
237
|
+
/** The getter a property has on an object's prototypes: the Request's own `body`, under the tap's. */
|
|
238
|
+
function inherited(target, name) {
|
|
239
|
+
for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) {
|
|
240
|
+
const found = Object.getOwnPropertyDescriptor(proto, name);
|
|
241
|
+
if (found)
|
|
242
|
+
return found.get;
|
|
243
|
+
}
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A fetch Request whose body passes the tap on its way to the handler: `request.body` and its readers (`text()`,
|
|
248
|
+
* `json()`, `formData()`, ...) read through it, piece by piece as the handler pulls them. The request stays the one
|
|
249
|
+
* the server made (Bun's `params` and `cookies` with it); `clone()` is its own, untapped.
|
|
250
|
+
*/
|
|
251
|
+
export function tapRequest(request) {
|
|
252
|
+
// Tapped already, by a withTracepanel() around this one: the same tap.
|
|
253
|
+
const before = request[TAP];
|
|
254
|
+
if (before)
|
|
255
|
+
return before;
|
|
256
|
+
const original = inherited(request, "body");
|
|
257
|
+
// A request without a body (a GET) keeps its null; a fetch Request's headers have no Content-Length to tell.
|
|
258
|
+
if (!original || original.call(request) === null)
|
|
259
|
+
return undefined;
|
|
260
|
+
const tap = new BodyTap(request.headers.get("content-type") ?? "");
|
|
261
|
+
let through;
|
|
262
|
+
const body = () => {
|
|
263
|
+
if (through)
|
|
264
|
+
return through;
|
|
265
|
+
let reader;
|
|
266
|
+
// The request's own stream, taken at the first read: until then it is the app's to clone.
|
|
267
|
+
const source = () => {
|
|
268
|
+
if (reader)
|
|
269
|
+
return reader;
|
|
270
|
+
const stream = original.call(request);
|
|
271
|
+
reader = stream?.getReader();
|
|
272
|
+
return reader;
|
|
273
|
+
};
|
|
274
|
+
through = new ReadableStream({
|
|
275
|
+
async pull(controller) {
|
|
276
|
+
const from = source();
|
|
277
|
+
const { done, value } = from ? await from.read() : { done: true, value: undefined };
|
|
278
|
+
if (done || !value) {
|
|
279
|
+
tap.end();
|
|
280
|
+
controller.close();
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
tap.feed(value);
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
// The handler's body goes on whatever the tap makes of it.
|
|
288
|
+
}
|
|
289
|
+
controller.enqueue(value);
|
|
290
|
+
},
|
|
291
|
+
async cancel(reason) {
|
|
292
|
+
await source()?.cancel(reason);
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
// Nothing read ahead of the handler: a piece is taken when it asks for one.
|
|
296
|
+
{ highWaterMark: 0 });
|
|
297
|
+
return through;
|
|
298
|
+
};
|
|
299
|
+
request[TAP] = tap;
|
|
300
|
+
const headers = { "content-type": request.headers.get("content-type") ?? "" };
|
|
301
|
+
Object.defineProperty(request, "body", { configurable: true, get: body });
|
|
302
|
+
for (const name of READERS) {
|
|
303
|
+
if (typeof request[name] !== "function")
|
|
304
|
+
continue;
|
|
305
|
+
Object.defineProperty(request, name, {
|
|
306
|
+
configurable: true,
|
|
307
|
+
writable: true,
|
|
308
|
+
// A promise either way, as the request's own: a body already read rejects it.
|
|
309
|
+
value: async () => new Response(body(), { headers })[name]?.(),
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return tap;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=body.js.map
|
package/dist/body.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../src/body.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,qHAAqH;AACrH,mHAAmH;AACnH,kHAAkH;AAClH,qEAAqE;AACrE,EAAE;AACF,qHAAqH;AACrH,mHAAmH;AACnH,mCAAmC;AAInC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEtF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAC1C,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAE5C,qHAAqH;AACrH,MAAM,SAAS;IACJ,MAAM,GAAuB,EAAE,CAAC;IAChC,KAAK,GAA+B,EAAE,CAAC;IAChD,oDAAoD;IACpD,QAAQ,GAAG,KAAK,CAAC;IACjB,IAAI,GAAG,KAAK,CAAC;IACL,MAAM,GAAG,KAAK,CAAC;IACN,SAAS,CAAS;IACnC,+GAA+G;IACvG,OAAO,GAAW,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,KAAK,GAAiC,MAAM,CA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C,CAAC;YAC5B,CAAC;YACD,KAAK,CAAC,MAAM,CAAC,MAAM;gBACjB,MAAM,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC;SACF;QACD,4EAA4E;QAC5E,EAAE,aAAa,EAAE,CAAC,EAAE,CACrB,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IACD,OAAyC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACtD,MAAM,OAAO,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC;IAC9E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1E,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,OAAQ,OAA8C,CAAC,IAAI,CAAC,KAAK,UAAU;YAAE,SAAS;QAC1F,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE;YACnC,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,8EAA8E;YAC9E,KAAK,EAAE,KAAK,IAAI,EAAE,CACf,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,CAAuD,CAAC,IAAI,CAAC,EAAE,EAAE;SACrG,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/bullmq.d.ts
CHANGED
|
@@ -1,7 +1,82 @@
|
|
|
1
1
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from "@opentelemetry/instrumentation";
|
|
2
|
+
import { type TaskEvent } from "./agent.js";
|
|
3
|
+
interface Job {
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
queueName: string;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
delay?: number;
|
|
10
|
+
attemptsMade: number;
|
|
11
|
+
opts?: {
|
|
12
|
+
attempts?: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface Worker {
|
|
16
|
+
opts?: {
|
|
17
|
+
name?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Where task events go: the process's Tracepanel (its processor), which knows the active trace too. */
|
|
21
|
+
export interface Events {
|
|
22
|
+
taskEvent(event: TaskEvent): void;
|
|
23
|
+
current(): {
|
|
24
|
+
building: {
|
|
25
|
+
trace: {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
spanId: string | null;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** How often a worker says it is alive, with the jobs it runs: the agent drops a running one after 2 minutes. */
|
|
33
|
+
export declare const HEARTBEAT_MS = 30000;
|
|
34
|
+
/** What becomes of a job whose run threw: run again, failed, or moved on by the job itself. */
|
|
35
|
+
export declare function outcome(job: Job, error: unknown): "retry" | "failure" | "moved";
|
|
36
|
+
/** The job's id in task events: unique across queues. */
|
|
37
|
+
export declare function liveId(queue: string, id: string): string;
|
|
38
|
+
/** A job's data at a glance: as JSON, values under sensitive keys masked, cut short. */
|
|
39
|
+
export declare function eventArgs(data: unknown): string | undefined;
|
|
40
|
+
/** The worker's name: the one the app gave it, or this process's. */
|
|
41
|
+
export declare function workerName(worker: Worker): string;
|
|
42
|
+
/**
|
|
43
|
+
* The process's workers and the jobs each runs now, with one timer for their heartbeats. Two Worker instances under
|
|
44
|
+
* one name (the default, this process's) are one worker to the console.
|
|
45
|
+
*/
|
|
46
|
+
export declare class Heartbeat {
|
|
47
|
+
private readonly send;
|
|
48
|
+
private readonly workers;
|
|
49
|
+
private timer;
|
|
50
|
+
constructor(send: (event: TaskEvent) => void);
|
|
51
|
+
/** A worker starts: the console lists it before it runs anything. */
|
|
52
|
+
open(worker: string): void;
|
|
53
|
+
/** A worker closed: no more heartbeats for it once no instance under its name is open, nor a job running. */
|
|
54
|
+
close(worker: string): void;
|
|
55
|
+
started(worker: string, id: string): void;
|
|
56
|
+
ended(worker: string, id: string): void;
|
|
57
|
+
beat(worker: string): void;
|
|
58
|
+
private of;
|
|
59
|
+
private forget;
|
|
60
|
+
}
|
|
2
61
|
export declare class BullMQInstrumentation extends InstrumentationBase {
|
|
3
|
-
|
|
62
|
+
private readonly events?;
|
|
63
|
+
private readonly heartbeat;
|
|
64
|
+
/** `events`: where task events go; without it, none are sent. */
|
|
65
|
+
constructor(events?: Events | undefined);
|
|
4
66
|
protected init(): InstrumentationNodeModuleDefinition;
|
|
67
|
+
private send;
|
|
68
|
+
/** A task event: what this step knows, undefined fields left out. */
|
|
69
|
+
private event;
|
|
70
|
+
/** The job waits in its queue (or until its delay is over), sent by the process that added it. */
|
|
71
|
+
private enqueued;
|
|
72
|
+
/** The trace and step the app is in now, for a job added there. */
|
|
73
|
+
private parent;
|
|
5
74
|
private processJob;
|
|
75
|
+
/** `retried` when BullMQ runs the job again (its next attempt's count), else `finished`. */
|
|
76
|
+
private ended;
|
|
77
|
+
/** A worker runs from here until it closes: the console lists it meanwhile. */
|
|
78
|
+
private run;
|
|
6
79
|
private add;
|
|
80
|
+
private addBulk;
|
|
7
81
|
}
|
|
82
|
+
export {};
|