@bytesbrains/cruise-worker 0.14.1 → 0.15.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/migrations/0126_mistral_retirements.sql +118 -0
- package/migrations/0127_board_followups_2026_12.sql +184 -0
- package/package.json +1 -1
- package/worker/VERSION +1 -1
- package/worker/index.js +240 -114
- package/worker/index.js.map +4 -4
package/worker/index.js
CHANGED
|
@@ -16646,7 +16646,7 @@ var controlPlanePaths = {
|
|
|
16646
16646
|
summary: "Set a model's fallback chain \u2014 owner or admin of the operating tenant",
|
|
16647
16647
|
description: "**What happens when this model's upstream refuses.** A 429, a 408, a 401, a 402 or a 5xx makes the router try the next candidate in the chain; anything else, and any failure once bytes have started arriving, reaches the caller unchanged. A model with an empty chain has nowhere to go, which is what every row but two was in until #237 \u2014 so a provider throttling us was answered with its own 429 and a customer read it as ours.\n\n**Replaced wholesale, in order.** Send the full list; `[]` clears the chain. At most two fallbacks: candidates are tried **in turn**, each against the full upstream deadline, so a longer chain is a longer wait rather than more redundancy. The same three-candidate bound applies to a lane's chain on every request (#244), so a hand-written chain and a lane are held to one rule. Duplicates, the model itself, an unknown or disabled model, and a model of another modality are all 400 \u2014 the last because the request path rejects a cross-modality candidate on every request, which is redundancy in name only.\n\n**`warnings` is advice, not a refusal.** A chain whose every member is on the primary's own upstream warns: where that host rate-limits per organisation rather than per model, the chain answers the same 429 a deadline later. Clearing a chain warns too, because the state it leaves is the one this route exists to end.\n\nGated like `/admin/upstreams`: a chain is platform configuration and changing it redirects **every** tenant's traffic for that model, so one customer's `owner` is refused with `not_operator`. Which models chain to which is readable by everyone on `GET /admin/models`, since it is made of ids that listing already carries. Every write is an audit row naming the person, the model and the new chain.",
|
|
16648
16648
|
parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "The model id, which contains slashes. Send it URL-encoded (`workers-ai%2F@cf%2F\u2026`) or raw; both work." }],
|
|
16649
|
-
requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["fallbacks"], properties: { fallbacks: { type: "array", items: { type: "string" }, maxItems: 2, description: "Model ids, in the order they should be tried after the primary." } } }, example: { fallbacks: ["mistral/mistral-large-
|
|
16649
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["fallbacks"], properties: { fallbacks: { type: "array", items: { type: "string" }, maxItems: 2, description: "Model ids, in the order they should be tried after the primary." } } }, example: { fallbacks: ["mistral/mistral-large-4-0"] } } } },
|
|
16650
16650
|
responses: { 200: { description: "The chain as written, with any warnings.", content: { "application/json": { schema: { $ref: "#/components/schemas/ModelFallbacks" } } } }, ...errorResponses(400, 401, 403, 404) }
|
|
16651
16651
|
}
|
|
16652
16652
|
}
|
|
@@ -17011,7 +17011,7 @@ var lanePaths = {
|
|
|
17011
17011
|
security: bearerFirebase,
|
|
17012
17012
|
summary: "Create a lane \u2014 admin or owner",
|
|
17013
17013
|
description: `\`id\` must be \`<your tenant id>/<slug>\`, slug \`[a-z0-9][a-z0-9-]{0,63}\`. A global id (\`bb/\u2026\` or \`oss/\u2026\`) is refused with a 403 whose message says what to do instead \u2014 create your own under your namespace with the same members; offer that as the action. Members must exist and be enabled on an enabled upstream (400 naming the bad ids); duplicates, an empty list, or a lane id as a member are 400. **Unmeasured members are allowed**: conformance admits them later, and the response's \`warnings\` and \`catalog.routable_members\` say what will serve today. A lane whose members are all unmeasured is valid, \`catalog\` is \`null\`, and it lists nothing until a conformance run \u2014 say so rather than hiding the lane. An id that already exists, disabled included, is 409. The tier's quota is the last check: one lane too many is 403 \`lane_quota_exceeded\`, one member too many is 403 \`lane_members_exceeded\`, and a successful create at four in five of the quota carries a \`lane_quota\` warning \u2014 archive a lane to free a slot. Every write is an audit row with the members before and after. Omitting \`selection\` takes the tenant's \`default_selection\` (\`GET /admin/settings\`, where \`selection_in_force\` says what that resolves to today), and omitting \`weights\` gives every member 1 \u2014 send either only to allocate some other way. Omitting \`qualityRanks\` leaves every member unranked, which is what a lane starts as: \`cache_scope: lane\` then serves nothing, because the tier rule refuses an unranked member on either side. **Sending \`selection: cheap\` is not the same as omitting it**: it opts this lane out of the tenant's setting, permanently and by name. Omitting \`maxChain\`, or sending \`null\`, leaves the lane on the platform's fallback-chain bound \u2014 \`max_chain_in_force\` on \`GET /admin/settings\` is that figure; send a number from 1 to it to try fewer candidates, never more. \`cacheTtlSeconds\` defaults to 0, which is this lane's cache off, and \`cacheScope\` to \`model\`. Omitting \`compress\` takes the tenant's \`default_compress\` (\`GET /admin/settings\`), \`false\` unless the tenant has turned it on; \`true\` compresses tool outputs for every request through the lane (\`docs/compression.md\`).`,
|
|
17014
|
-
requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["id", "job", "description", "members"], properties: { id: { type: "string" }, job: { $ref: "#/components/schemas/Lane/properties/job" }, description: { type: "string", maxLength: 500 }, members: { type: "array", items: { type: "string" }, minItems: 1 }, requires: { $ref: "#/components/schemas/Lane/properties/requires" }, selection: { $ref: "#/components/schemas/Lane/properties/selection" }, weights: { $ref: "#/components/schemas/Lane/properties/weights" }, qualityRanks: { $ref: "#/components/schemas/Lane/properties/quality_ranks" }, cacheTtlSeconds: { $ref: "#/components/schemas/Lane/properties/cache_ttl_seconds" }, cacheScope: { $ref: "#/components/schemas/Lane/properties/cache_scope" }, compress: { $ref: "#/components/schemas/Lane/properties/compress" }, maxChain: { $ref: "#/components/schemas/Lane/properties/max_chain" }, router: { $ref: "#/components/schemas/Lane/properties/router" }, routerInput: { $ref: "#/components/schemas/Lane/properties/router_input" } } }, example: { id: "acme/review", job: "code-review", description: "Reads a diff and reasons about it.", members: ["deepseek/deepseek-v4-pro", "mistral/mistral-large-
|
|
17014
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["id", "job", "description", "members"], properties: { id: { type: "string" }, job: { $ref: "#/components/schemas/Lane/properties/job" }, description: { type: "string", maxLength: 500 }, members: { type: "array", items: { type: "string" }, minItems: 1 }, requires: { $ref: "#/components/schemas/Lane/properties/requires" }, selection: { $ref: "#/components/schemas/Lane/properties/selection" }, weights: { $ref: "#/components/schemas/Lane/properties/weights" }, qualityRanks: { $ref: "#/components/schemas/Lane/properties/quality_ranks" }, cacheTtlSeconds: { $ref: "#/components/schemas/Lane/properties/cache_ttl_seconds" }, cacheScope: { $ref: "#/components/schemas/Lane/properties/cache_scope" }, compress: { $ref: "#/components/schemas/Lane/properties/compress" }, maxChain: { $ref: "#/components/schemas/Lane/properties/max_chain" }, router: { $ref: "#/components/schemas/Lane/properties/router" }, routerInput: { $ref: "#/components/schemas/Lane/properties/router_input" } } }, example: { id: "acme/review", job: "code-review", description: "Reads a diff and reasons about it.", members: ["deepseek/deepseek-v4-pro", "mistral/mistral-large-4-0"], requires: ["tools-required", "long-context:200000"], selection: "weighted", weights: [0.9, 0.1] } } } },
|
|
17015
17015
|
responses: { 201: { description: "The lane, with `warnings` and `catalog`. `selection` is resolved here: omit it and the lane takes the tenant's `default_selection` (`GET /admin/settings`), stamped into the row rather than followed.", content: { "application/json": { schema: { $ref: "#/components/schemas/Lane" } } } }, ...errorResponses(400, 401, 403, 409) }
|
|
17016
17016
|
}
|
|
17017
17017
|
},
|
|
@@ -19220,7 +19220,7 @@ var DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
|
19220
19220
|
var GLOBAL_OBJ = globalThis;
|
|
19221
19221
|
|
|
19222
19222
|
// node_modules/@sentry/core/build/esm/utils/version.js
|
|
19223
|
-
var SDK_VERSION = "10.
|
|
19223
|
+
var SDK_VERSION = "10.78.0";
|
|
19224
19224
|
|
|
19225
19225
|
// node_modules/@sentry/core/build/esm/carrier.js
|
|
19226
19226
|
function getMainCarrier() {
|
|
@@ -20492,7 +20492,6 @@ var Scope = class _Scope {
|
|
|
20492
20492
|
this._breadcrumbs.push(mergedBreadcrumb);
|
|
20493
20493
|
if (this._breadcrumbs.length > maxCrumbs) {
|
|
20494
20494
|
this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);
|
|
20495
|
-
this._client?.recordDroppedEvent("buffer_overflow", "log_item");
|
|
20496
20495
|
}
|
|
20497
20496
|
this._notifyScopeListeners();
|
|
20498
20497
|
return this;
|
|
@@ -22027,7 +22026,7 @@ var DATA_CATEGORY_OVERRIDES = {
|
|
|
22027
22026
|
check_in: "monitor",
|
|
22028
22027
|
raw_security: "security",
|
|
22029
22028
|
log: "log_item",
|
|
22030
|
-
|
|
22029
|
+
metric: "trace_metric"
|
|
22031
22030
|
};
|
|
22032
22031
|
function _isOverriddenType(type) {
|
|
22033
22032
|
return type in DATA_CATEGORY_OVERRIDES;
|
|
@@ -22507,17 +22506,28 @@ var SentrySpan = class {
|
|
|
22507
22506
|
}
|
|
22508
22507
|
options.onSpanCaptured?.(this);
|
|
22509
22508
|
const spans = [];
|
|
22509
|
+
let droppedUnfinishedSpanCount = 0;
|
|
22510
22510
|
for (const descendant of getSpanDescendants(this)) {
|
|
22511
22511
|
if (descendant === this || isStandaloneSpan(descendant) || options.isSpanAlreadyCaptured?.(descendant)) {
|
|
22512
22512
|
continue;
|
|
22513
22513
|
}
|
|
22514
22514
|
const spanJSON = spanToJSON(descendant);
|
|
22515
22515
|
if (!isFullFinishedSpan(spanJSON)) {
|
|
22516
|
+
if (!options.onSpanCaptured) {
|
|
22517
|
+
droppedUnfinishedSpanCount++;
|
|
22518
|
+
}
|
|
22516
22519
|
continue;
|
|
22517
22520
|
}
|
|
22518
22521
|
options.onSpanCaptured?.(descendant);
|
|
22519
22522
|
spans.push(spanJSON);
|
|
22520
22523
|
}
|
|
22524
|
+
const client = capturedSpanScope?.getClient() || getClient();
|
|
22525
|
+
if (droppedUnfinishedSpanCount) {
|
|
22526
|
+
client?.recordDroppedEvent("invalid", "span", droppedUnfinishedSpanCount);
|
|
22527
|
+
}
|
|
22528
|
+
if (spans.length > MAX_SPAN_COUNT) {
|
|
22529
|
+
client?.recordDroppedEvent("buffer_overflow", "span", spans.length - MAX_SPAN_COUNT);
|
|
22530
|
+
}
|
|
22521
22531
|
const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
22522
22532
|
delete this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME];
|
|
22523
22533
|
let hasGenAiSpans = false;
|
|
@@ -23274,6 +23284,9 @@ var na = "gen_ai.request.temperature";
|
|
|
23274
23284
|
var ra = "gen_ai.request.top_k";
|
|
23275
23285
|
var aa = "gen_ai.request.top_p";
|
|
23276
23286
|
var ya = "gen_ai.system_instructions";
|
|
23287
|
+
var Aa = "gen_ai.usage.cache_creation.input_tokens";
|
|
23288
|
+
var xa = "gen_ai.usage.cache_read.input_tokens";
|
|
23289
|
+
var Ua = "gen_ai.usage.reasoning.output_tokens";
|
|
23277
23290
|
var ws = "http.url";
|
|
23278
23291
|
var Nc = "sentry.sdk.name";
|
|
23279
23292
|
var Cc = "sentry.sdk.version";
|
|
@@ -23580,6 +23593,30 @@ function getFilenameToDebugIdMap(stackParser) {
|
|
|
23580
23593
|
}
|
|
23581
23594
|
__name(getFilenameToDebugIdMap, "getFilenameToDebugIdMap");
|
|
23582
23595
|
|
|
23596
|
+
// node_modules/@sentry/core/build/esm/utils/eventUtils.js
|
|
23597
|
+
function isInternalException(hint) {
|
|
23598
|
+
return hint.data?.__sentry__ === true;
|
|
23599
|
+
}
|
|
23600
|
+
__name(isInternalException, "isInternalException");
|
|
23601
|
+
function getPossibleEventMessages(event) {
|
|
23602
|
+
const possibleMessages = [];
|
|
23603
|
+
if (event.message) {
|
|
23604
|
+
possibleMessages.push(event.message);
|
|
23605
|
+
}
|
|
23606
|
+
try {
|
|
23607
|
+
const lastException = event.exception.values[event.exception.values.length - 1];
|
|
23608
|
+
if (lastException?.value) {
|
|
23609
|
+
possibleMessages.push(lastException.value);
|
|
23610
|
+
if (lastException.type) {
|
|
23611
|
+
possibleMessages.push(`${lastException.type}: ${lastException.value}`);
|
|
23612
|
+
}
|
|
23613
|
+
}
|
|
23614
|
+
} catch {
|
|
23615
|
+
}
|
|
23616
|
+
return possibleMessages;
|
|
23617
|
+
}
|
|
23618
|
+
__name(getPossibleEventMessages, "getPossibleEventMessages");
|
|
23619
|
+
|
|
23583
23620
|
// node_modules/@sentry/core/build/esm/utils/prepareEvent.js
|
|
23584
23621
|
function prepareEvent(options, event, hint, scope, client, isolationScope) {
|
|
23585
23622
|
const { normalizeDepth = 3, normalizeMaxBreadth = 1e3 } = options;
|
|
@@ -23613,8 +23650,7 @@ function prepareEvent(options, event, hint, scope, client, isolationScope) {
|
|
|
23613
23650
|
// Run scope event processors _after_ all other processors
|
|
23614
23651
|
...data.eventProcessors
|
|
23615
23652
|
];
|
|
23616
|
-
const
|
|
23617
|
-
const result2 = isInternalException ? resolvedSyncPromise(prepared) : notifyEventProcessors(eventProcessors, prepared, hint);
|
|
23653
|
+
const result2 = isInternalException(hint) ? resolvedSyncPromise(prepared) : notifyEventProcessors(eventProcessors, prepared, hint);
|
|
23618
23654
|
return result2.then((evt) => {
|
|
23619
23655
|
if (evt) {
|
|
23620
23656
|
applyDebugMeta(evt);
|
|
@@ -24352,26 +24388,6 @@ function createClientReportEnvelope(discarded_events, dsn, timestamp) {
|
|
|
24352
24388
|
}
|
|
24353
24389
|
__name(createClientReportEnvelope, "createClientReportEnvelope");
|
|
24354
24390
|
|
|
24355
|
-
// node_modules/@sentry/core/build/esm/utils/eventUtils.js
|
|
24356
|
-
function getPossibleEventMessages(event) {
|
|
24357
|
-
const possibleMessages = [];
|
|
24358
|
-
if (event.message) {
|
|
24359
|
-
possibleMessages.push(event.message);
|
|
24360
|
-
}
|
|
24361
|
-
try {
|
|
24362
|
-
const lastException = event.exception.values[event.exception.values.length - 1];
|
|
24363
|
-
if (lastException?.value) {
|
|
24364
|
-
possibleMessages.push(lastException.value);
|
|
24365
|
-
if (lastException.type) {
|
|
24366
|
-
possibleMessages.push(`${lastException.type}: ${lastException.value}`);
|
|
24367
|
-
}
|
|
24368
|
-
}
|
|
24369
|
-
} catch {
|
|
24370
|
-
}
|
|
24371
|
-
return possibleMessages;
|
|
24372
|
-
}
|
|
24373
|
-
__name(getPossibleEventMessages, "getPossibleEventMessages");
|
|
24374
|
-
|
|
24375
24391
|
// node_modules/@sentry/core/build/esm/utils/transactionEvent.js
|
|
24376
24392
|
function convertTransactionEventToSpanJson(event) {
|
|
24377
24393
|
const { trace_id, parent_span_id, span_id, status, origin: origin2, data, op } = event.contexts?.trace ?? {};
|
|
@@ -24583,6 +24599,12 @@ function _makeDoNotSendEventError(message) {
|
|
|
24583
24599
|
};
|
|
24584
24600
|
}
|
|
24585
24601
|
__name(_makeDoNotSendEventError, "_makeDoNotSendEventError");
|
|
24602
|
+
function _makeSampledOutError(sampleRate) {
|
|
24603
|
+
return _makeDoNotSendEventError(
|
|
24604
|
+
`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`
|
|
24605
|
+
);
|
|
24606
|
+
}
|
|
24607
|
+
__name(_makeSampledOutError, "_makeSampledOutError");
|
|
24586
24608
|
function _isInternalError(error2) {
|
|
24587
24609
|
return isObjectLike(error2) && INTERNAL_ERROR_SYMBOL in error2;
|
|
24588
24610
|
}
|
|
@@ -24874,8 +24896,10 @@ var Client = class {
|
|
|
24874
24896
|
this.emit("beforeSendEvent", event, hint);
|
|
24875
24897
|
const genAiSpanItem = extractGenAiSpansFromEvent(event, this);
|
|
24876
24898
|
let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
|
|
24877
|
-
|
|
24878
|
-
|
|
24899
|
+
if (!isInternalException(hint)) {
|
|
24900
|
+
for (const attachment of hint.attachments || []) {
|
|
24901
|
+
env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));
|
|
24902
|
+
}
|
|
24879
24903
|
}
|
|
24880
24904
|
if (genAiSpanItem) {
|
|
24881
24905
|
env = addItemToEnvelope(env, genAiSpanItem);
|
|
@@ -25123,14 +25147,19 @@ var Client = class {
|
|
|
25123
25147
|
const eventType = event.type || "error";
|
|
25124
25148
|
const beforeSendLabel = `before send for type \`${eventType}\``;
|
|
25125
25149
|
const parsedSampleRate = typeof sampleRate === "undefined" ? void 0 : parseSampleRate(sampleRate);
|
|
25150
|
+
const isSampledOut = isError2 && typeof parsedSampleRate === "number" && safeMathRandom() > parsedSampleRate;
|
|
25126
25151
|
const dataCategory = getDataCategoryByType(event.type);
|
|
25152
|
+
const session = currentScope.getSession() || isolationScope.getSession();
|
|
25153
|
+
if (isSampledOut && session?.status !== "ok") {
|
|
25154
|
+
this.recordDroppedEvent("sample_rate", "error");
|
|
25155
|
+
return rejectedSyncPromise(_makeSampledOutError(sampleRate));
|
|
25156
|
+
}
|
|
25127
25157
|
return this._prepareEvent(event, hint, currentScope, isolationScope).then((prepared) => {
|
|
25128
25158
|
if (prepared === null) {
|
|
25129
25159
|
this.recordDroppedEvent("event_processor", dataCategory);
|
|
25130
25160
|
throw _makeDoNotSendEventError("An event processor returned `null`, will not send event.");
|
|
25131
25161
|
}
|
|
25132
|
-
|
|
25133
|
-
if (isInternalException) {
|
|
25162
|
+
if (isInternalException(hint)) {
|
|
25134
25163
|
return prepared;
|
|
25135
25164
|
}
|
|
25136
25165
|
const result2 = processBeforeSend(this, options, prepared, hint);
|
|
@@ -25145,15 +25174,12 @@ var Client = class {
|
|
|
25145
25174
|
}
|
|
25146
25175
|
throw _makeDoNotSendEventError(`${beforeSendLabel} returned \`null\`, will not send event.`);
|
|
25147
25176
|
}
|
|
25148
|
-
const session = currentScope.getSession() || isolationScope.getSession();
|
|
25149
25177
|
if (isError2 && session) {
|
|
25150
25178
|
this._updateSessionFromEvent(session, processedEvent);
|
|
25151
25179
|
}
|
|
25152
|
-
if (
|
|
25180
|
+
if (isSampledOut) {
|
|
25153
25181
|
this.recordDroppedEvent("sample_rate", "error");
|
|
25154
|
-
throw
|
|
25155
|
-
`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`
|
|
25156
|
-
);
|
|
25182
|
+
throw _makeSampledOutError(sampleRate);
|
|
25157
25183
|
}
|
|
25158
25184
|
if (isTransaction) {
|
|
25159
25185
|
const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;
|
|
@@ -25430,36 +25456,30 @@ function isSensitiveKey(lower, denySnippets) {
|
|
|
25430
25456
|
return denySnippets.some((snippet) => lower.includes(snippet));
|
|
25431
25457
|
}
|
|
25432
25458
|
__name(isSensitiveKey, "isSensitiveKey");
|
|
25433
|
-
function
|
|
25459
|
+
function shouldFilterDataKey(key, behavior, additionalDenyTerms) {
|
|
25434
25460
|
if (behavior === false) {
|
|
25435
|
-
return
|
|
25461
|
+
return true;
|
|
25436
25462
|
}
|
|
25463
|
+
const lowerKey = key.toLowerCase();
|
|
25437
25464
|
const denySnippets = additionalDenyTerms != null ? [...SENSITIVE_KEY_SNIPPETS, ...additionalDenyTerms] : SENSITIVE_KEY_SNIPPETS;
|
|
25438
|
-
|
|
25465
|
+
if (isSensitiveKey(lowerKey, denySnippets)) {
|
|
25466
|
+
return true;
|
|
25467
|
+
}
|
|
25439
25468
|
if (behavior === true) {
|
|
25440
|
-
|
|
25441
|
-
result2[key] = isSensitiveKey(key.toLowerCase(), denySnippets) ? FILTERED_VALUE : data[key];
|
|
25442
|
-
}
|
|
25443
|
-
return result2;
|
|
25469
|
+
return false;
|
|
25444
25470
|
}
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
return
|
|
25471
|
+
const terms = "deny" in behavior ? behavior.deny : behavior.allow;
|
|
25472
|
+
const matchesConfiguredTerm = terms.some((term) => lowerKey.includes(term.toLowerCase()));
|
|
25473
|
+
return "deny" in behavior ? matchesConfiguredTerm : !matchesConfiguredTerm;
|
|
25474
|
+
}
|
|
25475
|
+
__name(shouldFilterDataKey, "shouldFilterDataKey");
|
|
25476
|
+
function filterKeyValueData(data, behavior, additionalDenyTerms) {
|
|
25477
|
+
if (behavior === false) {
|
|
25478
|
+
return {};
|
|
25453
25479
|
}
|
|
25454
|
-
const
|
|
25480
|
+
const result2 = {};
|
|
25455
25481
|
for (const key of Object.keys(data)) {
|
|
25456
|
-
|
|
25457
|
-
if (isSensitiveKey(lower, denySnippets)) {
|
|
25458
|
-
result2[key] = FILTERED_VALUE;
|
|
25459
|
-
} else {
|
|
25460
|
-
const isAllowed = lowerTerms.some((term) => lower.includes(term));
|
|
25461
|
-
result2[key] = isAllowed ? data[key] : FILTERED_VALUE;
|
|
25462
|
-
}
|
|
25482
|
+
result2[key] = shouldFilterDataKey(key, behavior, additionalDenyTerms) ? FILTERED_VALUE : data[key];
|
|
25463
25483
|
}
|
|
25464
25484
|
return result2;
|
|
25465
25485
|
}
|
|
@@ -25499,6 +25519,55 @@ function parseCookie(str) {
|
|
|
25499
25519
|
}
|
|
25500
25520
|
__name(parseCookie, "parseCookie");
|
|
25501
25521
|
|
|
25522
|
+
// node_modules/@sentry/core/build/esm/utils/data-collection/filterQueryParams.js
|
|
25523
|
+
function filterQueryParams(queryString, behavior) {
|
|
25524
|
+
if (!queryString || behavior === false) {
|
|
25525
|
+
return void 0;
|
|
25526
|
+
}
|
|
25527
|
+
return queryString.split("&").map((pair) => {
|
|
25528
|
+
const separatorIndex = pair.indexOf("=");
|
|
25529
|
+
const encodedKey = separatorIndex === -1 ? pair : pair.slice(0, separatorIndex);
|
|
25530
|
+
const key = new URLSearchParams(`${encodedKey}=`).keys().next().value;
|
|
25531
|
+
return key !== void 0 && shouldFilterDataKey(key, behavior) ? `${encodedKey}=${FILTERED_VALUE}` : pair;
|
|
25532
|
+
}).join("&");
|
|
25533
|
+
}
|
|
25534
|
+
__name(filterQueryParams, "filterQueryParams");
|
|
25535
|
+
|
|
25536
|
+
// node_modules/@sentry/core/build/esm/utils/data-collection/filterUrlQuery.js
|
|
25537
|
+
function filterUrlQuery(url, behavior) {
|
|
25538
|
+
const fragmentStart = url.indexOf("#");
|
|
25539
|
+
const queryEnd = fragmentStart === -1 ? url.length : fragmentStart;
|
|
25540
|
+
const queryStart = url.indexOf("?");
|
|
25541
|
+
if (queryStart === -1 || queryStart > queryEnd) {
|
|
25542
|
+
return url;
|
|
25543
|
+
}
|
|
25544
|
+
const prefix = url.slice(0, queryStart);
|
|
25545
|
+
const query = url.slice(queryStart + 1, queryEnd);
|
|
25546
|
+
const suffix = url.slice(queryEnd);
|
|
25547
|
+
const filtered = filterQueryParams(query, behavior);
|
|
25548
|
+
return filtered ? `${prefix}?${filtered}${suffix}` : `${prefix}${suffix}`;
|
|
25549
|
+
}
|
|
25550
|
+
__name(filterUrlQuery, "filterUrlQuery");
|
|
25551
|
+
|
|
25552
|
+
// node_modules/@sentry/core/build/esm/utils/data-collection/filterCollectedUrl.js
|
|
25553
|
+
function urlQueryParamsBehavior(client) {
|
|
25554
|
+
return (client ?? getClient())?.getDataCollectionOptions().urlQueryParams ?? true;
|
|
25555
|
+
}
|
|
25556
|
+
__name(urlQueryParamsBehavior, "urlQueryParamsBehavior");
|
|
25557
|
+
function filterCollectedUrl(url, client) {
|
|
25558
|
+
return url === void 0 ? void 0 : filterUrlQuery(url, urlQueryParamsBehavior(client));
|
|
25559
|
+
}
|
|
25560
|
+
__name(filterCollectedUrl, "filterCollectedUrl");
|
|
25561
|
+
function filterCollectedUrlQuery(query, client) {
|
|
25562
|
+
if (!query) {
|
|
25563
|
+
return query;
|
|
25564
|
+
}
|
|
25565
|
+
const hasPrefix = query.startsWith("?");
|
|
25566
|
+
const filtered = filterQueryParams(hasPrefix ? query.slice(1) : query, urlQueryParamsBehavior(client));
|
|
25567
|
+
return filtered && hasPrefix ? `?${filtered}` : filtered;
|
|
25568
|
+
}
|
|
25569
|
+
__name(filterCollectedUrlQuery, "filterCollectedUrlQuery");
|
|
25570
|
+
|
|
25502
25571
|
// node_modules/@sentry/core/build/esm/utils/envToBool.js
|
|
25503
25572
|
var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["false", "f", "n", "no", "off", "0"]);
|
|
25504
25573
|
var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["true", "t", "y", "yes", "on", "1"]);
|
|
@@ -25596,7 +25665,7 @@ function getHttpSpanNameFromUrlObject(urlObject, kind, request, routeName) {
|
|
|
25596
25665
|
return `${method} ${route2}`;
|
|
25597
25666
|
}
|
|
25598
25667
|
__name(getHttpSpanNameFromUrlObject, "getHttpSpanNameFromUrlObject");
|
|
25599
|
-
function getHttpSpanDetailsFromUrlObject(urlObject, kind, spanOrigin, request, routeName) {
|
|
25668
|
+
function getHttpSpanDetailsFromUrlObject(urlObject, kind, spanOrigin, request, routeName, client) {
|
|
25600
25669
|
const attributes = {
|
|
25601
25670
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
|
|
25602
25671
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url"
|
|
@@ -25610,7 +25679,7 @@ function getHttpSpanDetailsFromUrlObject(urlObject, kind, spanOrigin, request, r
|
|
|
25610
25679
|
}
|
|
25611
25680
|
if (urlObject) {
|
|
25612
25681
|
if (urlObject.search) {
|
|
25613
|
-
attributes["url.query"] = urlObject.search;
|
|
25682
|
+
attributes["url.query"] = filterCollectedUrlQuery(urlObject.search, client);
|
|
25614
25683
|
}
|
|
25615
25684
|
if (urlObject.hash) {
|
|
25616
25685
|
attributes["url.fragment"] = urlObject.hash;
|
|
@@ -25622,7 +25691,7 @@ function getHttpSpanDetailsFromUrlObject(urlObject, kind, spanOrigin, request, r
|
|
|
25622
25691
|
}
|
|
25623
25692
|
}
|
|
25624
25693
|
if (!isURLObjectRelative(urlObject)) {
|
|
25625
|
-
attributes[Yu] = urlObject.href;
|
|
25694
|
+
attributes[Yu] = filterCollectedUrl(urlObject.href, client);
|
|
25626
25695
|
if (urlObject.port) {
|
|
25627
25696
|
attributes["url.port"] = urlObject.port;
|
|
25628
25697
|
}
|
|
@@ -26465,7 +26534,8 @@ var _requestDataIntegration = /* @__PURE__ */ __name(((options = {}) => {
|
|
|
26465
26534
|
...options.include?.cookies === true && dc.cookies === false && { cookies: true },
|
|
26466
26535
|
...options.include?.headers === true && dc.httpHeaders.request === false && {
|
|
26467
26536
|
httpHeaders: { ...dc.httpHeaders, request: true }
|
|
26468
|
-
}
|
|
26537
|
+
},
|
|
26538
|
+
...options.include?.query_string === true && dc.urlQueryParams === false && { urlQueryParams: true }
|
|
26469
26539
|
};
|
|
26470
26540
|
return {
|
|
26471
26541
|
dataCollection,
|
|
@@ -26488,9 +26558,9 @@ var _requestDataIntegration = /* @__PURE__ */ __name(((options = {}) => {
|
|
|
26488
26558
|
processEvent(event, _hint, client) {
|
|
26489
26559
|
const { sdkProcessingMetadata = {} } = event;
|
|
26490
26560
|
const { normalizedRequest, ipAddress } = sdkProcessingMetadata;
|
|
26491
|
-
const { include } = resolveIncludeAndDataCollection(client);
|
|
26561
|
+
const { include, dataCollection } = resolveIncludeAndDataCollection(client);
|
|
26492
26562
|
if (normalizedRequest) {
|
|
26493
|
-
addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include);
|
|
26563
|
+
addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include, dataCollection);
|
|
26494
26564
|
}
|
|
26495
26565
|
return event;
|
|
26496
26566
|
},
|
|
@@ -26506,10 +26576,17 @@ var _requestDataIntegration = /* @__PURE__ */ __name(((options = {}) => {
|
|
|
26506
26576
|
};
|
|
26507
26577
|
}), "_requestDataIntegration");
|
|
26508
26578
|
var requestDataIntegration = defineIntegration(_requestDataIntegration);
|
|
26509
|
-
function addNormalizedRequestDataToEvent(event, req, additionalData, include) {
|
|
26579
|
+
function addNormalizedRequestDataToEvent(event, req, additionalData, include, dataCollection) {
|
|
26580
|
+
const requestData = extractNormalizedRequestData(req, include);
|
|
26581
|
+
if (requestData.query_string) {
|
|
26582
|
+
requestData.query_string = normalizeAndFilterQueryString(requestData.query_string, dataCollection.urlQueryParams);
|
|
26583
|
+
}
|
|
26584
|
+
if (requestData.url) {
|
|
26585
|
+
requestData.url = filterUrlQuery(requestData.url, dataCollection.urlQueryParams);
|
|
26586
|
+
}
|
|
26510
26587
|
event.request = {
|
|
26511
26588
|
...event.request,
|
|
26512
|
-
...
|
|
26589
|
+
...requestData
|
|
26513
26590
|
};
|
|
26514
26591
|
if (include.ip) {
|
|
26515
26592
|
const ip = req.headers && getClientIPAddress(req.headers) || additionalData.ipAddress;
|
|
@@ -26526,13 +26603,13 @@ function addNormalizedRequestDataToSpan(span, normalizedRequest, ipAddress, incl
|
|
|
26526
26603
|
const requestData = extractNormalizedRequestData(normalizedRequest, include);
|
|
26527
26604
|
const attributes = {};
|
|
26528
26605
|
if (requestData.url) {
|
|
26529
|
-
attributes[Yu] = requestData.url;
|
|
26606
|
+
attributes[Yu] = filterUrlQuery(requestData.url, dataCollection.urlQueryParams);
|
|
26530
26607
|
}
|
|
26531
26608
|
if (requestData.method) {
|
|
26532
26609
|
attributes["http.request.method"] = requestData.method;
|
|
26533
26610
|
}
|
|
26534
26611
|
if (requestData.query_string) {
|
|
26535
|
-
attributes[Hu] =
|
|
26612
|
+
attributes[Hu] = normalizeAndFilterQueryString(requestData.query_string, dataCollection.urlQueryParams);
|
|
26536
26613
|
}
|
|
26537
26614
|
safeSetSpanJSONAttributes(span, attributes);
|
|
26538
26615
|
if (requestData.cookies && Object.keys(requestData.cookies).length > 0) {
|
|
@@ -26592,13 +26669,18 @@ function extractNormalizedRequestData(normalizedRequest, include) {
|
|
|
26592
26669
|
return requestData;
|
|
26593
26670
|
}
|
|
26594
26671
|
__name(extractNormalizedRequestData, "extractNormalizedRequestData");
|
|
26672
|
+
function normalizeAndFilterQueryString(queryString, behavior) {
|
|
26673
|
+
const normalized = normalizeQueryString(queryString);
|
|
26674
|
+
return normalized ? filterQueryParams(normalized, behavior) : void 0;
|
|
26675
|
+
}
|
|
26676
|
+
__name(normalizeAndFilterQueryString, "normalizeAndFilterQueryString");
|
|
26595
26677
|
function normalizeQueryString(queryString) {
|
|
26596
26678
|
if (typeof queryString === "string") {
|
|
26597
26679
|
return queryString || void 0;
|
|
26598
26680
|
}
|
|
26599
26681
|
const pairs = Array.isArray(queryString) ? queryString : Object.entries(queryString);
|
|
26600
|
-
const
|
|
26601
|
-
return
|
|
26682
|
+
const normalized = new URLSearchParams(pairs).toString();
|
|
26683
|
+
return normalized || void 0;
|
|
26602
26684
|
}
|
|
26603
26685
|
__name(normalizeQueryString, "normalizeQueryString");
|
|
26604
26686
|
|
|
@@ -26892,7 +26974,7 @@ function instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeade
|
|
|
26892
26974
|
const client = getClient();
|
|
26893
26975
|
const hasParent = !!getActiveSpan();
|
|
26894
26976
|
const shouldEmitSpan = hasParent || !!client && hasSpanStreamingEnabled(client);
|
|
26895
|
-
const span = shouldCreateSpanResult && shouldEmitSpan ? startInactiveSpan(getSpanStartOptions(url, method, spanOrigin)) : new SentryNonRecordingSpan();
|
|
26977
|
+
const span = shouldCreateSpanResult && shouldEmitSpan ? startInactiveSpan(getSpanStartOptions(url, method, spanOrigin, client)) : new SentryNonRecordingSpan();
|
|
26896
26978
|
const spanForTraceHeaders = spanIsIgnored(span) && hasParent ? void 0 : span;
|
|
26897
26979
|
if (shouldCreateSpanResult && !shouldEmitSpan) {
|
|
26898
26980
|
client?.recordDroppedEvent("no_parent_span", "span");
|
|
@@ -27039,25 +27121,25 @@ function isHeadersInitTupleArray(headers) {
|
|
|
27039
27121
|
);
|
|
27040
27122
|
}
|
|
27041
27123
|
__name(isHeadersInitTupleArray, "isHeadersInitTupleArray");
|
|
27042
|
-
function getSpanStartOptions(url, method, spanOrigin) {
|
|
27124
|
+
function getSpanStartOptions(url, method, spanOrigin, client) {
|
|
27043
27125
|
if (url.startsWith("data:")) {
|
|
27044
27126
|
const sanitizedUrl2 = stripDataUrlContent(url);
|
|
27045
27127
|
return {
|
|
27046
27128
|
name: `${method} ${sanitizedUrl2}`,
|
|
27047
|
-
attributes: getFetchSpanAttributes(url, void 0, method, spanOrigin)
|
|
27129
|
+
attributes: getFetchSpanAttributes(url, void 0, method, spanOrigin, client)
|
|
27048
27130
|
};
|
|
27049
27131
|
}
|
|
27050
27132
|
const parsedUrl = parseStringToURLObject(url);
|
|
27051
27133
|
const sanitizedUrl = parsedUrl ? getSanitizedUrlStringFromUrlObject(parsedUrl) : url;
|
|
27052
27134
|
return {
|
|
27053
27135
|
name: `${method} ${sanitizedUrl}`,
|
|
27054
|
-
attributes: getFetchSpanAttributes(url, parsedUrl, method, spanOrigin)
|
|
27136
|
+
attributes: getFetchSpanAttributes(url, parsedUrl, method, spanOrigin, client)
|
|
27055
27137
|
};
|
|
27056
27138
|
}
|
|
27057
27139
|
__name(getSpanStartOptions, "getSpanStartOptions");
|
|
27058
|
-
function getFetchSpanAttributes(url, parsedUrl, method, spanOrigin) {
|
|
27140
|
+
function getFetchSpanAttributes(url, parsedUrl, method, spanOrigin, client) {
|
|
27059
27141
|
const attributes = {
|
|
27060
|
-
url: stripDataUrlContent(url),
|
|
27142
|
+
url: filterCollectedUrl(stripDataUrlContent(url), client),
|
|
27061
27143
|
type: "fetch",
|
|
27062
27144
|
"http.method": method,
|
|
27063
27145
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
|
|
@@ -27065,12 +27147,12 @@ function getFetchSpanAttributes(url, parsedUrl, method, spanOrigin) {
|
|
|
27065
27147
|
};
|
|
27066
27148
|
if (parsedUrl) {
|
|
27067
27149
|
if (!isURLObjectRelative(parsedUrl)) {
|
|
27068
|
-
attributes[ws] = stripDataUrlContent(parsedUrl.href);
|
|
27069
|
-
attributes[Yu] = stripDataUrlContent(parsedUrl.href);
|
|
27150
|
+
attributes[ws] = filterCollectedUrl(stripDataUrlContent(parsedUrl.href), client);
|
|
27151
|
+
attributes[Yu] = filterCollectedUrl(stripDataUrlContent(parsedUrl.href), client);
|
|
27070
27152
|
attributes["server.address"] = parsedUrl.host;
|
|
27071
27153
|
}
|
|
27072
27154
|
if (parsedUrl.search) {
|
|
27073
|
-
attributes["http.query"] = parsedUrl.search;
|
|
27155
|
+
attributes["http.query"] = filterCollectedUrlQuery(parsedUrl.search, client);
|
|
27074
27156
|
}
|
|
27075
27157
|
if (parsedUrl.hash) {
|
|
27076
27158
|
attributes["http.fragment"] = parsedUrl.hash;
|
|
@@ -27392,25 +27474,28 @@ function shouldEnableTruncation(enableTruncation) {
|
|
|
27392
27474
|
return !hasSpanStreamingEnabled(client) && client.getOptions().streamGenAiSpans === false;
|
|
27393
27475
|
}
|
|
27394
27476
|
__name(shouldEnableTruncation, "shouldEnableTruncation");
|
|
27395
|
-
function
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
});
|
|
27477
|
+
function getTokenUsageAttributes(promptTokens, completionTokens, cacheCreationInputTokens, cacheReadInputTokens, totalTokens) {
|
|
27478
|
+
const attributes = {};
|
|
27479
|
+
if (typeof promptTokens === "number") {
|
|
27480
|
+
attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = promptTokens;
|
|
27400
27481
|
}
|
|
27401
|
-
if (
|
|
27402
|
-
|
|
27403
|
-
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: completionTokens
|
|
27404
|
-
});
|
|
27482
|
+
if (typeof cacheCreationInputTokens === "number") {
|
|
27483
|
+
attributes[Aa] = cacheCreationInputTokens;
|
|
27405
27484
|
}
|
|
27406
|
-
if (
|
|
27407
|
-
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27485
|
+
if (typeof cacheReadInputTokens === "number") {
|
|
27486
|
+
attributes[xa] = cacheReadInputTokens;
|
|
27487
|
+
}
|
|
27488
|
+
if (typeof completionTokens === "number") {
|
|
27489
|
+
attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = completionTokens;
|
|
27490
|
+
}
|
|
27491
|
+
if (typeof totalTokens === "number") {
|
|
27492
|
+
attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = totalTokens;
|
|
27493
|
+
} else if (typeof promptTokens === "number" || typeof completionTokens === "number") {
|
|
27494
|
+
attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = (typeof promptTokens === "number" ? promptTokens : 0) + (typeof completionTokens === "number" ? completionTokens : 0);
|
|
27411
27495
|
}
|
|
27496
|
+
return attributes;
|
|
27412
27497
|
}
|
|
27413
|
-
__name(
|
|
27498
|
+
__name(getTokenUsageAttributes, "getTokenUsageAttributes");
|
|
27414
27499
|
function endStreamSpan(span, state, recordOutputs) {
|
|
27415
27500
|
if (!span.isRecording()) {
|
|
27416
27501
|
return;
|
|
@@ -27420,12 +27505,18 @@ function endStreamSpan(span, state, recordOutputs) {
|
|
|
27420
27505
|
};
|
|
27421
27506
|
if (state.responseId) attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;
|
|
27422
27507
|
if (state.responseModel) attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;
|
|
27423
|
-
|
|
27424
|
-
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27428
|
-
|
|
27508
|
+
Object.assign(
|
|
27509
|
+
attrs,
|
|
27510
|
+
getTokenUsageAttributes(
|
|
27511
|
+
state.promptTokens,
|
|
27512
|
+
state.completionTokens,
|
|
27513
|
+
state.cacheCreationInputTokens,
|
|
27514
|
+
state.cacheReadInputTokens,
|
|
27515
|
+
state.totalTokens
|
|
27516
|
+
)
|
|
27517
|
+
);
|
|
27518
|
+
if (typeof state.reasoningOutputTokens === "number") {
|
|
27519
|
+
attrs[Ua] = state.reasoningOutputTokens;
|
|
27429
27520
|
}
|
|
27430
27521
|
if (state.finishReasons.length) {
|
|
27431
27522
|
attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);
|
|
@@ -27588,7 +27679,7 @@ function addResponseAttributes(span, result2, recordOutputs) {
|
|
|
27588
27679
|
}
|
|
27589
27680
|
const response = result2;
|
|
27590
27681
|
if (response.usage) {
|
|
27591
|
-
|
|
27682
|
+
span.setAttributes(getTokenUsageAttributes(response.usage.prompt_tokens, response.usage.completion_tokens));
|
|
27592
27683
|
}
|
|
27593
27684
|
if (recordOutputs) {
|
|
27594
27685
|
let responseText;
|
|
@@ -28586,7 +28677,7 @@ var UPDATE_RE = new RegExp(
|
|
|
28586
28677
|
"i"
|
|
28587
28678
|
);
|
|
28588
28679
|
var DELETE_RE = new RegExp(`^\\s*(?<operation>DELETE)\\s+FROM\\s+(?<table>${TABLE_NAME})`, "i");
|
|
28589
|
-
var SELECT_RE = /^\s
|
|
28680
|
+
var SELECT_RE = /^\s*(?:\(\s*)?(?<operation>SELECT)\b/i;
|
|
28590
28681
|
var PRAGMA_RE = /^\s*(?<operation>PRAGMA)\s+(?<command>\S+)/i;
|
|
28591
28682
|
var TOKEN_RE = /\b(?:FROM|JOIN)\s+|\(\s*(SELECT)\b|\b(?:UNION|INTERSECT|EXCEPT|MINUS)\s+(?:ALL\s+)?(SELECT)\b/gi;
|
|
28592
28683
|
var QUOTED_OR_PLAIN_TABLE_RE = /^(?:"[^"]*"|'[^']*'|[^\s(,;)]+)/;
|
|
@@ -28998,16 +29089,23 @@ var CloudflareClient = class extends ServerRuntimeClient {
|
|
|
28998
29089
|
}
|
|
28999
29090
|
/**
|
|
29000
29091
|
* Flushes pending operations and ensures all data is processed.
|
|
29001
|
-
* If a timeout is provided, the operation will be completed within the specified time limit.
|
|
29002
29092
|
*
|
|
29003
|
-
*
|
|
29093
|
+
* Each phase waits at most `timeout`: the flush lock of a per-invocation client, pending spans, event
|
|
29094
|
+
* processing and the transport drain. So a flush can take a small multiple of `timeout`, which stays well
|
|
29095
|
+
* below Cloudflare's 30 second `waitUntil` limit for the timeouts the SDK uses. Sends still pending when
|
|
29096
|
+
* the drain times out are aborted.
|
|
29004
29097
|
*
|
|
29005
|
-
* @param {number} [timeout] -
|
|
29098
|
+
* @param {number} [timeout] - Maximum time in milliseconds for each phase of the flush.
|
|
29006
29099
|
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.
|
|
29007
29100
|
*/
|
|
29008
29101
|
async flush(timeout) {
|
|
29009
29102
|
if (this._flushLock) {
|
|
29010
|
-
|
|
29103
|
+
let timer;
|
|
29104
|
+
await Promise.race([
|
|
29105
|
+
this._flushLock.finalize(),
|
|
29106
|
+
...timeout ? [new Promise((resolve3) => timer = setTimeout(resolve3, timeout))] : []
|
|
29107
|
+
]);
|
|
29108
|
+
clearTimeout(timer);
|
|
29011
29109
|
}
|
|
29012
29110
|
if (this._pendingSpans.size > 0 && this._spanCompletionPromise) {
|
|
29013
29111
|
DEBUG_BUILD2 && debug.log("[CloudflareClient] Waiting for", this._pendingSpans.size, "pending spans to complete...");
|
|
@@ -29395,15 +29493,24 @@ var IsolatedPromiseBuffer = class {
|
|
|
29395
29493
|
drain(timeout) {
|
|
29396
29494
|
const oldTaskProducers = [...this._taskProducers];
|
|
29397
29495
|
this._taskProducers = [];
|
|
29496
|
+
const drainController = new AbortController();
|
|
29497
|
+
this.drainSignal = drainController.signal;
|
|
29498
|
+
let tasks;
|
|
29499
|
+
try {
|
|
29500
|
+
tasks = oldTaskProducers.map((taskProducer) => taskProducer());
|
|
29501
|
+
} finally {
|
|
29502
|
+
this.drainSignal = void 0;
|
|
29503
|
+
}
|
|
29398
29504
|
return new Promise((resolve3) => {
|
|
29399
29505
|
const timer = setTimeout(() => {
|
|
29400
29506
|
if (timeout && timeout > 0) {
|
|
29507
|
+
drainController.abort();
|
|
29401
29508
|
resolve3(false);
|
|
29402
29509
|
}
|
|
29403
29510
|
}, timeout);
|
|
29404
29511
|
Promise.all(
|
|
29405
|
-
|
|
29406
|
-
(
|
|
29512
|
+
tasks.map(
|
|
29513
|
+
(task) => task.then(null, () => {
|
|
29407
29514
|
})
|
|
29408
29515
|
)
|
|
29409
29516
|
).then(() => {
|
|
@@ -29414,12 +29521,17 @@ var IsolatedPromiseBuffer = class {
|
|
|
29414
29521
|
}
|
|
29415
29522
|
};
|
|
29416
29523
|
function makeCloudflareTransport(options) {
|
|
29524
|
+
const buffer = new IsolatedPromiseBuffer(options.bufferSize);
|
|
29417
29525
|
function makeRequest(request) {
|
|
29526
|
+
const drainSignal = buffer.drainSignal;
|
|
29527
|
+
const callerSignal = options.fetchOptions?.signal ?? void 0;
|
|
29528
|
+
const signal = drainSignal && callerSignal ? AbortSignal.any([drainSignal, callerSignal]) : drainSignal ?? callerSignal;
|
|
29418
29529
|
const requestOptions = {
|
|
29419
29530
|
body: request.body,
|
|
29420
29531
|
method: "POST",
|
|
29421
29532
|
headers: options.headers,
|
|
29422
|
-
...options.fetchOptions
|
|
29533
|
+
...options.fetchOptions,
|
|
29534
|
+
...signal ? { signal } : {}
|
|
29423
29535
|
};
|
|
29424
29536
|
return suppressTracing(() => {
|
|
29425
29537
|
return (options.fetch ?? fetch)(options.url, requestOptions).then(async (response) => {
|
|
@@ -29438,7 +29550,7 @@ function makeCloudflareTransport(options) {
|
|
|
29438
29550
|
});
|
|
29439
29551
|
}
|
|
29440
29552
|
__name(makeRequest, "makeRequest");
|
|
29441
|
-
return createTransport(options, makeRequest,
|
|
29553
|
+
return createTransport(options, makeRequest, buffer);
|
|
29442
29554
|
}
|
|
29443
29555
|
__name(makeCloudflareTransport, "makeCloudflareTransport");
|
|
29444
29556
|
|
|
@@ -30144,6 +30256,12 @@ function instrumentDurableObjectNamespace(namespace, propagateRpcTrace = false)
|
|
|
30144
30256
|
return instrumentDurableObjectStub(stub, propagateRpcTrace);
|
|
30145
30257
|
};
|
|
30146
30258
|
}
|
|
30259
|
+
if (prop === "jurisdiction") {
|
|
30260
|
+
return function(...args) {
|
|
30261
|
+
const subnamespace = Reflect.apply(value, target, args);
|
|
30262
|
+
return instrumentDurableObjectNamespace(subnamespace, propagateRpcTrace);
|
|
30263
|
+
};
|
|
30264
|
+
}
|
|
30147
30265
|
return value.bind(target);
|
|
30148
30266
|
}
|
|
30149
30267
|
});
|
|
@@ -30555,7 +30673,14 @@ function wrapRequestHandler(wrapperOptions, handler) {
|
|
|
30555
30673
|
const client = init({ ...options, ctx: context });
|
|
30556
30674
|
isolationScope.setClient(client);
|
|
30557
30675
|
const urlObject = parseStringToURLObject(request.url);
|
|
30558
|
-
const [name2, attributes] = getHttpSpanDetailsFromUrlObject(
|
|
30676
|
+
const [name2, attributes] = getHttpSpanDetailsFromUrlObject(
|
|
30677
|
+
urlObject,
|
|
30678
|
+
"server",
|
|
30679
|
+
"auto.http.cloudflare",
|
|
30680
|
+
request,
|
|
30681
|
+
void 0,
|
|
30682
|
+
client
|
|
30683
|
+
);
|
|
30559
30684
|
const contentLength = request.headers.get("content-length");
|
|
30560
30685
|
if (contentLength) {
|
|
30561
30686
|
attributes["http.request.body.size"] = parseInt(contentLength, 10);
|
|
@@ -30929,6 +31054,7 @@ function wrapMethodWithSentry(wrapperOptions, handler, callback, noMark) {
|
|
|
30929
31054
|
args = extracted.args;
|
|
30930
31055
|
rpcMeta = extracted.rpcMeta;
|
|
30931
31056
|
}
|
|
31057
|
+
const spanName = typeof wrapperOptions.spanName === "function" ? wrapperOptions.spanName(rpcMeta) : wrapperOptions.spanName;
|
|
30932
31058
|
const wrappedFunction = /* @__PURE__ */ __name((scope) => {
|
|
30933
31059
|
const context = wrapperOptions.context;
|
|
30934
31060
|
const waitUntil = context ? getOriginalWaitUntil(context)?.bind(context) : void 0;
|
|
@@ -30943,7 +31069,7 @@ function wrapMethodWithSentry(wrapperOptions, handler, callback, noMark) {
|
|
|
30943
31069
|
scopeClient = client;
|
|
30944
31070
|
}
|
|
30945
31071
|
const clientToDispose = scopeClient;
|
|
30946
|
-
const methodName =
|
|
31072
|
+
const methodName = spanName || "unknown";
|
|
30947
31073
|
const teardown = /* @__PURE__ */ __name(async () => {
|
|
30948
31074
|
if (startNewTrace$1 && storage) {
|
|
30949
31075
|
storeSpanContext(storage, methodName);
|
|
@@ -30964,7 +31090,7 @@ function wrapMethodWithSentry(wrapperOptions, handler, callback, noMark) {
|
|
|
30964
31090
|
waitUntil?.(teardown());
|
|
30965
31091
|
throw e;
|
|
30966
31092
|
}, "onRejected");
|
|
30967
|
-
if (!
|
|
31093
|
+
if (!spanName) {
|
|
30968
31094
|
try {
|
|
30969
31095
|
if (callback) {
|
|
30970
31096
|
callback(...args);
|