agentfootprint 11.1.0 → 11.1.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/dist/adapters/observability/cloudwatch.js +101 -110
- package/dist/adapters/observability/cloudwatch.js.map +1 -1
- package/dist/adapters/observability/file.js +48 -71
- package/dist/adapters/observability/file.js.map +1 -1
- package/dist/adapters/observability/outbox.js +217 -0
- package/dist/adapters/observability/outbox.js.map +1 -0
- package/dist/adapters/observability/xray.js +56 -70
- package/dist/adapters/observability/xray.js.map +1 -1
- package/dist/esm/adapters/observability/cloudwatch.d.ts +6 -2
- package/dist/esm/adapters/observability/cloudwatch.js +101 -110
- package/dist/esm/adapters/observability/cloudwatch.js.map +1 -1
- package/dist/esm/adapters/observability/file.d.ts +8 -4
- package/dist/esm/adapters/observability/file.js +48 -71
- package/dist/esm/adapters/observability/file.js.map +1 -1
- package/dist/esm/adapters/observability/outbox.d.ts +104 -0
- package/dist/esm/adapters/observability/outbox.js +213 -0
- package/dist/esm/adapters/observability/outbox.js.map +1 -0
- package/dist/esm/adapters/observability/xray.js +56 -70
- package/dist/esm/adapters/observability/xray.js.map +1 -1
- package/dist/types/adapters/observability/cloudwatch.d.ts +6 -2
- package/dist/types/adapters/observability/cloudwatch.d.ts.map +1 -1
- package/dist/types/adapters/observability/file.d.ts +8 -4
- package/dist/types/adapters/observability/file.d.ts.map +1 -1
- package/dist/types/adapters/observability/outbox.d.ts +105 -0
- package/dist/types/adapters/observability/outbox.d.ts.map +1 -0
- package/dist/types/adapters/observability/xray.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -44,6 +44,23 @@ exports.cloudwatchObservability = exports._buildCloudWatchObservability = void 0
|
|
|
44
44
|
const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
|
|
45
45
|
const wireJson_js_1 = require("../../lib/wireJson.js");
|
|
46
46
|
const deliveryErrors_js_1 = require("./deliveryErrors.js");
|
|
47
|
+
const outbox_js_1 = require("./outbox.js");
|
|
48
|
+
/**
|
|
49
|
+
* What ONE `PutLogEvents` request may carry — CloudWatch Logs' documented
|
|
50
|
+
* per-request limits (PutLogEvents API reference): "The maximum number of log
|
|
51
|
+
* events in a batch is 10,000", and "The maximum batch size is 1,048,576
|
|
52
|
+
* bytes. This size is calculated as the sum of all event messages in UTF-8,
|
|
53
|
+
* plus 26 bytes for each log event."
|
|
54
|
+
*
|
|
55
|
+
* These split a delivery into legal requests; they are NOT triggers.
|
|
56
|
+
* `maxBatchEvents` / `maxBatchBytes` still decide when a delivery starts,
|
|
57
|
+
* exactly as before. The split matters because puts now go one at a time
|
|
58
|
+
* (#223): a slow put lets a backlog build behind it, and without the split
|
|
59
|
+
* the next delivery sent the whole backlog as one request CloudWatch refuses.
|
|
60
|
+
*/
|
|
61
|
+
const PUT_LOG_EVENTS_MAX_EVENTS = 10_000;
|
|
62
|
+
const PUT_LOG_EVENTS_MAX_BYTES = 1_048_576;
|
|
63
|
+
const PUT_LOG_EVENTS_BYTES_PER_EVENT = 26;
|
|
47
64
|
// ─── Generic base — also used by agentcoreObservability ──────────────
|
|
48
65
|
/**
|
|
49
66
|
* Internal: shared CloudWatch Logs base used by every adapter that
|
|
@@ -65,11 +82,8 @@ function _buildCloudWatchObservability(opts, strategyName) {
|
|
|
65
82
|
const maxBatchEvents = opts.maxBatchEvents ?? 100;
|
|
66
83
|
const maxBatchBytes = opts.maxBatchBytes ?? 10_240;
|
|
67
84
|
const flushIntervalMs = opts.flushIntervalMs ?? 1000;
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
let bufferBytes = 0;
|
|
71
|
-
let lastFlushPromise = Promise.resolve();
|
|
72
|
-
let timer;
|
|
85
|
+
// Set by `stop()`: no more events accepted. NOT a guard on delivery (8.11.1):
|
|
86
|
+
// stopping does not authorise throwing away what was already accepted.
|
|
73
87
|
let stopped = false;
|
|
74
88
|
// What we know about the log stream (8.11.0). This is the per-(group,stream)
|
|
75
89
|
// create latch — group and stream are fixed for the life of a strategy, so
|
|
@@ -94,14 +108,6 @@ function _buildCloudWatchObservability(opts, strategyName) {
|
|
|
94
108
|
client = createCloudWatchClient(opts.region, strategyName, opts._sdk);
|
|
95
109
|
return client;
|
|
96
110
|
}
|
|
97
|
-
function scheduleTimedFlush() {
|
|
98
|
-
if (timer || flushIntervalMs <= 0 || stopped)
|
|
99
|
-
return;
|
|
100
|
-
timer = setTimeout(() => {
|
|
101
|
-
timer = undefined;
|
|
102
|
-
void doFlush();
|
|
103
|
-
}, flushIntervalMs);
|
|
104
|
-
}
|
|
105
111
|
/** Route a delivery failure through whatever `_onError` IS RIGHT NOW.
|
|
106
112
|
* Reading it at call time (rather than capturing a hook at construction)
|
|
107
113
|
* is the whole fix: a consumer who assigns `_onError` after building the
|
|
@@ -117,90 +123,89 @@ function _buildCloudWatchObservability(opts, strategyName) {
|
|
|
117
123
|
logEvents: batch,
|
|
118
124
|
});
|
|
119
125
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// progress — an infinite microtask spin that starved the event loop of
|
|
126
|
-
// the very process trying to shut down. Same stance as `auditExport`:
|
|
127
|
-
// stop observing, never destroy what was collected.
|
|
128
|
-
if (buffer.length === 0)
|
|
129
|
-
return;
|
|
130
|
-
// Snapshot + clear so concurrent emits during the in-flight put
|
|
131
|
-
// accumulate into the next batch.
|
|
132
|
-
const batch = buffer.splice(0);
|
|
133
|
-
bufferBytes = 0;
|
|
126
|
+
/** Ship one batch. Throws when it could not — the outbox drops the batch
|
|
127
|
+
* and reports it once. Runs inside the outbox's queue, so two puts are
|
|
128
|
+
* never in flight at once and CloudWatch's per-stream order holds. */
|
|
129
|
+
async function shipBatch(batch) {
|
|
130
|
+
const client = ensureClient();
|
|
134
131
|
try {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
await putBatch(client, batch);
|
|
138
|
-
streamState = 'created'; // a successful put proves the stream is there
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
// The one recoverable shape: CloudWatch rejects a put into a stream
|
|
143
|
-
// that doesn't exist. Before 8.11.0 this adapter asserted that
|
|
144
|
-
// precondition and never established it, so any stream name that
|
|
145
|
-
// didn't already exist dropped every event, forever, in silence —
|
|
146
|
-
// and the documented `${HOSTNAME}/${Date.now()}` convention can never
|
|
147
|
-
// pre-exist, so following the docs guaranteed the bug.
|
|
148
|
-
if (!isMissingStreamError(err) || streamState === 'unavailable')
|
|
149
|
-
throw err;
|
|
150
|
-
if (!client.createLogStream) {
|
|
151
|
-
throw new Error(`log stream '${logStreamName}' does not exist in log group ` +
|
|
152
|
-
`'${opts.logGroupName}', and the injected \`_client\` has no ` +
|
|
153
|
-
`\`createLogStream\` to create it.`);
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
await client.createLogStream({
|
|
157
|
-
logGroupName: opts.logGroupName,
|
|
158
|
-
logStreamName,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
catch (createErr) {
|
|
162
|
-
// Two processes racing to create the same stream is normal and
|
|
163
|
-
// expected — whoever lost the race still has a usable stream.
|
|
164
|
-
if (!isAlreadyExistsError(createErr)) {
|
|
165
|
-
// Anything else (no `logs:CreateLogStream`, or the log GROUP
|
|
166
|
-
// itself is missing) will not fix itself. Latch it off so we
|
|
167
|
-
// never loop, and say which of the two it probably is.
|
|
168
|
-
streamState = 'unavailable';
|
|
169
|
-
throw new Error(`could not create log stream '${logStreamName}' in log group ` +
|
|
170
|
-
`'${opts.logGroupName}': ${errorMessage(createErr)}. Check that the log ` +
|
|
171
|
-
`GROUP exists (this adapter never creates one) and that the role allows ` +
|
|
172
|
-
`\`logs:CreateLogStream\`.`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
streamState = 'created';
|
|
176
|
-
// Exactly ONE re-put of the same batch. Not a retry loop: if this
|
|
177
|
-
// fails the events are gone, and saying so is better than growing a
|
|
178
|
-
// buffer during an outage.
|
|
179
|
-
await putBatch(client, batch);
|
|
180
|
-
}
|
|
132
|
+
await putBatch(client, batch);
|
|
133
|
+
streamState = 'created'; // a successful put proves the stream is there
|
|
181
134
|
}
|
|
182
135
|
catch (err) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
136
|
+
// The one recoverable shape: CloudWatch rejects a put into a stream
|
|
137
|
+
// that doesn't exist. Before 8.11.0 this adapter asserted that
|
|
138
|
+
// precondition and never established it, so any stream name that
|
|
139
|
+
// didn't already exist dropped every event, forever, in silence —
|
|
140
|
+
// and the documented `${HOSTNAME}/${Date.now()}` convention can never
|
|
141
|
+
// pre-exist, so following the docs guaranteed the bug.
|
|
142
|
+
if (!isMissingStreamError(err) || streamState === 'unavailable')
|
|
143
|
+
throw err;
|
|
144
|
+
await createStream(client);
|
|
145
|
+
// Exactly ONE re-put of the same batch. Not a retry loop: if this
|
|
146
|
+
// fails the events are gone, and saying so is better than growing a
|
|
147
|
+
// buffer during an outage.
|
|
148
|
+
await putBatch(client, batch);
|
|
186
149
|
}
|
|
187
150
|
}
|
|
151
|
+
/** Create the missing stream, or latch it off for good when retrying cannot
|
|
152
|
+
* help. Losing a create race to another process is success. */
|
|
153
|
+
async function createStream(client) {
|
|
154
|
+
if (!client.createLogStream) {
|
|
155
|
+
throw new Error(`log stream '${logStreamName}' does not exist in log group ` +
|
|
156
|
+
`'${opts.logGroupName}', and the injected \`_client\` has no ` +
|
|
157
|
+
`\`createLogStream\` to create it.`);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await client.createLogStream({ logGroupName: opts.logGroupName, logStreamName });
|
|
161
|
+
}
|
|
162
|
+
catch (createErr) {
|
|
163
|
+
// Two processes racing to create the same stream is normal and
|
|
164
|
+
// expected — whoever lost the race still has a usable stream.
|
|
165
|
+
if (!isAlreadyExistsError(createErr)) {
|
|
166
|
+
// Anything else (no `logs:CreateLogStream`, or the log GROUP itself is
|
|
167
|
+
// missing) will not fix itself. Latch it off so we never loop, and say
|
|
168
|
+
// which of the two it probably is.
|
|
169
|
+
streamState = 'unavailable';
|
|
170
|
+
throw new Error(`could not create log stream '${logStreamName}' in log group ` +
|
|
171
|
+
`'${opts.logGroupName}': ${errorMessage(createErr)}. Check that the log ` +
|
|
172
|
+
`GROUP exists (this adapter never creates one) and that the role allows ` +
|
|
173
|
+
`\`logs:CreateLogStream\`.`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
streamState = 'created';
|
|
177
|
+
}
|
|
178
|
+
// Buffered log events, and the one queue every put goes through — size
|
|
179
|
+
// trigger, timer, `flush()`, shutdown (outbox.ts; #223).
|
|
180
|
+
const outbox = (0, outbox_js_1.createOutbox)({
|
|
181
|
+
name: strategyName,
|
|
182
|
+
// When a delivery starts — compared as given, as before.
|
|
183
|
+
maxItems: maxBatchEvents,
|
|
184
|
+
maxBytes: maxBatchBytes,
|
|
185
|
+
// What one put may carry: the oldest events that fit; the rest ship in
|
|
186
|
+
// the next put, right after, in order. The byte measure is the one `add`
|
|
187
|
+
// records (UTF-8 message bytes) plus CloudWatch's 26 per event. An event
|
|
188
|
+
// too large for any request is still sent — alone — as it was before;
|
|
189
|
+
// CloudWatch refuses it and that one event is reported dropped, without
|
|
190
|
+
// taking its neighbours with it.
|
|
191
|
+
maxItemsPerDelivery: PUT_LOG_EVENTS_MAX_EVENTS,
|
|
192
|
+
maxBytesPerDelivery: PUT_LOG_EVENTS_MAX_BYTES,
|
|
193
|
+
overheadBytesPerItem: PUT_LOG_EVENTS_BYTES_PER_EVENT,
|
|
194
|
+
flushIntervalMs,
|
|
195
|
+
// An un-stopped strategy lingers up to `flushIntervalMs` so the timer can
|
|
196
|
+
// still ship the tail (see `stop()`).
|
|
197
|
+
timerHoldsProcess: true,
|
|
198
|
+
deliver: shipBatch,
|
|
199
|
+
dropped: (batch, cause) => new Error(`${batch.length} event(s) dropped shipping to log group '${opts.logGroupName}' ` +
|
|
200
|
+
`stream '${logStreamName}': ${errorMessage(cause)}`),
|
|
201
|
+
report: reportFailure,
|
|
202
|
+
});
|
|
188
203
|
function enqueue(event) {
|
|
189
204
|
if (stopped)
|
|
190
205
|
return;
|
|
191
206
|
// The wire rule (`lib/wireJson.ts`) — an Error's custom properties never ship.
|
|
192
207
|
const message = (0, wireJson_js_1.toWireJson)(event);
|
|
193
|
-
|
|
194
|
-
buffer.push({ timestamp: Date.now(), message });
|
|
195
|
-
bufferBytes += bytes;
|
|
196
|
-
if (buffer.length >= maxBatchEvents || bufferBytes >= maxBatchBytes) {
|
|
197
|
-
// Size trigger — flush immediately. Chain onto last to preserve
|
|
198
|
-
// CloudWatch's per-stream ordering requirement.
|
|
199
|
-
lastFlushPromise = lastFlushPromise.then(doFlush, doFlush);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
scheduleTimedFlush();
|
|
203
|
-
}
|
|
208
|
+
outbox.add({ timestamp: Date.now(), message }, Buffer.byteLength(message, 'utf8'));
|
|
204
209
|
}
|
|
205
210
|
const strategy = {
|
|
206
211
|
name: strategyName,
|
|
@@ -221,25 +226,14 @@ function _buildCloudWatchObservability(opts, strategyName) {
|
|
|
221
226
|
* since 8.11.1: a flush after a stop still ships what was already
|
|
222
227
|
* accepted.
|
|
223
228
|
*/
|
|
224
|
-
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
for (;;) {
|
|
233
|
-
const pending = buffer.length;
|
|
234
|
-
// Chain, never replace: CloudWatch requires per-stream ordering, so a
|
|
235
|
-
// drain waits for the in-flight put rather than racing it.
|
|
236
|
-
lastFlushPromise = lastFlushPromise.then(doFlush, doFlush);
|
|
237
|
-
await lastFlushPromise;
|
|
238
|
-
if (buffer.length === 0)
|
|
239
|
-
return;
|
|
240
|
-
if (buffer.length >= pending)
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
229
|
+
flush() {
|
|
230
|
+
// Resolves once every event accepted before the call is shipped (or
|
|
231
|
+
// dropped and reported) — one a timed put already had in flight
|
|
232
|
+
// included — after one more sweep of what arrived while it waited; it
|
|
233
|
+
// does not chase a producer that keeps emitting. A put that never
|
|
234
|
+
// settles holds it. Since 8.11.1 delivery ignores `stop()`, so a flush
|
|
235
|
+
// after a stop still ships and never spins.
|
|
236
|
+
return outbox.drain();
|
|
243
237
|
},
|
|
244
238
|
/** Stop the flush timer and stop accepting events. **The framework does
|
|
245
239
|
* not call this for you** — an un-stopped strategy keeps a `setTimeout`
|
|
@@ -251,10 +245,7 @@ function _buildCloudWatchObservability(opts, strategyName) {
|
|
|
251
245
|
* `stop()` still ships it (8.11.1). */
|
|
252
246
|
stop() {
|
|
253
247
|
stopped = true;
|
|
254
|
-
|
|
255
|
-
clearTimeout(timer);
|
|
256
|
-
timer = undefined;
|
|
257
|
-
}
|
|
248
|
+
outbox.stop();
|
|
258
249
|
},
|
|
259
250
|
/**
|
|
260
251
|
* Where errors go. Two callers: the dispatch layer (when `exportEvent`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudwatch.js","sourceRoot":"","sources":["../../../src/adapters/observability/cloudwatch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;AAGH,6DAAuD;AACvD,uDAAmD;AAGnD,2DAA6D;
|
|
1
|
+
{"version":3,"file":"cloudwatch.js","sourceRoot":"","sources":["../../../src/adapters/observability/cloudwatch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;AAGH,6DAAuD;AACvD,uDAAmD;AAGnD,2DAA6D;AAC7D,2CAA2C;AAK3C;;;;;;;;;;;;GAYG;AACH,MAAM,yBAAyB,GAAG,MAAM,CAAC;AACzC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAiG1C,wEAAwE;AAExE;;;;;;;;;;GAUG;AACH,SAAgB,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5B,KAAK,CAAC,eAAe,CAAC,KAAsD;gBAC1E,MAAM,GAAG,GAAG,IAAK,sBAAsD,CAAC,KAAK,CAAC,CAAC;gBAC/E,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -37,10 +37,14 @@
|
|
|
37
37
|
* `exportEvent` is sync and never touches the disk: it serializes, buffers, and
|
|
38
38
|
* returns. Batches are appended asynchronously on a size trigger
|
|
39
39
|
* (`maxBufferEvents` / `maxBufferBytes`), on a timer (`flushIntervalMs`), and on
|
|
40
|
-
* `flush()
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
40
|
+
* `flush()` — all through ONE queue (`outbox.ts`), so one append is in flight
|
|
41
|
+
* at a time: this sink's appends never interleave, and lines land in dispatch
|
|
42
|
+
* order (#223). That is not atomicity — a disk that fails partway through an
|
|
43
|
+
* append (ENOSPC) can still leave part of a line behind, and that batch is
|
|
44
|
+
* reported dropped. A hard kill loses the buffer and can interrupt the append
|
|
45
|
+
* in flight — the price of not making telemetry a term in agent-loop latency.
|
|
46
|
+
* Call `flush()` (or `agent.shutdown()`, which does) at process end; see the
|
|
47
|
+
* 8.12.0 lifecycle laws on {@link BaseStrategy.flush}.
|
|
44
48
|
*
|
|
45
49
|
* ## Rotation is ONE generation, and that is deliberate
|
|
46
50
|
*
|
|
@@ -75,6 +79,7 @@ exports.fileObservability = void 0;
|
|
|
75
79
|
const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
|
|
76
80
|
const wireJson_js_1 = require("../../lib/wireJson.js");
|
|
77
81
|
const deliveryErrors_js_1 = require("./deliveryErrors.js");
|
|
82
|
+
const outbox_js_1 = require("./outbox.js");
|
|
78
83
|
// ─── Public factory ──────────────────────────────────────────────────
|
|
79
84
|
/**
|
|
80
85
|
* NDJSON-to-a-local-file observability strategy. See
|
|
@@ -120,27 +125,13 @@ function fileObservability(opts) {
|
|
|
120
125
|
`Fix the path or the permission — this sink refuses to start rather than ` +
|
|
121
126
|
`silently drop every event.`);
|
|
122
127
|
}
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let lastFlushPromise = Promise.resolve();
|
|
127
|
-
let timer;
|
|
128
|
+
// Set by `stop()`: this sink accepts no more events. It is NOT a guard on
|
|
129
|
+
// writing — `stop()` does not authorise throwing away what was already
|
|
130
|
+
// accepted, and `flush()` after it still writes (the 8.11.1 stance).
|
|
128
131
|
let stopped = false;
|
|
129
132
|
// The fallback when the consumer wires nothing. Rate-limited; a
|
|
130
133
|
// consumer-supplied sink is not.
|
|
131
134
|
const consoleSink = (0, deliveryErrors_js_1.rateLimitedConsoleSink)(strategyName);
|
|
132
|
-
function scheduleTimedFlush() {
|
|
133
|
-
if (timer || flushIntervalMs <= 0 || stopped)
|
|
134
|
-
return;
|
|
135
|
-
timer = setTimeout(() => {
|
|
136
|
-
timer = undefined;
|
|
137
|
-
void doFlush();
|
|
138
|
-
}, flushIntervalMs);
|
|
139
|
-
// Never hold the process open for telemetry. `unref` exists on Node's
|
|
140
|
-
// Timeout and not on the browser's number — feature-detected, so a
|
|
141
|
-
// non-Node runtime with an injected `_fs` still works.
|
|
142
|
-
timer.unref?.();
|
|
143
|
-
}
|
|
144
135
|
/** Route a delivery failure through whatever `_onError` IS RIGHT NOW —
|
|
145
136
|
* reading it at call time, so a consumer who assigns `_onError` after
|
|
146
137
|
* construction still receives them (the 8.11.0 fix). */
|
|
@@ -162,28 +153,29 @@ function fileObservability(opts) {
|
|
|
162
153
|
await fs.rename(path, rotatedPath);
|
|
163
154
|
bytesOnDisk = 0;
|
|
164
155
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const batch = buffer.splice(0);
|
|
175
|
-
const batchBytes = bufferBytes;
|
|
176
|
-
bufferBytes = 0;
|
|
177
|
-
const data = `${batch.join('\n')}\n`;
|
|
178
|
-
try {
|
|
179
|
-
await rotateIfNeeded(batchBytes);
|
|
180
|
-
await fs.appendFile(path, data);
|
|
181
|
-
bytesOnDisk += byteLength(data);
|
|
182
|
-
}
|
|
183
|
-
catch (err) {
|
|
184
|
-
reportFailure(new Error(`${batch.length} event(s) dropped writing to '${path}': ${errorMessage(err)}`));
|
|
185
|
-
}
|
|
156
|
+
/** One batch: rotate if it would cross the ceiling, then append. Runs
|
|
157
|
+
* inside the outbox's queue, so no other batch — and no other rotation —
|
|
158
|
+
* can start until this one settles. */
|
|
159
|
+
async function writeBatch(lines) {
|
|
160
|
+
const data = `${lines.join('\n')}\n`;
|
|
161
|
+
const bytes = byteLength(data);
|
|
162
|
+
await rotateIfNeeded(bytes);
|
|
163
|
+
await fs.appendFile(path, data);
|
|
164
|
+
bytesOnDisk += bytes;
|
|
186
165
|
}
|
|
166
|
+
// Buffered lines, and the one queue every write goes through — size
|
|
167
|
+
// trigger, timer, `flush()`, shutdown (outbox.ts; #223).
|
|
168
|
+
const outbox = (0, outbox_js_1.createOutbox)({
|
|
169
|
+
name: strategyName,
|
|
170
|
+
maxItems: maxBufferEvents,
|
|
171
|
+
maxBytes: maxBufferBytes,
|
|
172
|
+
flushIntervalMs,
|
|
173
|
+
// Never hold the process open for a local write.
|
|
174
|
+
timerHoldsProcess: false,
|
|
175
|
+
deliver: writeBatch,
|
|
176
|
+
dropped: (lines, cause) => new Error(`${lines.length} event(s) dropped writing to '${path}': ${errorMessage(cause)}`),
|
|
177
|
+
report: reportFailure,
|
|
178
|
+
});
|
|
187
179
|
function enqueue(event) {
|
|
188
180
|
if (stopped)
|
|
189
181
|
return;
|
|
@@ -205,17 +197,11 @@ function fileObservability(opts) {
|
|
|
205
197
|
// write, and a bare "undefined" line would corrupt the NDJSON stream.
|
|
206
198
|
if (line === undefined)
|
|
207
199
|
return;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// offline reader can rely on.
|
|
214
|
-
lastFlushPromise = lastFlushPromise.then(doFlush, doFlush);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
scheduleTimedFlush();
|
|
218
|
-
}
|
|
200
|
+
// + the newline this line will carry. The outbox decides when it is
|
|
201
|
+
// written, and writes it after every line accepted before it — the file's
|
|
202
|
+
// line order IS the dispatch order, the one thing an offline reader can
|
|
203
|
+
// rely on.
|
|
204
|
+
outbox.add(line, byteLength(line) + 1);
|
|
219
205
|
}
|
|
220
206
|
const strategy = {
|
|
221
207
|
name: strategyName,
|
|
@@ -226,31 +212,22 @@ function fileObservability(opts) {
|
|
|
226
212
|
* Write what is buffered. Called for you on shutdown (8.12.0) — by the
|
|
227
213
|
* handle `enable.observability()` returns, by `agent.shutdown()`, and by a
|
|
228
214
|
* `standingAgent` closing. Safe at any time, including after `stop()`.
|
|
215
|
+
*
|
|
216
|
+
* Resolves once every event accepted before the call is written (or
|
|
217
|
+
* dropped and reported) — one a timed write already had in flight
|
|
218
|
+
* included — after one more sweep of what arrived while it waited. It
|
|
219
|
+
* does not chase a producer that keeps emitting. A write that never
|
|
220
|
+
* settles holds it: nothing can cancel an in-flight write.
|
|
229
221
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// line; a pass that removes none ends the drain instead of retrying. The
|
|
233
|
-
// shape the CloudWatch adapter arrived at in 8.11.1, for the same reason:
|
|
234
|
-
// a drain that cannot finish must return, never spin.
|
|
235
|
-
for (;;) {
|
|
236
|
-
const pending = buffer.length;
|
|
237
|
-
lastFlushPromise = lastFlushPromise.then(doFlush, doFlush);
|
|
238
|
-
await lastFlushPromise;
|
|
239
|
-
if (buffer.length === 0)
|
|
240
|
-
return;
|
|
241
|
-
if (buffer.length >= pending)
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
222
|
+
flush() {
|
|
223
|
+
return outbox.drain();
|
|
244
224
|
},
|
|
245
225
|
/** Clear the timer and stop accepting events. Terminal: there is no
|
|
246
226
|
* restart. What it does NOT do is discard the buffer — `flush()` after
|
|
247
227
|
* `stop()` still writes it. */
|
|
248
228
|
stop() {
|
|
249
229
|
stopped = true;
|
|
250
|
-
|
|
251
|
-
clearTimeout(timer);
|
|
252
|
-
timer = undefined;
|
|
253
|
-
}
|
|
230
|
+
outbox.stop();
|
|
254
231
|
},
|
|
255
232
|
/** Where failures go. Two callers: the dispatch layer (when `exportEvent`
|
|
256
233
|
* itself throws) and this adapter's own write path. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/adapters/observability/file.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/adapters/observability/file.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;;;AAGH,6DAAuD;AACvD,uDAAmD;AAGnD,2DAA6D;AAC7D,2CAA2C;AAoE3C,wEAAwE;AAExE;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAA8B;IAC9D,MAAM,YAAY,GAAG,MAAM,CAAC;IAE5B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3E,MAAM,IAAI,SAAS,CACjB,IAAI,YAAY,mEAAmE;YACjF,+EAA+E;YAC/E,kFAAkF,CACrF,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,SAAS,CACjB,IAAI,YAAY,iEAAiE;YAC/E,QAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC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