@sentry/server-utils 11.13.0 → 11.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/chunks/config.js +19 -5
- package/build/cjs/chunks/config.js.map +1 -1
- package/build/cjs/chunks/exports.js +72 -26
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/chunks/moduleInjectedTransform.js +6 -5
- package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/index.js +161 -65
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +4 -4
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
- package/build/esm/ai/google-genai/constants.js +2 -1
- package/build/esm/ai/google-genai/constants.js.map +1 -1
- package/build/esm/ai/google-genai/decisions.js +25 -0
- package/build/esm/ai/google-genai/decisions.js.map +1 -0
- package/build/esm/ai/google-genai/index.js +16 -5
- package/build/esm/ai/google-genai/index.js.map +1 -1
- package/build/esm/ai/mistral/index.js +9 -8
- package/build/esm/ai/mistral/index.js.map +1 -1
- package/build/esm/ai/mistral/streaming.js +3 -7
- package/build/esm/ai/mistral/streaming.js.map +1 -1
- package/build/esm/ai/mistral/utils.js +9 -1
- package/build/esm/ai/mistral/utils.js.map +1 -1
- package/build/esm/ai/vercel-ai/index.js +3 -1
- package/build/esm/ai/vercel-ai/index.js.map +1 -1
- package/build/esm/ai/workers-ai/index.js +8 -7
- package/build/esm/ai/workers-ai/index.js.map +1 -1
- package/build/esm/ai/workers-ai/streaming.js +3 -7
- package/build/esm/ai/workers-ai/streaming.js.map +1 -1
- package/build/esm/index.js +3 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/cron.js +2 -2
- package/build/esm/integrations/cron.js.map +1 -1
- package/build/esm/integrations/google-genai.js +10 -6
- package/build/esm/integrations/google-genai.js.map +1 -1
- package/build/esm/integrations/mistral.js +4 -3
- package/build/esm/integrations/mistral.js.map +1 -1
- package/build/esm/integrations/node-cron.js +5 -4
- package/build/esm/integrations/node-cron.js.map +1 -1
- package/build/esm/integrations/node-schedule.js +2 -2
- package/build/esm/integrations/node-schedule.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +9 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js +6 -5
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js.map +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +4 -4
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
- package/build/esm/orchestrion/config/google-genai.js +19 -5
- package/build/esm/orchestrion/config/google-genai.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/cronMonitoring.js +128 -50
- package/build/esm/utils/cronMonitoring.js.map +1 -1
- package/build/types/ai/google-genai/constants.d.ts +3 -0
- package/build/types/ai/google-genai/constants.d.ts.map +1 -1
- package/build/types/ai/google-genai/decisions.d.ts +8 -0
- package/build/types/ai/google-genai/decisions.d.ts.map +1 -0
- package/build/types/ai/google-genai/index.d.ts +3 -1
- package/build/types/ai/google-genai/index.d.ts.map +1 -1
- package/build/types/ai/mistral/index.d.ts.map +1 -1
- package/build/types/ai/mistral/streaming.d.ts +1 -1
- package/build/types/ai/mistral/streaming.d.ts.map +1 -1
- package/build/types/ai/mistral/utils.d.ts +5 -0
- package/build/types/ai/mistral/utils.d.ts.map +1 -1
- package/build/types/ai/vercel-ai/index.d.ts.map +1 -1
- package/build/types/ai/vercel-ai/vercel-ai-attributes.d.ts +3 -0
- package/build/types/ai/vercel-ai/vercel-ai-attributes.d.ts.map +1 -1
- package/build/types/ai/workers-ai/index.d.ts.map +1 -1
- package/build/types/ai/workers-ai/streaming.d.ts +1 -1
- package/build/types/ai/workers-ai/streaming.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/cron.d.ts.map +1 -1
- package/build/types/integrations/google-genai.d.ts +3 -3
- package/build/types/integrations/google-genai.d.ts.map +1 -1
- package/build/types/integrations/mistral.d.ts.map +1 -1
- package/build/types/integrations/node-cron.d.ts +1 -1
- package/build/types/integrations/node-cron.d.ts.map +1 -1
- package/build/types/integrations/node-schedule.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/moduleInjectedTransform.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/rollup.d.ts +3 -3
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +1 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/google-genai.d.ts +13 -0
- package/build/types/orchestrion/config/google-genai.d.ts.map +1 -1
- package/build/types/utils/cronMonitoring.d.ts +4 -5
- package/build/types/utils/cronMonitoring.d.ts.map +1 -1
- package/package.json +3 -3
package/build/cjs/index.js
CHANGED
|
@@ -3222,61 +3222,71 @@ function subscribeToScheduleChange(channelName, integrationName, onChange, onSta
|
|
|
3222
3222
|
function shouldMonitorJob(name, job, excludeJobs) {
|
|
3223
3223
|
return typeof name === "string" && !!name && typeof job === "function" && !job[MONITORED] && !(0, _sentry_core.stringMatchesSomePattern)(name, excludeJobs, true);
|
|
3224
3224
|
}
|
|
3225
|
-
const
|
|
3225
|
+
const COMMON_NICKNAMES = {
|
|
3226
3226
|
"@yearly": "0 0 1 1 *",
|
|
3227
|
-
"@annually": "0 0 1 1 *",
|
|
3228
3227
|
"@monthly": "0 0 1 * *",
|
|
3229
3228
|
"@weekly": "0 0 * * 0",
|
|
3230
3229
|
"@daily": "0 0 * * *",
|
|
3231
|
-
"@
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
"
|
|
3235
|
-
|
|
3230
|
+
"@hourly": "0 * * * *"
|
|
3231
|
+
};
|
|
3232
|
+
const NICKNAMES = {
|
|
3233
|
+
"node-cron": {
|
|
3234
|
+
...COMMON_NICKNAMES,
|
|
3235
|
+
"@annually": "0 0 1 1 *",
|
|
3236
|
+
"@midnight": "0 0 * * *"
|
|
3237
|
+
},
|
|
3238
|
+
cron: {
|
|
3239
|
+
...COMMON_NICKNAMES,
|
|
3240
|
+
"@minutely": "* * * * *",
|
|
3241
|
+
"@weekdays": "0 0 * * 1-5",
|
|
3242
|
+
"@weekends": "0 0 * * 0,6"
|
|
3243
|
+
},
|
|
3244
|
+
"cron-parser": COMMON_NICKNAMES
|
|
3236
3245
|
};
|
|
3237
3246
|
const MONTHS = [
|
|
3238
|
-
"
|
|
3239
|
-
"
|
|
3240
|
-
"
|
|
3241
|
-
"
|
|
3247
|
+
"january",
|
|
3248
|
+
"february",
|
|
3249
|
+
"march",
|
|
3250
|
+
"april",
|
|
3242
3251
|
"may",
|
|
3243
|
-
"
|
|
3244
|
-
"
|
|
3245
|
-
"
|
|
3246
|
-
"
|
|
3247
|
-
"
|
|
3248
|
-
"
|
|
3249
|
-
"
|
|
3252
|
+
"june",
|
|
3253
|
+
"july",
|
|
3254
|
+
"august",
|
|
3255
|
+
"september",
|
|
3256
|
+
"october",
|
|
3257
|
+
"november",
|
|
3258
|
+
"december"
|
|
3250
3259
|
];
|
|
3251
3260
|
const WEEKDAYS = [
|
|
3252
|
-
"
|
|
3253
|
-
"
|
|
3254
|
-
"
|
|
3255
|
-
"
|
|
3256
|
-
"
|
|
3257
|
-
"
|
|
3258
|
-
"
|
|
3261
|
+
"sunday",
|
|
3262
|
+
"monday",
|
|
3263
|
+
"tuesday",
|
|
3264
|
+
"wednesday",
|
|
3265
|
+
"thursday",
|
|
3266
|
+
"friday",
|
|
3267
|
+
"saturday"
|
|
3259
3268
|
];
|
|
3260
3269
|
/**
|
|
3261
3270
|
* The Sentry monitor config for a cron expression, or `undefined` if Sentry would read it differently.
|
|
3262
3271
|
* Without a `timezone`, the server's time zone is used, like the schedulers do.
|
|
3263
3272
|
*/
|
|
3264
|
-
function cronExpressionToMonitorConfig(expression, timezone,
|
|
3273
|
+
function cronExpressionToMonitorConfig(expression, timezone, dialect) {
|
|
3265
3274
|
const trimmed = expression.trim();
|
|
3266
|
-
const fields = (NICKNAMES[trimmed.toLowerCase()] || trimmed).split(/\s+/);
|
|
3275
|
+
const fields = (NICKNAMES[dialect][trimmed.toLowerCase()] || trimmed).split(/\s+/);
|
|
3267
3276
|
if (fields.length === 6 && /^\d+$/.test(fields[0])) fields.shift();
|
|
3268
|
-
if (fields.length !== 5 || !fields.every((field) => /^[\d*,/a-z
|
|
3269
|
-
const [minute, hour, dayOfMonth, month,
|
|
3270
|
-
const
|
|
3271
|
-
|
|
3277
|
+
if (fields.length !== 5 || !fields.every((field) => /^[\d*,/a-z#-]+$/i.test(field))) return;
|
|
3278
|
+
const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;
|
|
3279
|
+
const monthNumbers = replaceNames(month, MONTHS, 1, dialect);
|
|
3280
|
+
const weekdayNames = replaceNames(dayOfWeek, WEEKDAYS, 0, dialect);
|
|
3281
|
+
const weekdayNumbers = dialect === "node-cron" ? endRangesOnSundayAsSeven(weekdayNames) : weekdayNames;
|
|
3272
3282
|
const crontab = [
|
|
3273
3283
|
minute,
|
|
3274
3284
|
hour,
|
|
3275
3285
|
dayOfMonth,
|
|
3276
|
-
|
|
3277
|
-
|
|
3286
|
+
monthNumbers,
|
|
3287
|
+
weekdayNumbers
|
|
3278
3288
|
];
|
|
3279
|
-
if (crontab.some((field) =>
|
|
3289
|
+
if (crontab.some((field, index) => hasUnsupportedCharacter(field, dialect === "cron-parser" ? CRON_PARSER_DAY_TOKENS[index] : void 0) || hasReversedRange(field) || hasSteppedSingleValueRange(field)) || !isSameDayMatching(dayOfMonth, weekdayNumbers, dialect) || !hasDayInSelectedMonths(dayOfMonth, monthNumbers)) return;
|
|
3280
3290
|
const sentryTimezone = toSentryTimezone(typeof timezone === "string" && timezone ? timezone : void 0);
|
|
3281
3291
|
if (!sentryTimezone) return;
|
|
3282
3292
|
return {
|
|
@@ -3287,31 +3297,93 @@ function cronExpressionToMonitorConfig(expression, timezone, daySemantics) {
|
|
|
3287
3297
|
timezone: sentryTimezone
|
|
3288
3298
|
};
|
|
3289
3299
|
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3300
|
+
const CRON_PARSER_DAY_TOKENS = [
|
|
3301
|
+
void 0,
|
|
3302
|
+
void 0,
|
|
3303
|
+
/^L$/,
|
|
3304
|
+
void 0,
|
|
3305
|
+
/^[0-7](?:L|#[1-5])$/
|
|
3306
|
+
];
|
|
3307
|
+
function hasUnsupportedCharacter(field, dayToken) {
|
|
3308
|
+
return field.split(",").some((part) => /[a-z#]/i.test(part) && !dayToken?.test(part));
|
|
3309
|
+
}
|
|
3310
|
+
function isSameDayMatching(dayOfMonth, dayOfWeek, dialect) {
|
|
3311
|
+
const monthDays = parseDayField(dayOfMonth, 1, 31);
|
|
3312
|
+
const weekdays = parseDayField(dayOfWeek, 0, 7);
|
|
3313
|
+
if (!monthDays || !weekdays) return false;
|
|
3314
|
+
const sentryNeedsBoth = dayOfMonth.startsWith("*") || dayOfWeek.startsWith("*");
|
|
3315
|
+
if (dialect === "cron-parser") return isSameDayMatchingInCronParser(dayOfMonth, dayOfWeek, monthDays, weekdays, sentryNeedsBoth);
|
|
3316
|
+
const allMonthDays = monthDays.days === 31;
|
|
3317
|
+
const allWeekdays = weekdays.days === 7;
|
|
3318
|
+
return allMonthDays && allWeekdays || (dialect === "node-cron" || allMonthDays || allWeekdays) === sentryNeedsBoth;
|
|
3319
|
+
}
|
|
3320
|
+
function isSameDayMatchingInCronParser(dayOfMonth, dayOfWeek, monthDays, weekdays, sentryNeedsBoth) {
|
|
3321
|
+
if (weekdays.cronParserAddsSunday || dayOfWeek.includes("#") && (dayOfMonth !== "*" || dayOfWeek.includes(","))) return false;
|
|
3322
|
+
if (dayOfWeek === "*") return true;
|
|
3323
|
+
if (dayOfMonth === "*") return weekdays.cronParserValues !== 8 || weekdays.days === 7;
|
|
3324
|
+
return !sentryNeedsBoth && monthDays.cronParserValues < 29 && weekdays.cronParserValues !== 8;
|
|
3325
|
+
}
|
|
3326
|
+
const DAYS_IN_MONTH = [
|
|
3327
|
+
31,
|
|
3328
|
+
29,
|
|
3329
|
+
31,
|
|
3330
|
+
30,
|
|
3331
|
+
31,
|
|
3332
|
+
30,
|
|
3333
|
+
31,
|
|
3334
|
+
31,
|
|
3335
|
+
30,
|
|
3336
|
+
31,
|
|
3337
|
+
30,
|
|
3338
|
+
31
|
|
3339
|
+
];
|
|
3340
|
+
function hasDayInSelectedMonths(dayOfMonth, month) {
|
|
3341
|
+
const days = parseDayField(dayOfMonth, 1, 31)?.values;
|
|
3342
|
+
const months = parseDayField(month, 1, 12)?.values;
|
|
3343
|
+
if (!days || !months) return false;
|
|
3344
|
+
return !days.size || Math.min(...days) <= Math.max(...[...months].map((m) => DAYS_IN_MONTH[m - 1]));
|
|
3345
|
+
}
|
|
3346
|
+
function parseDayField(field, low, high) {
|
|
3347
|
+
const days = /* @__PURE__ */ new Set();
|
|
3348
|
+
let cronParserValues = 0;
|
|
3349
|
+
let cronParserListsSunday = false;
|
|
3297
3350
|
for (const part of field.split(",")) {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
const
|
|
3303
|
-
|
|
3351
|
+
if (/^(?:L|[0-7](?:L|#[1-5]))$/.test(part)) {
|
|
3352
|
+
cronParserValues++;
|
|
3353
|
+
continue;
|
|
3354
|
+
}
|
|
3355
|
+
const match = /^(?:(\*)|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/.exec(part);
|
|
3356
|
+
if (!match) return;
|
|
3357
|
+
const [, wildcard, from, to, step] = match;
|
|
3358
|
+
const lower = wildcard ? low : Number(from);
|
|
3359
|
+
const upper = wildcard || step && !to ? high : Number(to ?? from);
|
|
3360
|
+
const increment = Number(step ?? 1);
|
|
3361
|
+
if (!increment || lower < low || upper > high || lower > upper) return;
|
|
3362
|
+
if (high === 7 && upper === 7 && lower !== 0 && (to || step)) {
|
|
3363
|
+
cronParserValues++;
|
|
3364
|
+
cronParserListsSunday = true;
|
|
3365
|
+
}
|
|
3366
|
+
for (let day = lower; day <= upper; day += increment) {
|
|
3367
|
+
days.add(high === 7 && day === 7 ? 0 : day);
|
|
3368
|
+
cronParserValues++;
|
|
3369
|
+
}
|
|
3304
3370
|
}
|
|
3305
|
-
return
|
|
3371
|
+
return {
|
|
3372
|
+
values: days,
|
|
3373
|
+
days: days.size,
|
|
3374
|
+
cronParserValues,
|
|
3375
|
+
cronParserAddsSunday: cronParserListsSunday && !days.has(0)
|
|
3376
|
+
};
|
|
3306
3377
|
}
|
|
3307
|
-
function replaceNames(field, names, offset) {
|
|
3378
|
+
function replaceNames(field, names, offset, dialect) {
|
|
3308
3379
|
return field.replace(/[a-z]+/gi, (word) => {
|
|
3309
|
-
const
|
|
3380
|
+
const lowerCase = word.toLowerCase();
|
|
3381
|
+
const index = names.findIndex((name) => lowerCase === name.slice(0, 3) || dialect === "node-cron" && lowerCase === name);
|
|
3310
3382
|
return index === -1 ? word : String(index + offset);
|
|
3311
3383
|
});
|
|
3312
3384
|
}
|
|
3313
3385
|
function endRangesOnSundayAsSeven(field) {
|
|
3314
|
-
return field.replace(
|
|
3386
|
+
return field.split(",").map((part) => part.replace(/^(\d+)-0(?!\d)/, (range, start) => Number(start) ? `${start}-7` : range)).join(",");
|
|
3315
3387
|
}
|
|
3316
3388
|
function hasReversedRange(field) {
|
|
3317
3389
|
return field.split(",").some((part) => {
|
|
@@ -3319,6 +3391,12 @@ function hasReversedRange(field) {
|
|
|
3319
3391
|
return !!range && Number(range[1]) > Number(range[2]);
|
|
3320
3392
|
});
|
|
3321
3393
|
}
|
|
3394
|
+
function hasSteppedSingleValueRange(field) {
|
|
3395
|
+
return field.split(",").some((part) => {
|
|
3396
|
+
const range = /^(\d+)-(\d+)\//.exec(part);
|
|
3397
|
+
return !!range && Number(range[1]) === Number(range[2]);
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3322
3400
|
function toSentryTimezone(timezone) {
|
|
3323
3401
|
if (timezone && /^(?:utc|gmt)?[+-]/i.test(timezone)) return;
|
|
3324
3402
|
try {
|
|
@@ -3386,7 +3464,7 @@ function onSetTime({ arguments: [cronTime], self }) {
|
|
|
3386
3464
|
const job = self;
|
|
3387
3465
|
if (!job || job.cronTime !== cronTime) return;
|
|
3388
3466
|
const { source, timeZone, utcOffset } = cronTime;
|
|
3389
|
-
const monitorConfig = typeof source === "string" && utcOffset == null ? cronExpressionToMonitorConfig(source, timeZone, "
|
|
3467
|
+
const monitorConfig = typeof source === "string" && utcOffset == null ? cronExpressionToMonitorConfig(source, timeZone, "cron") : void 0;
|
|
3390
3468
|
for (const callback of job._callbacks || []) updateMonitorConfig(callback, monitorConfig);
|
|
3391
3469
|
}
|
|
3392
3470
|
function wrapJob(args, options) {
|
|
@@ -3394,7 +3472,7 @@ function wrapJob(args, options) {
|
|
|
3394
3472
|
const utcOffset = args[7];
|
|
3395
3473
|
const name = args[11];
|
|
3396
3474
|
if (typeof cronTime !== "string" || !shouldMonitorJob(name, onTick, options.excludeJobs)) return;
|
|
3397
|
-
args[1] = wrapScheduledJob(onTick, name, utcOffset == null ? cronExpressionToMonitorConfig(cronTime, timeZone, "
|
|
3475
|
+
args[1] = wrapScheduledJob(onTick, name, utcOffset == null ? cronExpressionToMonitorConfig(cronTime, timeZone, "cron") : void 0, "auto.function.cron");
|
|
3398
3476
|
}
|
|
3399
3477
|
// src/integrations/node-cron.ts
|
|
3400
3478
|
const INTEGRATION_NAME$26 = "NodeCron";
|
|
@@ -3425,7 +3503,7 @@ function wrapTask(args, options, isReadAlike) {
|
|
|
3425
3503
|
}
|
|
3426
3504
|
/** The monitor config for a task, or `undefined` if `isReadAlike` says this node-cron version reads it differently. */
|
|
3427
3505
|
function getMonitorConfig$1(expression, timezone, isReadAlike) {
|
|
3428
|
-
return isReadAlike && !isReadAlike(expression) ? void 0 : cronExpressionToMonitorConfig(expression, timezone, "
|
|
3506
|
+
return isReadAlike && !isReadAlike(expression) ? void 0 : cronExpressionToMonitorConfig(expression, timezone, "node-cron");
|
|
3429
3507
|
}
|
|
3430
3508
|
const NODE_CRON_3_FIELD_MINIMUMS = [
|
|
3431
3509
|
0,
|
|
@@ -3436,11 +3514,12 @@ const NODE_CRON_3_FIELD_MINIMUMS = [
|
|
|
3436
3514
|
];
|
|
3437
3515
|
/**
|
|
3438
3516
|
* node-cron before 4.6 reads `7` as `0` and swaps reversed ranges, so it runs `sat-sun`, `6-0` and `6-7` every day.
|
|
3439
|
-
* Returns `false`
|
|
3517
|
+
* It also reads a step without a range, like `5/10`, as its start. Returns `false` where that could differ.
|
|
3440
3518
|
*/
|
|
3441
3519
|
function isReadAlikeByNodeCron4(expression) {
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3520
|
+
const fields = expression.trim().split(/\s+/);
|
|
3521
|
+
const weekday = fields[fields.length - 1] || "";
|
|
3522
|
+
return !(weekday.includes("-") && (weekday.includes("7") || /-(?:0|sun)/i.test(weekday))) && !fields.some((field) => field.split(",").some((part) => /^[a-z\d]+\//i.test(part)));
|
|
3444
3523
|
}
|
|
3445
3524
|
/**
|
|
3446
3525
|
* node-cron 3 keeps the values of a stepped field that are multiples of the step (`*\/2` days are 2, 4, ...)
|
|
@@ -3507,9 +3586,9 @@ function isCronShaped(value) {
|
|
|
3507
3586
|
return /^@[a-z]+$/i.test(value.trim()) || (fields.length === 5 || fields.length === 6) && fields.every((field) => /^[\d*,/?#a-z-]+$/i.test(field));
|
|
3508
3587
|
}
|
|
3509
3588
|
function getMonitorConfig(spec) {
|
|
3510
|
-
if (typeof spec === "string") return cronExpressionToMonitorConfig(spec, void 0, "
|
|
3589
|
+
if (typeof spec === "string") return cronExpressionToMonitorConfig(spec, void 0, "cron-parser");
|
|
3511
3590
|
const { rule, tz, start, end } = spec || {};
|
|
3512
|
-
return typeof rule === "string" && !start && !end ? cronExpressionToMonitorConfig(rule, tz, "
|
|
3591
|
+
return typeof rule === "string" && !start && !end ? cronExpressionToMonitorConfig(rule, tz, "cron-parser") : void 0;
|
|
3513
3592
|
}
|
|
3514
3593
|
// src/integrations/google-genai.ts
|
|
3515
3594
|
const INTEGRATION_NAME$24 = "Google_GenAI";
|
|
@@ -3526,6 +3605,10 @@ const INSTRUMENTED_CHANNELS$2 = [
|
|
|
3526
3605
|
{
|
|
3527
3606
|
channel: CHANNELS.GOOGLE_GENAI_CHAT,
|
|
3528
3607
|
operation: "chat"
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
channel: CHANNELS.GOOGLE_GENAI_DECIDE,
|
|
3611
|
+
operation: "decide"
|
|
3529
3612
|
}
|
|
3530
3613
|
];
|
|
3531
3614
|
const _googleGenAIIntegration = ((options = {}) => {
|
|
@@ -3541,9 +3624,9 @@ function instrumentGoogleGenai(options) {
|
|
|
3541
3624
|
beforeSpanEnd: (span, data) => {
|
|
3542
3625
|
if ("error" in data) {
|
|
3543
3626
|
const params = require_exports.resolveChatParams(operation, data.arguments?.[0], data.self);
|
|
3544
|
-
require_exports.markCancelledIfAborted(span, require_exports.
|
|
3627
|
+
require_exports.markCancelledIfAborted(span, require_exports.getCallAbortSignal(operation, params, data.arguments?.[1]));
|
|
3545
3628
|
}
|
|
3546
|
-
if (operation !== "embeddings") require_exports.addResponseAttributes$2(span, data.result, require_exports.resolveAIRecordingOptions(options).recordOutputs);
|
|
3629
|
+
if (operation !== "embeddings") require_exports.addResponseAttributes$2(span, data.result, require_exports.resolveAIRecordingOptions(options).recordOutputs, operation);
|
|
3547
3630
|
},
|
|
3548
3631
|
deferSpanEnd: ({ span, data }) => wrapStreamResult$2(span, data, operation, options)
|
|
3549
3632
|
});
|
|
@@ -3597,9 +3680,9 @@ function wrapStreamResult$2(span, data, operation, options) {
|
|
|
3597
3680
|
/**
|
|
3598
3681
|
* Diagnostics-channel-based Google GenAI integration. Subscribes to the
|
|
3599
3682
|
* `orchestrion:@google/genai:*` diagnostics_channels injected into the SDK's `Models`
|
|
3600
|
-
* (`generateContent`/`generateContentStream`/`embedContent`)
|
|
3601
|
-
* (`sendMessage`/`sendMessageStream`) methods, so it requires the Sentry
|
|
3602
|
-
* bundler plugin.
|
|
3683
|
+
* (`generateContent`/`generateContentStream`/`embedContent`), `Chat`
|
|
3684
|
+
* (`sendMessage`/`sendMessageStream`) and decisions (`create`) methods, so it requires the Sentry
|
|
3685
|
+
* runtime hook or bundler plugin.
|
|
3603
3686
|
*/
|
|
3604
3687
|
const googleGenAIIntegration = (0, _sentry_core.defineIntegration)(_googleGenAIIntegration);
|
|
3605
3688
|
// src/integrations/graphql/constants.ts
|
|
@@ -7116,9 +7199,10 @@ const _mistralAIIntegration = ((options = {}) => {
|
|
|
7116
7199
|
function instrumentMistral(options) {
|
|
7117
7200
|
for (const { channel, operation, streaming } of INSTRUMENTED_CHANNELS$1) bindTracingChannelToSpan(tracingChannel(channel), (data) => createGenAiSpan$1(data, operation, streaming, options), {
|
|
7118
7201
|
beforeSpanEnd: (span, data) => {
|
|
7202
|
+
if ("error" in data) require_exports.markCancelledIfAborted(span, require_exports.getMistralRequestSignal(data.arguments?.[1]));
|
|
7119
7203
|
require_exports.addResponseAttributes$1(span, data.result, require_exports.resolveAIRecordingOptions(options).recordOutputs);
|
|
7120
7204
|
},
|
|
7121
|
-
deferSpanEnd: ({ span, data }) => streaming && require_exports.instrumentEventStream(data.result, span, require_exports.resolveAIRecordingOptions(options).recordOutputs)
|
|
7205
|
+
deferSpanEnd: ({ span, data }) => streaming && require_exports.instrumentEventStream(data.result, span, require_exports.resolveAIRecordingOptions(options).recordOutputs, require_exports.getMistralRequestSignal(data.arguments?.[1]))
|
|
7122
7206
|
});
|
|
7123
7207
|
}
|
|
7124
7208
|
/**
|
|
@@ -8144,6 +8228,8 @@ function getProviderMetadataAttributes(providerMetadata) {
|
|
|
8144
8228
|
setAttributeIfDefined(attributes, _sentry_conventions_attributes.GEN_AI_USAGE_TOTAL_TOKENS, googleUsage.totalTokenCount);
|
|
8145
8229
|
setAttributeIfDefined(attributes, _sentry_conventions_attributes.GEN_AI_USAGE_REASONING_OUTPUT_TOKENS, googleUsage.thoughtsTokenCount);
|
|
8146
8230
|
}
|
|
8231
|
+
const gatewayCost = Number(metadata.gateway?.cost);
|
|
8232
|
+
if (metadata.gateway?.cost != null && Number.isFinite(gatewayCost)) attributes[_sentry_conventions_attributes.GEN_AI_COST_TOTAL_TOKENS] = gatewayCost;
|
|
8147
8233
|
return attributes;
|
|
8148
8234
|
}
|
|
8149
8235
|
/**
|
|
@@ -8288,6 +8374,13 @@ const ROOT_OPERATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
8288
8374
|
"embedMany",
|
|
8289
8375
|
"rerank"
|
|
8290
8376
|
]);
|
|
8377
|
+
const PARTIAL_COST_OPERATION_TYPES = /* @__PURE__ */ new Set([
|
|
8378
|
+
"generateText",
|
|
8379
|
+
"streamText",
|
|
8380
|
+
"streamObject",
|
|
8381
|
+
"generateObject",
|
|
8382
|
+
"embedMany"
|
|
8383
|
+
]);
|
|
8291
8384
|
/** Drop the per-operation `callId` maps once the owning top-level operation settles (success or error). */
|
|
8292
8385
|
function clearOperationId(data) {
|
|
8293
8386
|
if (!ROOT_OPERATION_TYPES.has(data.type)) return;
|
|
@@ -8338,6 +8431,7 @@ function dropLastStepOnlyUsage(providerAttributes, type) {
|
|
|
8338
8431
|
const hasRecomputedOutput = _sentry_conventions_attributes.GEN_AI_USAGE_OUTPUT_TOKENS in providerAttributes;
|
|
8339
8432
|
for (const key of LAST_STEP_ONLY_USAGE_KEYS) delete providerAttributes[key];
|
|
8340
8433
|
if (hasRecomputedOutput) delete providerAttributes[_sentry_conventions_attributes.GEN_AI_USAGE_REASONING_OUTPUT_TOKENS];
|
|
8434
|
+
if (PARTIAL_COST_OPERATION_TYPES.has(type)) delete providerAttributes[_sentry_conventions_attributes.GEN_AI_COST_TOTAL_TOKENS];
|
|
8341
8435
|
}
|
|
8342
8436
|
/** Record tool name → description from an event's `tools`, so tool spans can backfill the description. */
|
|
8343
8437
|
function recordToolDescriptions(callId, tools) {
|
|
@@ -10316,8 +10410,10 @@ function getErrorIntegrations() {
|
|
|
10316
10410
|
*/
|
|
10317
10411
|
const attachHapiErrorHandler = attachHapiErrorHandler$1;
|
|
10318
10412
|
exports.SentryMastraExporter = require_exports.SentryMastraExporter;
|
|
10413
|
+
exports._INTERNAL_cronExpressionToMonitorConfig = cronExpressionToMonitorConfig;
|
|
10319
10414
|
exports._INTERNAL_instrumentTunnelServer = instrumentTunnelServer;
|
|
10320
10415
|
exports._INTERNAL_instrumentTunnelServers = instrumentTunnelServers;
|
|
10416
|
+
exports._INTERNAL_isReadAlikeByNodeCron3 = isReadAlikeByNodeCron3;
|
|
10321
10417
|
exports.amqplibIntegration = amqplibIntegration;
|
|
10322
10418
|
exports.anthropicAIIntegration = anthropicAIIntegration;
|
|
10323
10419
|
exports.applyHonoPatches = require_exports.applyHonoPatches;
|