@sentry/core
Advanced tools
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const SPAN_KIND = { | ||
| INTERNAL: 0, | ||
| SERVER: 1, | ||
| CLIENT: 2, | ||
| PRODUCER: 3, | ||
| CONSUMER: 4 | ||
| }; | ||
| exports.SPAN_KIND = SPAN_KIND; | ||
| //# sourceMappingURL=spanKind.js.map |
| {"version":3,"file":"spanKind.js","sources":["../../src/spanKind.ts"],"sourcesContent":["/**\n * The kind of a span, mirroring OpenTelemetry's `SpanKind` enum values.\n *\n * Exported as a plain const object so SDK code can set a span's kind without\n * importing `@opentelemetry/api` just for the enum. The numeric values must\n * stay in sync with OpenTelemetry's `SpanKind` since they are passed through to\n * the underlying OTel span and sampler.\n */\nexport const SPAN_KIND = {\n INTERNAL: 0,\n SERVER: 1,\n CLIENT: 2,\n PRODUCER: 3,\n CONSUMER: 4,\n} as const;\n\nexport type SpanKindValue = (typeof SPAN_KIND)[keyof typeof SPAN_KIND];\n"],"names":[],"mappings":";;AAQO,MAAM,SAAA,GAAY;AAAA,EACvB,QAAA,EAAU,CAAA;AAAA,EACV,MAAA,EAAQ,CAAA;AAAA,EACR,MAAA,EAAQ,CAAA;AAAA,EACR,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU;AACZ;;;;"} |
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const MAX_SUMMARY_LENGTH = 255; | ||
| const TABLE_NAME_CHARS = /[^\s(,;)]+/; | ||
| const TABLE_NAME = TABLE_NAME_CHARS.source; | ||
| const DDL_RE = new RegExp( | ||
| `^\\s*(?<operation>(?:CREATE|DROP)\\s+(?:TABLE|INDEX)|ALTER\\s+TABLE)(?:\\s+IF\\s+(?:NOT\\s+)?EXISTS)?\\s+(?<table>${TABLE_NAME})`, | ||
| "i" | ||
| ); | ||
| const INSERT_RE = new RegExp(`^\\s*(?<operation>INSERT)\\s+INTO\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const UPDATE_RE = new RegExp(`^\\s*(?<operation>UPDATE)\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const DELETE_RE = new RegExp(`^\\s*(?<operation>DELETE)\\s+FROM\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const SELECT_RE = /^\s*\(?\s*(?<operation>SELECT)\b/i; | ||
| const PRAGMA_RE = /^\s*(?<operation>PRAGMA)\s+(?<command>\S+)/i; | ||
| const TOKEN_RE = /\b(?:FROM|JOIN)\s+|\(\s*(SELECT)\b|\b(?:UNION|INTERSECT|EXCEPT|MINUS)\s+(?:ALL\s+)?(SELECT)\b/gi; | ||
| const QUOTED_OR_PLAIN_TABLE_RE = /^(?:"[^"]*"|'[^']*'|[^\s(,;)]+)/; | ||
| const COMMA_TABLE_RE = /^\s*,\s*((?:"[^"]*"|'[^']*'|[^\s(,;)]+))/; | ||
| const SUBQUERY_SELECT_RE = /^\(\s*(SELECT)\b/i; | ||
| function getSqlQuerySummary(query) { | ||
| if (!query) { | ||
| return void 0; | ||
| } | ||
| const pragmaMatch = PRAGMA_RE.exec(query); | ||
| if (pragmaMatch?.groups?.["operation"] && pragmaMatch.groups["command"]) { | ||
| const operation = pragmaMatch.groups["operation"]; | ||
| const command = pragmaMatch.groups["command"]; | ||
| const parenIdx = command.indexOf("("); | ||
| return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`); | ||
| } | ||
| const ddlMatch = DDL_RE.exec(query); | ||
| if (ddlMatch?.groups?.["operation"] && ddlMatch.groups["table"]) { | ||
| return truncate(`${ddlMatch.groups["operation"]} ${ddlMatch.groups["table"]}`); | ||
| } | ||
| const insertMatch = INSERT_RE.exec(query); | ||
| if (insertMatch?.groups?.["operation"] && insertMatch.groups["table"]) { | ||
| const parts = [insertMatch.groups["operation"], insertMatch.groups["table"]]; | ||
| const rest = query.slice(insertMatch[0].length); | ||
| const subSelect = /\b(SELECT)\b/i.exec(rest); | ||
| if (subSelect?.[1]) { | ||
| parts.push(subSelect[1]); | ||
| const selectTables = extractTableNames(rest.slice(subSelect.index)); | ||
| parts.push(...selectTables); | ||
| } | ||
| return truncate(parts.join(" ")); | ||
| } | ||
| const updateMatch = UPDATE_RE.exec(query); | ||
| if (updateMatch?.groups?.["operation"] && updateMatch.groups["table"]) { | ||
| return truncate(`${updateMatch.groups["operation"]} ${updateMatch.groups["table"]}`); | ||
| } | ||
| const deleteMatch = DELETE_RE.exec(query); | ||
| if (deleteMatch?.groups?.["operation"] && deleteMatch.groups["table"]) { | ||
| return truncate(`${deleteMatch.groups["operation"]} ${deleteMatch.groups["table"]}`); | ||
| } | ||
| const selectMatch = SELECT_RE.exec(query); | ||
| if (selectMatch?.groups?.["operation"]) { | ||
| const tables = extractTableNames(query.slice(selectMatch[0].length)); | ||
| if (tables.length > 0) { | ||
| return truncate(`${selectMatch.groups["operation"]} ${tables.join(" ")}`); | ||
| } | ||
| return selectMatch.groups["operation"]; | ||
| } | ||
| return truncate(query.trim().split(/\s+/)[0] ?? query); | ||
| } | ||
| function extractTableNames(sql) { | ||
| const tables = []; | ||
| TOKEN_RE.lastIndex = 0; | ||
| let match; | ||
| while ((match = TOKEN_RE.exec(sql)) !== null) { | ||
| if (match[1] || match[2]) { | ||
| tables.push(match[1] || match[2]); | ||
| continue; | ||
| } | ||
| const rest = sql.slice(match.index + match[0].length); | ||
| const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest); | ||
| if (subqueryMatch?.[1]) { | ||
| tables.push(subqueryMatch[1]); | ||
| TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length; | ||
| continue; | ||
| } | ||
| const tableMatch = QUOTED_OR_PLAIN_TABLE_RE.exec(rest); | ||
| if (!tableMatch) continue; | ||
| tables.push(tableMatch[0]); | ||
| let afterTable = rest.slice(tableMatch[0].length); | ||
| let commaMatch; | ||
| while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) { | ||
| if (!commaMatch[1]) break; | ||
| tables.push(commaMatch[1]); | ||
| afterTable = afterTable.slice(commaMatch[0].length); | ||
| } | ||
| } | ||
| return tables; | ||
| } | ||
| function truncate(summary) { | ||
| if (summary.length <= MAX_SUMMARY_LENGTH) { | ||
| return summary; | ||
| } | ||
| const truncated = summary.substring(0, MAX_SUMMARY_LENGTH); | ||
| const lastSpace = truncated.lastIndexOf(" "); | ||
| return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated; | ||
| } | ||
| exports.getSqlQuerySummary = getSqlQuerySummary; | ||
| //# sourceMappingURL=sql.js.map |
| {"version":3,"file":"sql.js","sources":["../../../src/utils/sql.ts"],"sourcesContent":["const MAX_SUMMARY_LENGTH = 255;\n\nconst TABLE_NAME_CHARS = /[^\\s(,;)]+/;\nconst TABLE_NAME = TABLE_NAME_CHARS.source;\n\nconst DDL_RE = new RegExp(\n `^\\\\s*(?<operation>(?:CREATE|DROP)\\\\s+(?:TABLE|INDEX)|ALTER\\\\s+TABLE)(?:\\\\s+IF\\\\s+(?:NOT\\\\s+)?EXISTS)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\n\nconst INSERT_RE = new RegExp(`^\\\\s*(?<operation>INSERT)\\\\s+INTO\\\\s+(?<table>${TABLE_NAME})`, 'i');\nconst UPDATE_RE = new RegExp(`^\\\\s*(?<operation>UPDATE)\\\\s+(?<table>${TABLE_NAME})`, 'i');\nconst DELETE_RE = new RegExp(`^\\\\s*(?<operation>DELETE)\\\\s+FROM\\\\s+(?<table>${TABLE_NAME})`, 'i');\n\nconst SELECT_RE = /^\\s*\\(?\\s*(?<operation>SELECT)\\b/i;\n\nconst PRAGMA_RE = /^\\s*(?<operation>PRAGMA)\\s+(?<command>\\S+)/i;\n\nconst TOKEN_RE = /\\b(?:FROM|JOIN)\\s+|\\(\\s*(SELECT)\\b|\\b(?:UNION|INTERSECT|EXCEPT|MINUS)\\s+(?:ALL\\s+)?(SELECT)\\b/gi;\nconst QUOTED_OR_PLAIN_TABLE_RE = /^(?:\"[^\"]*\"|'[^']*'|[^\\s(,;)]+)/;\nconst COMMA_TABLE_RE = /^\\s*,\\s*((?:\"[^\"]*\"|'[^']*'|[^\\s(,;)]+))/;\nconst SUBQUERY_SELECT_RE = /^\\(\\s*(SELECT)\\b/i;\n\n/**\n * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`.\n *\n * Conforms to the OTEL semantic convention for generating query summaries:\n * - Preserves original case of operations and identifiers (no normalization)\n * - Uses format: `{operation} {target1} {target2} ...`\n * - Strips filler words (INTO, FROM) from the operation\n * - Captures multiple table targets (JOINs)\n * - Handles INSERT...SELECT with both targets\n * - Truncates to 255 characters without splitting mid-value\n *\n * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query\n */\nexport function getSqlQuerySummary(query: string | undefined): string | undefined {\n if (!query) {\n return undefined;\n }\n\n const pragmaMatch = PRAGMA_RE.exec(query);\n if (pragmaMatch?.groups?.['operation'] && pragmaMatch.groups['command']) {\n const operation = pragmaMatch.groups['operation'];\n const command = pragmaMatch.groups['command'];\n const parenIdx = command.indexOf('(');\n return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`);\n }\n\n const ddlMatch = DDL_RE.exec(query);\n if (ddlMatch?.groups?.['operation'] && ddlMatch.groups['table']) {\n return truncate(`${ddlMatch.groups['operation']} ${ddlMatch.groups['table']}`);\n }\n\n const insertMatch = INSERT_RE.exec(query);\n if (insertMatch?.groups?.['operation'] && insertMatch.groups['table']) {\n const parts = [insertMatch.groups['operation'], insertMatch.groups['table']];\n const rest = query.slice(insertMatch[0].length);\n const subSelect = /\\b(SELECT)\\b/i.exec(rest);\n if (subSelect?.[1]) {\n parts.push(subSelect[1]);\n const selectTables = extractTableNames(rest.slice(subSelect.index));\n parts.push(...selectTables);\n }\n return truncate(parts.join(' '));\n }\n\n const updateMatch = UPDATE_RE.exec(query);\n if (updateMatch?.groups?.['operation'] && updateMatch.groups['table']) {\n return truncate(`${updateMatch.groups['operation']} ${updateMatch.groups['table']}`);\n }\n\n const deleteMatch = DELETE_RE.exec(query);\n if (deleteMatch?.groups?.['operation'] && deleteMatch.groups['table']) {\n return truncate(`${deleteMatch.groups['operation']} ${deleteMatch.groups['table']}`);\n }\n\n const selectMatch = SELECT_RE.exec(query);\n if (selectMatch?.groups?.['operation']) {\n const tables = extractTableNames(query.slice(selectMatch[0].length));\n if (tables.length > 0) {\n return truncate(`${selectMatch.groups['operation']} ${tables.join(' ')}`);\n }\n return selectMatch.groups['operation'];\n }\n\n return truncate(query.trim().split(/\\s+/)[0] ?? query);\n}\n\nfunction extractTableNames(sql: string): string[] {\n const tables: string[] = [];\n TOKEN_RE.lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = TOKEN_RE.exec(sql)) !== null) {\n if (match[1] || match[2]) {\n tables.push((match[1] || match[2])!);\n continue;\n }\n\n const rest = sql.slice(match.index + match[0].length);\n\n const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest);\n if (subqueryMatch?.[1]) {\n tables.push(subqueryMatch[1]);\n TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length;\n continue;\n }\n\n const tableMatch = QUOTED_OR_PLAIN_TABLE_RE.exec(rest);\n if (!tableMatch) continue;\n tables.push(tableMatch[0]);\n\n let afterTable = rest.slice(tableMatch[0].length);\n let commaMatch: RegExpExecArray | null;\n while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) {\n if (!commaMatch[1]) break;\n tables.push(commaMatch[1]);\n afterTable = afterTable.slice(commaMatch[0].length);\n }\n }\n\n return tables;\n}\n\nfunction truncate(summary: string): string {\n if (summary.length <= MAX_SUMMARY_LENGTH) {\n return summary;\n }\n const truncated = summary.substring(0, MAX_SUMMARY_LENGTH);\n const lastSpace = truncated.lastIndexOf(' ');\n return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated;\n}\n"],"names":[],"mappings":";;AAAA,MAAM,kBAAA,GAAqB,GAAA;AAE3B,MAAM,gBAAA,GAAmB,YAAA;AACzB,MAAM,aAAa,gBAAA,CAAi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UAAA,CAAW,KAAA,CAAM,UAAA,CAAW,CAAC,EAAE,MAAM,CAAA;AAAA,IACpD;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,SAAS,OAAA,EAAyB;AACzC,EAAA,IAAI,OAAA,CAAQ,UAAU,kBAAA,EAAoB;AACxC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,SAAA,CAAU,CAAA,EAAG,kBAAkB,CAAA;AACzD,EAAA,MAAM,SAAA,GAAY,SAAA,CAAU,WAAA,CAAY,GAAG,CAAA;AAC3C,EAAA,OAAO,YAAY,CAAA,GAAI,SAAA,CAAU,SAAA,CAAU,CAAA,EAAG,SAAS,CAAA,GAAI,SAAA;AAC7D;;;;"} |
| const SPAN_KIND = { | ||
| INTERNAL: 0, | ||
| SERVER: 1, | ||
| CLIENT: 2, | ||
| PRODUCER: 3, | ||
| CONSUMER: 4 | ||
| }; | ||
| export { SPAN_KIND }; | ||
| //# sourceMappingURL=spanKind.js.map |
| {"version":3,"file":"spanKind.js","sources":["../../src/spanKind.ts"],"sourcesContent":["/**\n * The kind of a span, mirroring OpenTelemetry's `SpanKind` enum values.\n *\n * Exported as a plain const object so SDK code can set a span's kind without\n * importing `@opentelemetry/api` just for the enum. The numeric values must\n * stay in sync with OpenTelemetry's `SpanKind` since they are passed through to\n * the underlying OTel span and sampler.\n */\nexport const SPAN_KIND = {\n INTERNAL: 0,\n SERVER: 1,\n CLIENT: 2,\n PRODUCER: 3,\n CONSUMER: 4,\n} as const;\n\nexport type SpanKindValue = (typeof SPAN_KIND)[keyof typeof SPAN_KIND];\n"],"names":[],"mappings":"AAQO,MAAM,SAAA,GAAY;AAAA,EACvB,QAAA,EAAU,CAAA;AAAA,EACV,MAAA,EAAQ,CAAA;AAAA,EACR,MAAA,EAAQ,CAAA;AAAA,EACR,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU;AACZ;;;;"} |
| const MAX_SUMMARY_LENGTH = 255; | ||
| const TABLE_NAME_CHARS = /[^\s(,;)]+/; | ||
| const TABLE_NAME = TABLE_NAME_CHARS.source; | ||
| const DDL_RE = new RegExp( | ||
| `^\\s*(?<operation>(?:CREATE|DROP)\\s+(?:TABLE|INDEX)|ALTER\\s+TABLE)(?:\\s+IF\\s+(?:NOT\\s+)?EXISTS)?\\s+(?<table>${TABLE_NAME})`, | ||
| "i" | ||
| ); | ||
| const INSERT_RE = new RegExp(`^\\s*(?<operation>INSERT)\\s+INTO\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const UPDATE_RE = new RegExp(`^\\s*(?<operation>UPDATE)\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const DELETE_RE = new RegExp(`^\\s*(?<operation>DELETE)\\s+FROM\\s+(?<table>${TABLE_NAME})`, "i"); | ||
| const SELECT_RE = /^\s*\(?\s*(?<operation>SELECT)\b/i; | ||
| const PRAGMA_RE = /^\s*(?<operation>PRAGMA)\s+(?<command>\S+)/i; | ||
| const TOKEN_RE = /\b(?:FROM|JOIN)\s+|\(\s*(SELECT)\b|\b(?:UNION|INTERSECT|EXCEPT|MINUS)\s+(?:ALL\s+)?(SELECT)\b/gi; | ||
| const QUOTED_OR_PLAIN_TABLE_RE = /^(?:"[^"]*"|'[^']*'|[^\s(,;)]+)/; | ||
| const COMMA_TABLE_RE = /^\s*,\s*((?:"[^"]*"|'[^']*'|[^\s(,;)]+))/; | ||
| const SUBQUERY_SELECT_RE = /^\(\s*(SELECT)\b/i; | ||
| function getSqlQuerySummary(query) { | ||
| if (!query) { | ||
| return void 0; | ||
| } | ||
| const pragmaMatch = PRAGMA_RE.exec(query); | ||
| if (pragmaMatch?.groups?.["operation"] && pragmaMatch.groups["command"]) { | ||
| const operation = pragmaMatch.groups["operation"]; | ||
| const command = pragmaMatch.groups["command"]; | ||
| const parenIdx = command.indexOf("("); | ||
| return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`); | ||
| } | ||
| const ddlMatch = DDL_RE.exec(query); | ||
| if (ddlMatch?.groups?.["operation"] && ddlMatch.groups["table"]) { | ||
| return truncate(`${ddlMatch.groups["operation"]} ${ddlMatch.groups["table"]}`); | ||
| } | ||
| const insertMatch = INSERT_RE.exec(query); | ||
| if (insertMatch?.groups?.["operation"] && insertMatch.groups["table"]) { | ||
| const parts = [insertMatch.groups["operation"], insertMatch.groups["table"]]; | ||
| const rest = query.slice(insertMatch[0].length); | ||
| const subSelect = /\b(SELECT)\b/i.exec(rest); | ||
| if (subSelect?.[1]) { | ||
| parts.push(subSelect[1]); | ||
| const selectTables = extractTableNames(rest.slice(subSelect.index)); | ||
| parts.push(...selectTables); | ||
| } | ||
| return truncate(parts.join(" ")); | ||
| } | ||
| const updateMatch = UPDATE_RE.exec(query); | ||
| if (updateMatch?.groups?.["operation"] && updateMatch.groups["table"]) { | ||
| return truncate(`${updateMatch.groups["operation"]} ${updateMatch.groups["table"]}`); | ||
| } | ||
| const deleteMatch = DELETE_RE.exec(query); | ||
| if (deleteMatch?.groups?.["operation"] && deleteMatch.groups["table"]) { | ||
| return truncate(`${deleteMatch.groups["operation"]} ${deleteMatch.groups["table"]}`); | ||
| } | ||
| const selectMatch = SELECT_RE.exec(query); | ||
| if (selectMatch?.groups?.["operation"]) { | ||
| const tables = extractTableNames(query.slice(selectMatch[0].length)); | ||
| if (tables.length > 0) { | ||
| return truncate(`${selectMatch.groups["operation"]} ${tables.join(" ")}`); | ||
| } | ||
| return selectMatch.groups["operation"]; | ||
| } | ||
| return truncate(query.trim().split(/\s+/)[0] ?? query); | ||
| } | ||
| function extractTableNames(sql) { | ||
| const tables = []; | ||
| TOKEN_RE.lastIndex = 0; | ||
| let match; | ||
| while ((match = TOKEN_RE.exec(sql)) !== null) { | ||
| if (match[1] || match[2]) { | ||
| tables.push(match[1] || match[2]); | ||
| continue; | ||
| } | ||
| const rest = sql.slice(match.index + match[0].length); | ||
| const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest); | ||
| if (subqueryMatch?.[1]) { | ||
| tables.push(subqueryMatch[1]); | ||
| TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length; | ||
| continue; | ||
| } | ||
| const tableMatch = QUOTED_OR_PLAIN_TABLE_RE.exec(rest); | ||
| if (!tableMatch) continue; | ||
| tables.push(tableMatch[0]); | ||
| let afterTable = rest.slice(tableMatch[0].length); | ||
| let commaMatch; | ||
| while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) { | ||
| if (!commaMatch[1]) break; | ||
| tables.push(commaMatch[1]); | ||
| afterTable = afterTable.slice(commaMatch[0].length); | ||
| } | ||
| } | ||
| return tables; | ||
| } | ||
| function truncate(summary) { | ||
| if (summary.length <= MAX_SUMMARY_LENGTH) { | ||
| return summary; | ||
| } | ||
| const truncated = summary.substring(0, MAX_SUMMARY_LENGTH); | ||
| const lastSpace = truncated.lastIndexOf(" "); | ||
| return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated; | ||
| } | ||
| export { getSqlQuerySummary }; | ||
| //# sourceMappingURL=sql.js.map |
| {"version":3,"file":"sql.js","sources":["../../../src/utils/sql.ts"],"sourcesContent":["const MAX_SUMMARY_LENGTH = 255;\n\nconst TABLE_NAME_CHARS = /[^\\s(,;)]+/;\nconst TABLE_NAME = TABLE_NAME_CHARS.source;\n\nconst DDL_RE = new RegExp(\n `^\\\\s*(?<operation>(?:CREATE|DROP)\\\\s+(?:TABLE|INDEX)|ALTER\\\\s+TABLE)(?:\\\\s+IF\\\\s+(?:NOT\\\\s+)?EXISTS)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\n\nconst INSERT_RE = new RegExp(`^\\\\s*(?<operation>INSERT)\\\\s+INTO\\\\s+(?<table>${TABLE_NAME})`, 'i');\nconst UPDATE_RE = new RegExp(`^\\\\s*(?<operation>UPDATE)\\\\s+(?<table>${TABLE_NAME})`, 'i');\nconst DELETE_RE = new RegExp(`^\\\\s*(?<operation>DELETE)\\\\s+FROM\\\\s+(?<table>${TABLE_NAME})`, 'i');\n\nconst SELECT_RE = /^\\s*\\(?\\s*(?<operation>SELECT)\\b/i;\n\nconst PRAGMA_RE = /^\\s*(?<operation>PRAGMA)\\s+(?<command>\\S+)/i;\n\nconst TOKEN_RE = /\\b(?:FROM|JOIN)\\s+|\\(\\s*(SELECT)\\b|\\b(?:UNION|INTERSECT|EXCEPT|MINUS)\\s+(?:ALL\\s+)?(SELECT)\\b/gi;\nconst QUOTED_OR_PLAIN_TABLE_RE = /^(?:\"[^\"]*\"|'[^']*'|[^\\s(,;)]+)/;\nconst COMMA_TABLE_RE = /^\\s*,\\s*((?:\"[^\"]*\"|'[^']*'|[^\\s(,;)]+))/;\nconst SUBQUERY_SELECT_RE = /^\\(\\s*(SELECT)\\b/i;\n\n/**\n * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`.\n *\n * Conforms to the OTEL semantic convention for generating query summaries:\n * - Preserves original case of operations and identifiers (no normalization)\n * - Uses format: `{operation} {target1} {target2} ...`\n * - Strips filler words (INTO, FROM) from the operation\n * - Captures multiple table targets (JOINs)\n * - Handles INSERT...SELECT with both targets\n * - Truncates to 255 characters without splitting mid-value\n *\n * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query\n */\nexport function getSqlQuerySummary(query: string | undefined): string | undefined {\n if (!query) {\n return undefined;\n }\n\n const pragmaMatch = PRAGMA_RE.exec(query);\n if (pragmaMatch?.groups?.['operation'] && pragmaMatch.groups['command']) {\n const operation = pragmaMatch.groups['operation'];\n const command = pragmaMatch.groups['command'];\n const parenIdx = command.indexOf('(');\n return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`);\n }\n\n const ddlMatch = DDL_RE.exec(query);\n if (ddlMatch?.groups?.['operation'] && ddlMatch.groups['table']) {\n return truncate(`${ddlMatch.groups['operation']} ${ddlMatch.groups['table']}`);\n }\n\n const insertMatch = INSERT_RE.exec(query);\n if (insertMatch?.groups?.['operation'] && insertMatch.groups['table']) {\n const parts = [insertMatch.groups['operation'], insertMatch.groups['table']];\n const rest = query.slice(insertMatch[0].length);\n const subSelect = /\\b(SELECT)\\b/i.exec(rest);\n if (subSelect?.[1]) {\n parts.push(subSelect[1]);\n const selectTables = extractTableNames(rest.slice(subSelect.index));\n parts.push(...selectTables);\n }\n return truncate(parts.join(' '));\n }\n\n const updateMatch = UPDATE_RE.exec(query);\n if (updateMatch?.groups?.['operation'] && updateMatch.groups['table']) {\n return truncate(`${updateMatch.groups['operation']} ${updateMatch.groups['table']}`);\n }\n\n const deleteMatch = DELETE_RE.exec(query);\n if (deleteMatch?.groups?.['operation'] && deleteMatch.groups['table']) {\n return truncate(`${deleteMatch.groups['operation']} ${deleteMatch.groups['table']}`);\n }\n\n const selectMatch = SELECT_RE.exec(query);\n if (selectMatch?.groups?.['operation']) {\n const tables = extractTableNames(query.slice(selectMatch[0].length));\n if (tables.length > 0) {\n return truncate(`${selectMatch.groups['operation']} ${tables.join(' ')}`);\n }\n return selectMatch.groups['operation'];\n }\n\n return truncate(query.trim().split(/\\s+/)[0] ?? query);\n}\n\nfunction extractTableNames(sql: string): string[] {\n const tables: string[] = [];\n TOKEN_RE.lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = TOKEN_RE.exec(sql)) !== null) {\n if (match[1] || match[2]) {\n tables.push((match[1] || match[2])!);\n continue;\n }\n\n const rest = sql.slice(match.index + match[0].length);\n\n const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest);\n if (subqueryMatch?.[1]) {\n tables.push(subqueryMatch[1]);\n TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length;\n continue;\n }\n\n const tableMatch = QUOTED_OR_PLAIN_TABLE_RE.exec(rest);\n if (!tableMatch) continue;\n tables.push(tableMatch[0]);\n\n let afterTable = rest.slice(tableMatch[0].length);\n let commaMatch: RegExpExecArray | null;\n while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) {\n if (!commaMatch[1]) break;\n tables.push(commaMatch[1]);\n afterTable = afterTable.slice(commaMatch[0].length);\n }\n }\n\n return tables;\n}\n\nfunction truncate(summary: string): string {\n if (summary.length <= MAX_SUMMARY_LENGTH) {\n return summary;\n }\n const truncated = summary.substring(0, MAX_SUMMARY_LENGTH);\n const lastSpace = truncated.lastIndexOf(' ');\n return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated;\n}\n"],"names":[],"mappings":"AAAA,MAAM,kBAAA,GAAqB,GAAA;AAE3B,MAAM,gBAAA,GAAmB,YAAA;AACzB,MAAM,aAAa,gBAAA,CAAiB,MAAA;AAEpC,MAAM,SAAS,IAAI,MAAA;AAAA,EACjB,qHAAqH,UAAU,CAAA,CAAA,CAAA;AAAA,EAC/H;AACF,CAAA;AAEA,MAAM,YAAY,IAAI,MAAA,CAAO,CAAA,8CAAA,EAAiD,UAAU,KAAK,GAAG,CAAA;AAChG,MAAM,YAAY,IAAI,MAAA,CAAO,CAAA,sCAAA,EAAyC,UAAU,KAAK,GAAG,CAAA;AACxF,MAAM,YAAY,IAAI,MAAA,CAAO,CAAA,8CAAA,EAAiD,UAAU,KAAK,GAAG,CAAA;AAEhG,MAAM,SAAA,GAAY,mCAAA;AAElB,MAAM,SAAA,GAAY,6CAAA;AAElB,MAAM,QAAA,GAAW,iGAAA;AACjB,MAAM,wBAAA,GAA2B,iCAAA;AACjC,MAAM,cAAA,GAAiB,0CAAA;AACvB,MAAM,kBAAA,GAAqB,mBAAA;AAepB,SAAS,mBAAmB,KAAA,EAA+C;AAChF,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,GAAc,SAAA,CAAU,IAAA,CAAK,KAAK,CAAA;AACxC,EAAA,IAAI,aAAa,MAAA,GAAS,WAAW,KAAK,WAAA,CAAY,MAAA,CAAO,SAAS,CAAA,EAAG;AACvE,IAAA,MAAM,SAAA,GAAY,WAAA,CAAY,MAAA,CAAO,WAAW,CAAA;AAChD,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C,CAAC,CAAA;AAEzB,IAAA,IAAI,aAAa,IAAA,CAAK,KAAA,CAAM,UAAA,CAAW,CAAC,EAAE,MAAM,CAAA;AAChD,IAAA,IAAI,UAAA;AACJ,IAAA,OAAA,CAAQ,UAAA,GAAa,cAAA,CAAe,IAAA,CAAK,UAAU,OAAO,IAAA,EAAM;AAC9D,MAAA,IAAI,CAAC,UAAA,CAAW,CAAC,CAAA,EAAG;AACpB,MAAA,MAAA,CAAO,IAAA,CAAK,UAAA,CAAW,CAAC,CAAC,CAAA;AACzB,MAAA,UAAA,GAAa,UAAA,CAAW,KAAA,CAAM,UAAA,CAAW,CAAC,EAAE,MAAM,CAAA;AAAA,IACpD;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,SAAS,OAAA,EAAyB;AACzC,EAAA,IAAI,OAAA,CAAQ,UAAU,kBAAA,EAAoB;AACxC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,SAAA,CAAU,CAAA,EAAG,kBAAkB,CAAA;AACzD,EAAA,MAAM,SAAA,GAAY,SAAA,CAAU,WAAA,CAAY,GAAG,CAAA;AAC3C,EAAA,OAAO,YAAY,CAAA,GAAI,SAAA,CAAU,SAAA,CAAU,CAAA,EAAG,SAAS,CAAA,GAAI,SAAA;AAC7D;;;;"} |
| /** | ||
| * The kind of a span, mirroring OpenTelemetry's `SpanKind` enum values. | ||
| * | ||
| * Exported as a plain const object so SDK code can set a span's kind without | ||
| * importing `@opentelemetry/api` just for the enum. The numeric values must | ||
| * stay in sync with OpenTelemetry's `SpanKind` since they are passed through to | ||
| * the underlying OTel span and sampler. | ||
| */ | ||
| export declare const SPAN_KIND: { | ||
| readonly INTERNAL: 0; | ||
| readonly SERVER: 1; | ||
| readonly CLIENT: 2; | ||
| readonly PRODUCER: 3; | ||
| readonly CONSUMER: 4; | ||
| }; | ||
| export type SpanKindValue = (typeof SPAN_KIND)[keyof typeof SPAN_KIND]; | ||
| //# sourceMappingURL=spanKind.d.ts.map |
| /** | ||
| * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`. | ||
| * | ||
| * Conforms to the OTEL semantic convention for generating query summaries: | ||
| * - Preserves original case of operations and identifiers (no normalization) | ||
| * - Uses format: `{operation} {target1} {target2} ...` | ||
| * - Strips filler words (INTO, FROM) from the operation | ||
| * - Captures multiple table targets (JOINs) | ||
| * - Handles INSERT...SELECT with both targets | ||
| * - Truncates to 255 characters without splitting mid-value | ||
| * | ||
| * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query | ||
| */ | ||
| export declare function getSqlQuerySummary(query: string | undefined): string | undefined; | ||
| //# sourceMappingURL=sql.d.ts.map |
| /** | ||
| * The kind of a span, mirroring OpenTelemetry's `SpanKind` enum values. | ||
| * | ||
| * Exported as a plain const object so SDK code can set a span's kind without | ||
| * importing `@opentelemetry/api` just for the enum. The numeric values must | ||
| * stay in sync with OpenTelemetry's `SpanKind` since they are passed through to | ||
| * the underlying OTel span and sampler. | ||
| */ | ||
| export declare const SPAN_KIND: { | ||
| readonly INTERNAL: 0; | ||
| readonly SERVER: 1; | ||
| readonly CLIENT: 2; | ||
| readonly PRODUCER: 3; | ||
| readonly CONSUMER: 4; | ||
| }; | ||
| export type SpanKindValue = (typeof SPAN_KIND)[keyof typeof SPAN_KIND]; | ||
| //# sourceMappingURL=spanKind.d.ts.map |
| {"version":3,"file":"spanKind.d.ts","sourceRoot":"","sources":["../../src/spanKind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"} |
| /** | ||
| * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`. | ||
| * | ||
| * Conforms to the OTEL semantic convention for generating query summaries: | ||
| * - Preserves original case of operations and identifiers (no normalization) | ||
| * - Uses format: `{operation} {target1} {target2} ...` | ||
| * - Strips filler words (INTO, FROM) from the operation | ||
| * - Captures multiple table targets (JOINs) | ||
| * - Handles INSERT...SELECT with both targets | ||
| * - Truncates to 255 characters without splitting mid-value | ||
| * | ||
| * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query | ||
| */ | ||
| export declare function getSqlQuerySummary(query: string | undefined): string | undefined; | ||
| //# sourceMappingURL=sql.d.ts.map |
| {"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../../src/utils/sql.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAmDhF"} |
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const carrier = require('../carrier.js'); | ||
| const spanOnScope = require('../utils/spanOnScope.js'); | ||
| const stackStrategy = require('./stackStrategy.js'); | ||
@@ -18,5 +19,21 @@ | ||
| } | ||
| function getTracingChannelBinding() { | ||
| return getAsyncContextStrategy(carrier.getMainCarrier()).getTracingChannelBinding?.(); | ||
| } | ||
| function _INTERNAL_createTracingChannelBinding(asyncLocalStorage, getScopes) { | ||
| return { | ||
| asyncLocalStorage, | ||
| getStoreWithActiveSpan: (span) => { | ||
| const { scope, isolationScope } = getScopes(); | ||
| const activeScope = scope.clone(); | ||
| spanOnScope._setSpanForScope(activeScope, span); | ||
| return { scope: activeScope, isolationScope }; | ||
| } | ||
| }; | ||
| } | ||
| exports._INTERNAL_createTracingChannelBinding = _INTERNAL_createTracingChannelBinding; | ||
| exports.getAsyncContextStrategy = getAsyncContextStrategy; | ||
| exports.getTracingChannelBinding = getTracingChannelBinding; | ||
| exports.setAsyncContextStrategy = setAsyncContextStrategy; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../../src/asyncContext/index.ts"],"sourcesContent":["import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n"],"names":["getMainCarrier","getSentryCarrier","carrier","getStackAsyncContextStrategy"],"mappings":";;;;;AAUO,SAAS,wBAAwB,QAAA,EAAkD;AAExF,EAAA,MAAM,WAAWA,sBAAA,EAAe;AAChC,EAAA,MAAM,MAAA,GAASC,yBAAiB,QAAQ,CAAA;AACxC,EAAA,MAAA,CAAO,GAAA,GAAM,QAAA;AACf;AAMO,SAAS,wBAAwBC,SAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAASD,yBAAiBC,SAAO,CAAA;AAEvC,EAAA,IAAI,OAAO,GAAA,EAAK;AACd,IAAA,OAAO,MAAA,CAAO,GAAA;AAAA,EAChB;AAGA,EAAA,OAAOC,0CAAA,EAA6B;AACtC;;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../../src/asyncContext/index.ts"],"sourcesContent":["import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport type { Scope } from './../scope';\nimport { _setSpanForScope } from './../utils/spanOnScope';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy, TracingChannelBinding } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n\n/**\n * Get the runtime binding needed to connect tracing channels to async context.\n */\nexport function getTracingChannelBinding(): TracingChannelBinding | undefined {\n return getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n}\n\n/**\n * Build the default {@link TracingChannelBinding} shared by AsyncLocalStorage-based strategies.\n *\n * The ALS instance is supplied by the caller (kept as `unknown`).\n * The binding clones the current scope, plants the span on it, and reuses the existing isolation scope.\n *\n * The OpenTelemetry strategy does not use this: its store value is an OTel context, not a\n * `{ scope, isolationScope }` pair.\n */\nexport function _INTERNAL_createTracingChannelBinding(\n asyncLocalStorage: unknown,\n getScopes: () => { scope: Scope; isolationScope: Scope },\n): TracingChannelBinding {\n return {\n asyncLocalStorage,\n getStoreWithActiveSpan: span => {\n const { scope, isolationScope } = getScopes();\n const activeScope = scope.clone();\n _setSpanForScope(activeScope, span);\n\n return { scope: activeScope, isolationScope };\n },\n };\n}\n"],"names":["getMainCarrier","getSentryCarrier","carrier","getStackAsyncContextStrategy","_setSpanForScope"],"mappings":";;;;;;AAYO,SAAS,wBAAwB,QAAA,EAAkD;AAExF,EAAA,MAAM,WAAWA,sBAAA,EAAe;AAChC,EAAA,MAAM,MAAA,GAASC,yBAAiB,QAAQ,CAAA;AACxC,EAAA,MAAA,CAAO,GAAA,GAAM,QAAA;AACf;AAMO,SAAS,wBAAwBC,SAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAASD,yBAAiBC,SAAO,CAAA;AAEvC,EAAA,IAAI,OAAO,GAAA,EAAK;AACd,IAAA,OAAO,MAAA,CAAO,GAAA;AAAA,EAChB;AAGA,EAAA,OAAOC,0CAAA,EAA6B;AACtC;AAKO,SAAS,wBAAA,GAA8D;AAC5E,EAAA,OAAO,uBAAA,CAAwBH,sBAAA,EAAgB,CAAA,CAAE,wBAAA,IAA2B;AAC9E;AAWO,SAAS,qCAAA,CACd,mBACA,SAAA,EACuB;AACvB,EAAA,OAAO;AAAA,IACL,iBAAA;AAAA,IACA,wBAAwB,CAAA,IAAA,KAAQ;AAC9B,MAAA,MAAM,EAAE,KAAA,EAAO,cAAA,EAAe,GAAI,SAAA,EAAU;AAC5C,MAAA,MAAM,WAAA,GAAc,MAAM,KAAA,EAAM;AAChC,MAAAI,4BAAA,CAAiB,aAAa,IAAI,CAAA;AAElC,MAAA,OAAO,EAAE,KAAA,EAAO,WAAA,EAAa,cAAA,EAAe;AAAA,IAC9C;AAAA,GACF;AACF;;;;;;;"} |
+22
-16
@@ -21,3 +21,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const defaultScopes = require('./defaultScopes.js'); | ||
| const index$6 = require('./asyncContext/index.js'); | ||
| const index = require('./asyncContext/index.js'); | ||
| const carrier = require('./carrier.js'); | ||
@@ -61,2 +61,3 @@ const session = require('./session.js'); | ||
| const constants$1 = require('./constants.js'); | ||
| const spanKind = require('./spanKind.js'); | ||
| const breadcrumbs = require('./breadcrumbs.js'); | ||
@@ -88,15 +89,15 @@ const functiontostring = require('./integrations/functiontostring.js'); | ||
| const consola = require('./integrations/consola.js'); | ||
| const index = require('./tracing/vercel-ai/index.js'); | ||
| const index$1 = require('./tracing/vercel-ai/index.js'); | ||
| const utils = require('./tracing/vercel-ai/utils.js'); | ||
| const constants$6 = require('./tracing/vercel-ai/constants.js'); | ||
| const index$5 = require('./tracing/openai/index.js'); | ||
| const index$6 = require('./tracing/openai/index.js'); | ||
| const constants$5 = require('./tracing/openai/constants.js'); | ||
| const index$2 = require('./tracing/anthropic-ai/index.js'); | ||
| const index$3 = require('./tracing/anthropic-ai/index.js'); | ||
| const constants = require('./tracing/anthropic-ai/constants.js'); | ||
| const index$4 = require('./tracing/google-genai/index.js'); | ||
| const index$5 = require('./tracing/google-genai/index.js'); | ||
| const constants$2 = require('./tracing/google-genai/constants.js'); | ||
| const index$1 = require('./tracing/langchain/index.js'); | ||
| const index$2 = require('./tracing/langchain/index.js'); | ||
| const utils$1 = require('./tracing/langchain/utils.js'); | ||
| const constants$3 = require('./tracing/langchain/constants.js'); | ||
| const index$3 = require('./tracing/langgraph/index.js'); | ||
| const index$4 = require('./tracing/langgraph/index.js'); | ||
| const constants$4 = require('./tracing/langgraph/constants.js'); | ||
@@ -231,2 +232,4 @@ const spanBuffer = require('./tracing/spans/spanBuffer.js'); | ||
| exports.lastEventId = exports$1.lastEventId; | ||
| exports.setAttribute = exports$1.setAttribute; | ||
| exports.setAttributes = exports$1.setAttributes; | ||
| exports.setContext = exports$1.setContext; | ||
@@ -253,3 +256,5 @@ exports.setConversationId = exports$1.setConversationId; | ||
| exports.getDefaultIsolationScope = defaultScopes.getDefaultIsolationScope; | ||
| exports.setAsyncContextStrategy = index$6.setAsyncContextStrategy; | ||
| exports._INTERNAL_createTracingChannelBinding = index._INTERNAL_createTracingChannelBinding; | ||
| exports._INTERNAL_getTracingChannelBinding = index.getTracingChannelBinding; | ||
| exports.setAsyncContextStrategy = index.setAsyncContextStrategy; | ||
| exports.getGlobalSingleton = carrier.getGlobalSingleton; | ||
@@ -333,2 +338,3 @@ exports.getMainCarrier = carrier.getMainCarrier; | ||
| exports.DEV_ENVIRONMENT = constants$1.DEV_ENVIRONMENT; | ||
| exports.SPAN_KIND = spanKind.SPAN_KIND; | ||
| exports.addBreadcrumb = breadcrumbs.addBreadcrumb; | ||
@@ -367,18 +373,18 @@ exports.functionToStringIntegration = functiontostring.functionToStringIntegration; | ||
| exports.createConsolaReporter = consola.createConsolaReporter; | ||
| exports.addVercelAiProcessors = index.addVercelAiProcessors; | ||
| exports.addVercelAiProcessors = index$1.addVercelAiProcessors; | ||
| exports._INTERNAL_cleanupToolCallSpanContext = utils._INTERNAL_cleanupToolCallSpanContext; | ||
| exports._INTERNAL_getSpanContextForToolCallId = utils._INTERNAL_getSpanContextForToolCallId; | ||
| exports._INTERNAL_toolCallSpanContextMap = constants$6.toolCallSpanContextMap; | ||
| exports.instrumentOpenAiClient = index$5.instrumentOpenAiClient; | ||
| exports.instrumentOpenAiClient = index$6.instrumentOpenAiClient; | ||
| exports.OPENAI_INTEGRATION_NAME = constants$5.OPENAI_INTEGRATION_NAME; | ||
| exports.instrumentAnthropicAiClient = index$2.instrumentAnthropicAiClient; | ||
| exports.instrumentAnthropicAiClient = index$3.instrumentAnthropicAiClient; | ||
| exports.ANTHROPIC_AI_INTEGRATION_NAME = constants.ANTHROPIC_AI_INTEGRATION_NAME; | ||
| exports.instrumentGoogleGenAIClient = index$4.instrumentGoogleGenAIClient; | ||
| exports.instrumentGoogleGenAIClient = index$5.instrumentGoogleGenAIClient; | ||
| exports.GOOGLE_GENAI_INTEGRATION_NAME = constants$2.GOOGLE_GENAI_INTEGRATION_NAME; | ||
| exports.createLangChainCallbackHandler = index$1.createLangChainCallbackHandler; | ||
| exports.createLangChainCallbackHandler = index$2.createLangChainCallbackHandler; | ||
| exports._INTERNAL_mergeLangChainCallbackHandler = utils$1._INTERNAL_mergeLangChainCallbackHandler; | ||
| exports.LANGCHAIN_INTEGRATION_NAME = constants$3.LANGCHAIN_INTEGRATION_NAME; | ||
| exports.instrumentCreateReactAgent = index$3.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$3.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$3.instrumentStateGraphCompile; | ||
| exports.instrumentCreateReactAgent = index$4.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$4.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$4.instrumentStateGraphCompile; | ||
| exports.LANGGRAPH_INTEGRATION_NAME = constants$4.LANGGRAPH_INTEGRATION_NAME; | ||
@@ -385,0 +391,0 @@ exports.SpanBuffer = spanBuffer.SpanBuffer; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -41,2 +41,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| } | ||
| function setAttributes(attributes) { | ||
| currentScopes.getIsolationScope().setAttributes(attributes); | ||
| } | ||
| function setAttribute(key, value) { | ||
| currentScopes.getIsolationScope().setAttribute(key, value); | ||
| } | ||
| function setUser(user) { | ||
@@ -175,2 +181,4 @@ currentScopes.getIsolationScope().setUser(user); | ||
| exports.lastEventId = lastEventId; | ||
| exports.setAttribute = setAttribute; | ||
| exports.setAttributes = setAttributes; | ||
| exports.setContext = setContext; | ||
@@ -177,0 +185,0 @@ exports.setConversationId = setConversationId; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"exports.js","sources":["../../src/exports.ts"],"sourcesContent":["import { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { CaptureContext } from './scope';\nimport { closeSession, makeSession, updateSession } from './session';\nimport { startNewTrace } from './tracing/trace';\nimport type { CheckIn, FinishedCheckIn, MonitorConfig } from './types/checkin';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { Session, SessionContext } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isThenable } from './utils/is';\nimport { uuid4 } from './utils/misc';\nimport type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { getCombinedScopeData } from './utils/scopeData';\nimport { timestampInSeconds } from './utils/time';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureException(exception: unknown, hint?: ExclusiveEventHintOrCaptureContext): string {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const hint = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, hint);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nexport function captureEvent(event: Event, hint?: EventHint): string {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\nexport function setContext(name: string, context: { [key: string]: unknown } | null): void {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: Primitive }): void {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nexport function setTag(key: string, value: Primitive): void {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n getIsolationScope().setUser(user);\n}\n\n/**\n * Sets the conversation ID for the current isolation scope.\n *\n * @param conversationId The conversation ID to set. Pass `null` or `undefined` to unset the conversation ID.\n */\nexport function setConversationId(conversationId: string | null | undefined): void {\n getIsolationScope().setConversationId(conversationId);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nexport function lastEventId(): string | undefined {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param callback Callback to be monitored\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function withMonitor<T>(\n monitorSlug: CheckIn['monitorSlug'],\n callback: () => T,\n upsertMonitorConfig?: MonitorConfig,\n): T {\n function runCallback(): T {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status: FinishedCheckIn['status']): void {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n // Default behavior without isolateTrace\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n r => {\n finishCheckIn('ok');\n return r;\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n ) as T;\n }\n finishCheckIn('ok');\n\n return maybePromiseResult;\n }\n\n return withIsolationScope(() => (upsertMonitorConfig?.isolateTrace ? startNewTrace(runCallback) : runCallback()));\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function flush(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function close(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nexport function isInitialized(): boolean {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nexport function isEnabled(): boolean {\n const client = getClient();\n return client?.getOptions().enabled !== false && !!client?.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nexport function addEventProcessor(callback: EventProcessor): void {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nexport function startSession(context?: SessionContext): Session {\n const isolationScope = getIsolationScope();\n\n const { user } = getCombinedScopeData(isolationScope, getCurrentScope());\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n user,\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession?.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nexport function endSession(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const isolationScope = getIsolationScope();\n const client = getClient();\n const session = isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nexport function captureSession(end: boolean = false): void {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n"],"names":["getCurrentScope","parseEventHintOrCaptureContext","getIsolationScope","getClient","DEBUG_BUILD","debug","uuid4","timestampInSeconds","isThenable","withIsolationScope","startNewTrace","getCombinedScopeData","GLOBAL_OBJ","session","makeSession","updateSession","closeSession"],"mappings":";;;;;;;;;;;;;;AA6BO,SAAS,gBAAA,CAAiB,WAAoB,IAAA,EAAmD;AACtG,EAAA,OAAOA,+BAAgB,CAAE,gBAAA,CAAiB,SAAA,EAAWC,2CAAA,CAA+B,IAAI,CAAC,CAAA;AAC3F;AASO,SAAS,cAAA,CAAe,SAAiB,cAAA,EAAyD;AAGvG,EAAA,MAAM,KAAA,GAAQ,OAAO,cAAA,KAAmB,QAAA,GAAW,cAAA,GAAiB,MAAA;AACpE,EAAA,MAAM,OAAO,OAAO,cAAA,KAAmB,QAAA,GAAW,EAAE,gBAAe,GAAI,MAAA;AACvE,EAAA,OAAOD,6BAAA,EAAgB,CAAE,cAAA,CAAe,OAAA,EAAS,OAAO,IAAI,CAAA;AAC9D;AASO,SAAS,YAAA,CAAa,OAAc,IAAA,EAA0B;AACnE,EAAA,OAAOA,6BAAA,EAAgB,CAAE,YAAA,CAAa,KAAA,EAAO,IAAI,CAAA;AACnD;AAOO,SAAS,UAAA,CAAW,MAAc,OAAA,EAAkD;AACzF,EAAAE,+BAAA,EAAkB,CAAE,UAAA,CAAW,IAAA,EAAM,OAAO,CAAA;AAC9C;AAMO,SAAS,UAAU,MAAA,EAAsB;AAC9C,EAAAA,+BAAA,EAAkB,CAAE,UAAU,MAAM,CAAA;AACtC;AAOO,SAAS,QAAA,CAAS,KAAa,KAAA,EAAoB;AACxD,EAAAA,+BAAA,EAAkB,CAAE,QAAA,CAAS,GAAA,EAAK,KAAK,CAAA;AACzC;AAMO,SAAS,QAAQ,IAAA,EAA0C;AAChE,EAAAA,+BAAA,EAAkB,CAAE,QAAQ,IAAI,CAAA;AAClC;AAUO,SAAS,MAAA,CAAO,KAAa,KAAA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,CAAA;AAAA,EACtB;AACA,EAAA,kBAAA,EAAmB;AAGnB,EAAA,cAAA,CAAe,UAAA,EAAW;AAC5B;AAKA,SAAS,kBAAA,GAA2B;AAClC,EAAA,MAAM,iBAAiBX,+BAAA,EAAkB;AACzC,EAAA,MAAM,SAASC,uBAAA,EAAU;AACzB,EAAA,MAAM,OAAA,GAAU,eAAe,UAAA,EAAW;AAC1C,EAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,IAAA,MAAA,CAAO,eAAe,OAAO,CAAA;AAAA,EAC/B;AACF;AAQO,SAAS,cAAA,CAAe,MAAe,KAAA,EAAa;AAEzD,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,UAAA,EAAW;AACX,IAAA;AAAA,EACF;AAGA,EAAA,kBAAA,EAAmB;AACrB;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"exports.js","sources":["../../src/exports.ts"],"sourcesContent":["import type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { CaptureContext } from './scope';\nimport { closeSession, makeSession, updateSession } from './session';\nimport { startNewTrace } from './tracing/trace';\nimport type { CheckIn, FinishedCheckIn, MonitorConfig } from './types/checkin';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { Session, SessionContext } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isThenable } from './utils/is';\nimport { uuid4 } from './utils/misc';\nimport type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { getCombinedScopeData } from './utils/scopeData';\nimport { timestampInSeconds } from './utils/time';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureException(exception: unknown, hint?: ExclusiveEventHintOrCaptureContext): string {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const hint = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, hint);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nexport function captureEvent(event: Event, hint?: EventHint): string {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\nexport function setContext(name: string, context: { [key: string]: unknown } | null): void {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: Primitive }): void {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nexport function setTag(key: string, value: Primitive): void {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Sets attributes on the isolation scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param attributes - The attributes to set on the scope, as key-value pairs.\n *\n * @example\n * ```typescript\n * Sentry.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: 150,\n * });\n * ```\n */\nexport function setAttributes<T extends Record<string, unknown>>(attributes: RawAttributes<T>): void {\n getIsolationScope().setAttributes(attributes);\n}\n\n/**\n * Sets an attribute on the isolation scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param key - The attribute key.\n * @param value - The attribute value.\n *\n * @example\n * ```typescript\n * Sentry.setAttribute('is_admin', true);\n * Sentry.setAttribute('render_duration', 150);\n * ```\n */\nexport function setAttribute<\n // oxlint-disable-next-line typescript-eslint/no-explicit-any\n T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown,\n>(key: string, value: RawAttribute<T>): void {\n getIsolationScope().setAttribute(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n getIsolationScope().setUser(user);\n}\n\n/**\n * Sets the conversation ID for the current isolation scope.\n *\n * @param conversationId The conversation ID to set. Pass `null` or `undefined` to unset the conversation ID.\n */\nexport function setConversationId(conversationId: string | null | undefined): void {\n getIsolationScope().setConversationId(conversationId);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nexport function lastEventId(): string | undefined {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param callback Callback to be monitored\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function withMonitor<T>(\n monitorSlug: CheckIn['monitorSlug'],\n callback: () => T,\n upsertMonitorConfig?: MonitorConfig,\n): T {\n function runCallback(): T {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status: FinishedCheckIn['status']): void {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n // Default behavior without isolateTrace\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n r => {\n finishCheckIn('ok');\n return r;\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n ) as T;\n }\n finishCheckIn('ok');\n\n return maybePromiseResult;\n }\n\n return withIsolationScope(() => (upsertMonitorConfig?.isolateTrace ? startNewTrace(runCallback) : runCallback()));\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function flush(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function close(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nexport function isInitialized(): boolean {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nexport function isEnabled(): boolean {\n const client = getClient();\n return client?.getOptions().enabled !== false && !!client?.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nexport function addEventProcessor(callback: EventProcessor): void {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nexport function startSession(context?: SessionContext): Session {\n const isolationScope = getIsolationScope();\n\n const { user } = getCombinedScopeData(isolationScope, getCurrentScope());\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n user,\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession?.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nexport function endSession(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const isolationScope = getIsolationScope();\n const client = getClient();\n const session = isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nexport function captureSession(end: boolean = false): void {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n"],"names":["getCurrentScope","parseEventHintOrCaptureContext","getIsolationScope","getClient","DEBUG_BUILD","debug","uuid4","timestampInSeconds","isThenable","withIsolationScope","startNewTrace","getCombinedScopeData","GLOBAL_OBJ","session","makeSession","updateSession","closeSession"],"mappings":";;;;;;;;;;;;;;AA8BO,SAAS,gBAAA,CAAiB,WAAoB,IAAA,EAAmD;AACtG,EAAA,OAAOA,+BAAgB,CAAE,gBAAA,CAAiB,SAAA,EAAWC,2CAAA,CAA+B,IAAI,CAAC,CAAA;AAC3F;AASO,SAAS,cAAA,CAAe,SAAiB,cAAA,EAAyD;AAGvG,EAAA,MAAM,KAAA,GAAQ,OAAO,cAAA,KAAmB,QAAA,GAAW,cAAA,GAAiB,MAAA;AACpE,EAAA,MAAM,OAAO,OAAO,cAAA,KAAmB,QAAA,GAAW,EAAE,gBAAe,GAAI,MAAA;AACvE,EAAA,OAAOD,6BAAA,EAAgB,CAAE,cAAA,CAAe,OAAA,EAAS,OAAO,IAAI,CAAA;AAC9D;AASO,S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IAAA;AAAA,EACF;AAGA,EAAA,kBAAA,EAAmB;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
+29
-20
@@ -21,3 +21,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const defaultScopes = require('./defaultScopes.js'); | ||
| const index$7 = require('./asyncContext/index.js'); | ||
| const index = require('./asyncContext/index.js'); | ||
| const carrier = require('./carrier.js'); | ||
@@ -61,2 +61,3 @@ const session = require('./session.js'); | ||
| const constants$1 = require('./constants.js'); | ||
| const spanKind = require('./spanKind.js'); | ||
| const breadcrumbs = require('./breadcrumbs.js'); | ||
@@ -88,15 +89,15 @@ const functiontostring = require('./integrations/functiontostring.js'); | ||
| const consola = require('./integrations/consola.js'); | ||
| const index = require('./tracing/vercel-ai/index.js'); | ||
| const index$1 = require('./tracing/vercel-ai/index.js'); | ||
| const utils = require('./tracing/vercel-ai/utils.js'); | ||
| const constants$7 = require('./tracing/vercel-ai/constants.js'); | ||
| const index$6 = require('./tracing/openai/index.js'); | ||
| const index$7 = require('./tracing/openai/index.js'); | ||
| const constants$6 = require('./tracing/openai/constants.js'); | ||
| const index$3 = require('./tracing/anthropic-ai/index.js'); | ||
| const index$4 = require('./tracing/anthropic-ai/index.js'); | ||
| const constants = require('./tracing/anthropic-ai/constants.js'); | ||
| const index$5 = require('./tracing/google-genai/index.js'); | ||
| const index$6 = require('./tracing/google-genai/index.js'); | ||
| const constants$2 = require('./tracing/google-genai/constants.js'); | ||
| const index$1 = require('./tracing/langchain/index.js'); | ||
| const index$2 = require('./tracing/langchain/index.js'); | ||
| const utils$1 = require('./tracing/langchain/utils.js'); | ||
| const constants$4 = require('./tracing/langchain/constants.js'); | ||
| const index$4 = require('./tracing/langgraph/index.js'); | ||
| const index$5 = require('./tracing/langgraph/index.js'); | ||
| const constants$5 = require('./tracing/langgraph/constants.js'); | ||
@@ -157,4 +158,5 @@ const spanBuffer = require('./tracing/spans/spanBuffer.js'); | ||
| const timer = require('./utils/timer.js'); | ||
| const index$2 = require('./integrations/express/index.js'); | ||
| const index$3 = require('./integrations/express/index.js'); | ||
| const postgresjs = require('./integrations/postgresjs.js'); | ||
| const sql = require('./utils/sql.js'); | ||
| const clientPatch = require('./integrations/http/client-patch.js'); | ||
@@ -250,2 +252,4 @@ const clientSubscriptions = require('./integrations/http/client-subscriptions.js'); | ||
| exports.lastEventId = exports$1.lastEventId; | ||
| exports.setAttribute = exports$1.setAttribute; | ||
| exports.setAttributes = exports$1.setAttributes; | ||
| exports.setContext = exports$1.setContext; | ||
@@ -272,3 +276,5 @@ exports.setConversationId = exports$1.setConversationId; | ||
| exports.getDefaultIsolationScope = defaultScopes.getDefaultIsolationScope; | ||
| exports.setAsyncContextStrategy = index$7.setAsyncContextStrategy; | ||
| exports._INTERNAL_createTracingChannelBinding = index._INTERNAL_createTracingChannelBinding; | ||
| exports._INTERNAL_getTracingChannelBinding = index.getTracingChannelBinding; | ||
| exports.setAsyncContextStrategy = index.setAsyncContextStrategy; | ||
| exports.getGlobalSingleton = carrier.getGlobalSingleton; | ||
@@ -352,2 +358,3 @@ exports.getMainCarrier = carrier.getMainCarrier; | ||
| exports.DEV_ENVIRONMENT = constants$1.DEV_ENVIRONMENT; | ||
| exports.SPAN_KIND = spanKind.SPAN_KIND; | ||
| exports.addBreadcrumb = breadcrumbs.addBreadcrumb; | ||
@@ -386,18 +393,18 @@ exports.functionToStringIntegration = functiontostring.functionToStringIntegration; | ||
| exports.createConsolaReporter = consola.createConsolaReporter; | ||
| exports.addVercelAiProcessors = index.addVercelAiProcessors; | ||
| exports.addVercelAiProcessors = index$1.addVercelAiProcessors; | ||
| exports._INTERNAL_cleanupToolCallSpanContext = utils._INTERNAL_cleanupToolCallSpanContext; | ||
| exports._INTERNAL_getSpanContextForToolCallId = utils._INTERNAL_getSpanContextForToolCallId; | ||
| exports._INTERNAL_toolCallSpanContextMap = constants$7.toolCallSpanContextMap; | ||
| exports.instrumentOpenAiClient = index$6.instrumentOpenAiClient; | ||
| exports.instrumentOpenAiClient = index$7.instrumentOpenAiClient; | ||
| exports.OPENAI_INTEGRATION_NAME = constants$6.OPENAI_INTEGRATION_NAME; | ||
| exports.instrumentAnthropicAiClient = index$3.instrumentAnthropicAiClient; | ||
| exports.instrumentAnthropicAiClient = index$4.instrumentAnthropicAiClient; | ||
| exports.ANTHROPIC_AI_INTEGRATION_NAME = constants.ANTHROPIC_AI_INTEGRATION_NAME; | ||
| exports.instrumentGoogleGenAIClient = index$5.instrumentGoogleGenAIClient; | ||
| exports.instrumentGoogleGenAIClient = index$6.instrumentGoogleGenAIClient; | ||
| exports.GOOGLE_GENAI_INTEGRATION_NAME = constants$2.GOOGLE_GENAI_INTEGRATION_NAME; | ||
| exports.createLangChainCallbackHandler = index$1.createLangChainCallbackHandler; | ||
| exports.createLangChainCallbackHandler = index$2.createLangChainCallbackHandler; | ||
| exports._INTERNAL_mergeLangChainCallbackHandler = utils$1._INTERNAL_mergeLangChainCallbackHandler; | ||
| exports.LANGCHAIN_INTEGRATION_NAME = constants$4.LANGCHAIN_INTEGRATION_NAME; | ||
| exports.instrumentCreateReactAgent = index$4.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$4.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$4.instrumentStateGraphCompile; | ||
| exports.instrumentCreateReactAgent = index$5.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$5.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$5.instrumentStateGraphCompile; | ||
| exports.LANGGRAPH_INTEGRATION_NAME = constants$5.LANGGRAPH_INTEGRATION_NAME; | ||
@@ -578,6 +585,8 @@ exports.SpanBuffer = spanBuffer.SpanBuffer; | ||
| exports._INTERNAL_safeUnref = timer.safeUnref; | ||
| exports.expressErrorHandler = index$2.expressErrorHandler; | ||
| exports.patchExpressModule = index$2.patchExpressModule; | ||
| exports.setupExpressErrorHandler = index$2.setupExpressErrorHandler; | ||
| exports.expressErrorHandler = index$3.expressErrorHandler; | ||
| exports.patchExpressModule = index$3.patchExpressModule; | ||
| exports.setupExpressErrorHandler = index$3.setupExpressErrorHandler; | ||
| exports._INTERNAL_sanitizeSqlQuery = postgresjs._sanitizeSqlQuery; | ||
| exports.instrumentPostgresJsSql = postgresjs.instrumentPostgresJsSql; | ||
| exports._INTERNAL_getSqlQuerySummary = sql.getSqlQuerySummary; | ||
| exports.patchHttpModuleClient = clientPatch.patchHttpModuleClient; | ||
@@ -584,0 +593,0 @@ exports.getHttpClientSubscriptions = clientSubscriptions.getHttpClientSubscriptions; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -17,2 +17,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const spanstatus = require('../../tracing/spanstatus.js'); | ||
| const spanKind = require('../../spanKind.js'); | ||
@@ -176,6 +177,5 @@ const INTEGRATION_NAME = "Http.Server"; | ||
| name, | ||
| // SpanKind.SERVER = 1; pass this so the OTel sampler infers | ||
| // op='http.server' rather than 'http', which it does for | ||
| // SpanKind.INTERNAL = 0, the default | ||
| kind: 1, | ||
| // Pass SERVER so the OTel sampler infers op='http.server' rather than | ||
| // 'http', which it does for the INTERNAL default. | ||
| kind: spanKind.SPAN_KIND.SERVER, | ||
| attributes: { | ||
@@ -182,0 +182,0 @@ // Sentry-specific attributes |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server-subscription.js","sources":["../../../../src/integrations/http/server-subscription.ts"],"sourcesContent":["/**\n * Provide the `http.server.request.start` subscription function that we use\n * to instrument incoming HTTP requests that use the `node:http` module.\n *\n * On Node.js v18.7 and up, we can just assign the diagnostics channel\n * listener, and that's enough. But for older node versions, or other SSJS\n * platforms, we have to explicitly fire the provided method an a patched\n * Server.emit method.\n *\n * This decision is made in the relevant Node/Bun/Deno SDKs; core just\n * provides them with the methods to use.\n *\n * When `options.spans` is enabled (explicitly or via the client's tracing\n * config), this also creates server spans around the emitted `'request'`\n * event. The OTel-mode node integration creates spans through a different\n * code path and opts out via explicit `spans: false`.\n */\n\nimport type { ServerSubscriptionName } from './constants';\ntype ChannelListener = (message: unknown, name: string | symbol) => void;\nimport { HTTP_ON_SERVER_REQUEST } from './constants';\nimport type { HttpIncomingMessage, HttpInstrumentationOptions, HttpServer, HttpServerResponse } from './types';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { debug } from '../../utils/debug-logger';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from '../../currentScopes';\nimport { hasSpansEnabled } from '../../utils/hasSpansEnabled';\nimport { headersToDict, httpHeadersToSpanAttributes, httpRequestToRequestData } from '../../utils/request';\nimport { patchRequestToCaptureBody } from './patch-request-to-capture-body';\nimport { parseStringToURLObject, stripUrlQueryAndFragment } from '../../utils/url';\nimport { recordRequestSession } from './record-request-session';\nimport { generateSpanId, generateTraceId } from '../../utils/propagationContext';\nimport { continueTrace } from '../../tracing/trace';\nimport { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, startSpanManual } from '../../tracing';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../../semanticAttributes';\nimport { safeMathRandom } from '../../utils/randomSafeContext';\nimport type { SpanAttributes } from '../../types/span';\nimport type { SpanStatus } from '../../types/spanStatus';\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nconst INTEGRATION_NAME = 'Http.Server';\nconst SPANS_INTEGRATION_NAME = 'Http.SentryServerSpans';\n\nexport type HttpServerSubscriptions = Record<ServerSubscriptionName, ChannelListener>;\n\n// Tracks the last Sentry-created emit wrapper for each server so we can detect\n// when user code has replaced server.emit (e.g. with a proxy of the original)\n// and re-wrap it to restore Sentry's instrumentation.\nconst lastSentryEmitMap = new WeakMap<HttpServer, HttpServer['emit']>();\n\nconst kRequestMark = Symbol.for('sentry_http_server_instrumented');\ntype MarkedRequest = HttpIncomingMessage & {\n [kRequestMark]?: boolean;\n};\n\n/** return true if it is NOT already marked */\nfunction markRequest(request: MarkedRequest): boolean {\n return !request[kRequestMark] && (request[kRequestMark] = true);\n}\n\nexport function instrumentServer(options: HttpInstrumentationOptions, server: HttpServer): void {\n // Use a proxy and a WeakSet of server objects here, rather than a\n // wrappedFunction, because NestJS has been observed to \"fork\" emit\n // methods, including copying properties, leading to false positives.\n // Furthermore, we mark the Request object so that if two copies of this\n // instrumentation both are run on forked emit() methods for the same\n // request, we still only ever create a single root span. Previously,\n // this was done with a flag on the OTEL context, but in this non-OTEL\n // version, we mark the Request itself with a non-enumerable prop instead.\n\n // oxlint-disable-next-line typescript/unbound-method -- `this` is forwarded via Proxy/target.apply below\n const currentEmit = server.emit;\n const instrumentedEmit = lastSentryEmitMap.get(server);\n\n // Skip re-wrapping only if already instrumented AND server.emit still points\n // to our wrapper. If user code replaced server.emit (e.g. with a proxy of the\n // original pre-Sentry emit), re-wrap so Sentry's instrumentation is restored.\n if (currentEmit === instrumentedEmit) {\n return;\n }\n\n const newEmit = new Proxy(currentEmit, {\n apply(target, thisArg, args: unknown[]) {\n const [event, ...data] = args;\n if (event !== 'request') {\n return target.apply(thisArg, args);\n }\n\n const client = getClient();\n const [request, response] = data as [HttpIncomingMessage, HttpServerResponse];\n\n if (!client || !markRequest(request)) {\n return target.apply(thisArg, args);\n }\n\n DEBUG_BUILD && debug.log(INTEGRATION_NAME, 'Handling incoming request');\n const isolationScope = getIsolationScope().clone();\n isolationScope.setClient(client);\n\n const ipAddress = request.socket?.remoteAddress;\n const url = request.url || '/';\n const normalizedRequest = httpRequestToRequestData(request);\n const {\n maxRequestBodySize = 'medium',\n ignoreRequestBody,\n sessions = true,\n sessionFlushingDelayMS = 60_000,\n } = options;\n\n if (maxRequestBodySize !== 'none' && !ignoreRequestBody?.(url, request)) {\n patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize, INTEGRATION_NAME);\n }\n\n // Update the isolation scope, isolate this request\n isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });\n\n // attempt to update the scope's `transactionName` based on the request\n // URL. Ideally, framework instrumentations coming after the\n // HttpInstrumentation update the transactionName once we get a\n // parameterized route.\n const httpMethod = (request.method || 'GET').toUpperCase();\n const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);\n\n const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;\n\n isolationScope.setTransactionName(bestEffortTransactionName);\n\n if (sessions) {\n recordRequestSession(client, {\n requestIsolationScope: isolationScope,\n response,\n sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60_000,\n });\n }\n\n return withIsolationScope(isolationScope, () => {\n const sentryTrace = normalizedRequest.headers?.['sentry-trace'];\n const baggage = normalizedRequest.headers?.['baggage'];\n const sentryTraceValue = Array.isArray(sentryTrace) ? sentryTrace[0] : sentryTrace;\n return continueTrace(\n {\n sentryTrace: sentryTraceValue,\n baggage: Array.isArray(baggage) ? baggage[0] : baggage,\n },\n () => {\n const propagationContext = getCurrentScope().getPropagationContext();\n // Set propagationSpanId after continueTrace because it calls\n // withScope + setPropagationContext internally, which would\n // overwrite any previously set value.\n propagationContext.propagationSpanId = generateSpanId();\n // In OTel mode, continueTrace does not generate a new traceId\n // when there is no incoming sentry-trace header. We generate one\n // explicitly here so each request gets a unique trace ID even when\n // tracing is disabled.\n if (!sentryTraceValue) {\n propagationContext.traceId = generateTraceId();\n propagationContext.sampleRand = safeMathRandom();\n }\n\n response.once('close', () => {\n isolationScope.setContext('response', {\n status_code: response.statusCode,\n });\n });\n\n const wrap = options.wrapServerEmitRequest;\n let emitResult: boolean = false;\n if (wrap) {\n wrap(request, response, normalizedRequest, () => {\n emitResult = target.apply(thisArg, args) as boolean;\n });\n } else {\n emitResult = target.apply(thisArg, args) as boolean;\n }\n return emitResult;\n },\n );\n });\n },\n });\n\n lastSentryEmitMap.set(server, newEmit);\n server.emit = newEmit;\n}\n\nexport function getHttpServerSubscriptions(options: HttpInstrumentationOptions): HttpServerSubscriptions {\n // The decision whether to create spans is evaluated per request (not once\n // here), so it stays responsive to client-state changes after setup. This\n // mirrors `getHttpClientSubscriptions`. Callers can force the no-span path\n // with explicit `spans: false` (the node OTel `httpServerIntegration` does\n // this because it creates spans through a separate code path).\n const userWrap = options.wrapServerEmitRequest;\n const spanWrap = buildServerSpanWrap(options);\n\n const effectiveOptions: HttpInstrumentationOptions = {\n ...options,\n wrapServerEmitRequest(request, response, normalizedRequest, next) {\n const clientOptions = getClient()?.getOptions();\n const createSpans = options.spans ?? (clientOptions ? hasSpansEnabled(clientOptions) : false);\n if (createSpans) {\n // spanWrap composes the user's wrap (outer) with span creation (inner).\n spanWrap(request, response, normalizedRequest, next);\n } else if (userWrap) {\n userWrap(request, response, normalizedRequest, next);\n } else {\n next();\n }\n },\n };\n\n const onHttpServerRequest: ChannelListener = (data: unknown): void => {\n const { server } = data as { server: HttpServer };\n instrumentServer(effectiveOptions, server);\n };\n\n return { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest };\n}\n\nfunction buildServerSpanWrap(\n options: HttpInstrumentationOptions,\n): NonNullable<HttpInstrumentationOptions['wrapServerEmitRequest']> {\n const {\n wrapServerEmitRequest: userWrap,\n ignoreIncomingRequests,\n ignoreStaticAssets = true,\n onSpanCreated,\n errorMonitor = 'error',\n onSpanEnd,\n } = options;\n\n return (request, response, normalizedRequest, next) => {\n if (typeof __SENTRY_TRACING__ !== 'undefined' && !__SENTRY_TRACING__) {\n return next();\n }\n\n // User wrap runs outside the span so it can set up context\n // (e.g. OTel propagation) before the span is created.\n return userWrap ? userWrap(request, response, normalizedRequest, createSpan) : createSpan();\n\n function createSpan(): unknown {\n const isolationScope = getIsolationScope();\n const client = isolationScope.getClient();\n if (!client) {\n return next();\n }\n\n if (\n shouldIgnoreSpansForIncomingRequest(request, {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n })\n ) {\n DEBUG_BUILD && debug.log(SPANS_INTEGRATION_NAME, 'Skipping span creation for incoming request', request.url);\n return next();\n }\n\n const fullUrl = normalizedRequest.url || request.url || '/';\n const urlObj = parseStringToURLObject(fullUrl);\n const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);\n const method = (request.method || 'GET').toUpperCase();\n const name = `${method} ${httpTargetWithoutQueryFragment}`;\n const headers = request.headers;\n const userAgent = headers['user-agent'];\n const ips = headers['x-forwarded-for'];\n const httpVersion = request.httpVersion;\n const host = headers.host as undefined | string;\n const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, '$1') || 'localhost';\n const scheme = fullUrl.startsWith('https') ? 'https' : 'http';\n const { socket } = request;\n const { localAddress, localPort, remoteAddress, remotePort } = socket ?? {};\n\n return startSpanManual(\n {\n name,\n // SpanKind.SERVER = 1; pass this so the OTel sampler infers\n // op='http.server' rather than 'http', which it does for\n // SpanKind.INTERNAL = 0, the default\n kind: 1,\n attributes: {\n // Sentry-specific attributes\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n // Set http.route to the URL path as a best-effort route name.\n // Framework integrations (Express, etc.) update this via onSpanEnd.\n 'http.route': httpTargetWithoutQueryFragment,\n // OTel kind (explicit attribute so it appears in span data)\n 'otel.kind': 'SERVER',\n // Network attributes\n 'net.host.ip': localAddress,\n 'net.host.port': localPort,\n 'net.peer.ip': remoteAddress,\n 'net.peer.port': remotePort,\n 'sentry.http.prefetch': isKnownPrefetchRequest(request) || undefined,\n // Old Semantic Conventions attributes for compatibility\n 'http.url': fullUrl,\n 'http.method': method,\n 'http.target': urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,\n 'http.host': host,\n 'net.host.name': hostname,\n 'http.client_ip': typeof ips === 'string' ? ips.split(',')[0] : undefined,\n 'http.user_agent': userAgent,\n 'http.scheme': scheme,\n 'http.flavor': httpVersion,\n 'net.transport': httpVersion?.toUpperCase() === 'QUIC' ? 'ip_udp' : 'ip_tcp',\n ...getRequestContentLengthAttribute(request),\n ...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, client.getDataCollectionOptions()),\n },\n },\n span => {\n onSpanCreated?.(span, request, response);\n // Ensure we only end the span once\n // E.g. error can be emitted before close is emitted\n let isEnded = false;\n\n function endSpan(status: SpanStatus): void {\n if (isEnded) {\n return;\n }\n\n isEnded = true;\n // set attributes that come from the response\n span.setAttributes({\n 'http.status_text': response.statusMessage?.toUpperCase(),\n 'http.response.status_code': response.statusCode,\n 'http.status_code': response.statusCode,\n ...httpHeadersToSpanAttributes(\n headersToDict(response.headers),\n client?.getDataCollectionOptions() ?? false,\n 'response',\n ),\n });\n span.setStatus(status);\n onSpanEnd?.(span, request, response);\n span.end();\n }\n\n response.once('close', () => {\n endSpan(getSpanStatusFromHttpCode(response.statusCode));\n });\n\n response.once(errorMonitor, () => {\n const httpStatus = getSpanStatusFromHttpCode(response.statusCode);\n // Ensure we def. have an error status here\n endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });\n });\n\n // Continue handling the request inside the active span context\n next();\n },\n );\n }\n };\n}\n\nfunction shouldIgnoreSpansForIncomingRequest(\n request: HttpIncomingMessage,\n {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n }: {\n ignoreStaticAssets?: boolean;\n ignoreIncomingRequests?: (urlPath: string, request: HttpIncomingMessage) => boolean;\n },\n): boolean {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as spans\n if (method === 'OPTIONS' || method === 'HEAD' || !urlPath) {\n return true;\n }\n\n // Default static asset filtering\n if (ignoreStaticAssets && method === 'GET' && isStaticAssetRequest(urlPath)) {\n return true;\n }\n\n if (ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n}\n\nexport function isStaticAssetRequest(urlPath: string): boolean {\n const path = stripUrlQueryAndFragment(urlPath);\n // Common static file extensions\n if (path.match(/\\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {\n return true;\n }\n\n // Common metadata files\n if (path.match(/^\\/(robots\\.txt|sitemap\\.xml|manifest\\.json|browserconfig\\.xml)$/)) {\n return true;\n }\n\n return false;\n}\n\nfunction isKnownPrefetchRequest(req: HttpIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getRequestContentLengthAttribute(request: HttpIncomingMessage): SpanAttributes {\n const { headers } = request;\n const contentLengthHeader = headers['content-length'];\n const length = contentLengthHeader ? parseInt(String(contentLengthHeader), 10) : -1;\n const encoding = headers['content-encoding'];\n return length >= 0\n ? encoding && encoding !== 'identity'\n ? { 'http.request_content_length': length }\n : { 'http.request_content_length_uncompressed': length }\n : {};\n}\n"],"names":["getClient","request","DEBUG_BUILD","debug","getIsolationScope","url","httpRequestToRequestData","patchRequestToCaptureBody","stripUrlQueryAndFragment","recordRequestSession","withIsolationScope","continueTrace","propagationContext","getCurrentScope","generateSpanId","generateTraceId","safeMathRandom","hasSpansEnabled","HTTP_ON_SERVER_REQUEST","parseStringToURLObject","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","httpHeadersToS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IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,IAAA,CAAK,KAAA,CAAM,kEAAkE,CAAA,EAAG;AAClF,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,uBAAuB,GAAA,EAAmC;AAEjE,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,sBAAsB,CAAA,KAAM,GAAA;AACjD;AAEA,SAAS,iCAAiC,OAAA,EAA8C;AACtF,EAAA,MAAM,EAAE,SAAQ,GAAI,OAAA;AACpB,EAAA,MAAM,mBAAA,GAAsB,QAAQ,gBAAgB,CAAA;AACpD,EAAA,MAAM,SAAS,mBAAA,GAAsB,QAAA,CAAS,OAAO,mBAAmB,CAAA,EAAG,EAAE,CAAA,GAAI,EAAA;AACjF,EAAA,MAAM,QAAA,GAAW,QAAQ,kBAAkB,CAAA;AAC3C,EAAA,OAAO,MAAA,IAAU,CAAA,GACb,QAAA,IAAY,QAAA,KAAa,UAAA,GACvB,EAAE,6BAAA,EAA+B,MAAA,EAAO,GACxC,EAAE,0CAAA,EAA4C,MAAA,KAChD,EAAC;AACP;;;;;;"} | ||
| {"version":3,"file":"server-subscription.js","sources":["../../../../src/integrations/http/server-subscription.ts"],"sourcesContent":["/**\n * Provide the `http.server.request.start` subscription function that we use\n * to instrument incoming HTTP requests that use the `node:http` module.\n *\n * On Node.js v18.7 and up, we can just assign the diagnostics channel\n * listener, and that's enough. But for older node versions, or other SSJS\n * platforms, we have to explicitly fire the provided method an a patched\n * Server.emit method.\n *\n * This decision is made in the relevant Node/Bun/Deno SDKs; core just\n * provides them with the methods to use.\n *\n * When `options.spans` is enabled (explicitly or via the client's tracing\n * config), this also creates server spans around the emitted `'request'`\n * event. The OTel-mode node integration creates spans through a different\n * code path and opts out via explicit `spans: false`.\n */\n\nimport type { ServerSubscriptionName } from './constants';\ntype ChannelListener = (message: unknown, name: string | symbol) => void;\nimport { HTTP_ON_SERVER_REQUEST } from './constants';\nimport type { HttpIncomingMessage, HttpInstrumentationOptions, HttpServer, HttpServerResponse } from './types';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { debug } from '../../utils/debug-logger';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from '../../currentScopes';\nimport { hasSpansEnabled } from '../../utils/hasSpansEnabled';\nimport { headersToDict, httpHeadersToSpanAttributes, httpRequestToRequestData } from '../../utils/request';\nimport { patchRequestToCaptureBody } from './patch-request-to-capture-body';\nimport { parseStringToURLObject, stripUrlQueryAndFragment } from '../../utils/url';\nimport { recordRequestSession } from './record-request-session';\nimport { generateSpanId, generateTraceId } from '../../utils/propagationContext';\nimport { continueTrace } from '../../tracing/trace';\nimport { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, startSpanManual } from '../../tracing';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../../semanticAttributes';\nimport { safeMathRandom } from '../../utils/randomSafeContext';\nimport { SPAN_KIND } from '../../spanKind';\nimport type { SpanAttributes } from '../../types/span';\nimport type { SpanStatus } from '../../types/spanStatus';\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nconst INTEGRATION_NAME = 'Http.Server';\nconst SPANS_INTEGRATION_NAME = 'Http.SentryServerSpans';\n\nexport type HttpServerSubscriptions = Record<ServerSubscriptionName, ChannelListener>;\n\n// Tracks the last Sentry-created emit wrapper for each server so we can detect\n// when user code has replaced server.emit (e.g. with a proxy of the original)\n// and re-wrap it to restore Sentry's instrumentation.\nconst lastSentryEmitMap = new WeakMap<HttpServer, HttpServer['emit']>();\n\nconst kRequestMark = Symbol.for('sentry_http_server_instrumented');\ntype MarkedRequest = HttpIncomingMessage & {\n [kRequestMark]?: boolean;\n};\n\n/** return true if it is NOT already marked */\nfunction markRequest(request: MarkedRequest): boolean {\n return !request[kRequestMark] && (request[kRequestMark] = true);\n}\n\nexport function instrumentServer(options: HttpInstrumentationOptions, server: HttpServer): void {\n // Use a proxy and a WeakSet of server objects here, rather than a\n // wrappedFunction, because NestJS has been observed to \"fork\" emit\n // methods, including copying properties, leading to false positives.\n // Furthermore, we mark the Request object so that if two copies of this\n // instrumentation both are run on forked emit() methods for the same\n // request, we still only ever create a single root span. Previously,\n // this was done with a flag on the OTEL context, but in this non-OTEL\n // version, we mark the Request itself with a non-enumerable prop instead.\n\n // oxlint-disable-next-line typescript/unbound-method -- `this` is forwarded via Proxy/target.apply below\n const currentEmit = server.emit;\n const instrumentedEmit = lastSentryEmitMap.get(server);\n\n // Skip re-wrapping only if already instrumented AND server.emit still points\n // to our wrapper. If user code replaced server.emit (e.g. with a proxy of the\n // original pre-Sentry emit), re-wrap so Sentry's instrumentation is restored.\n if (currentEmit === instrumentedEmit) {\n return;\n }\n\n const newEmit = new Proxy(currentEmit, {\n apply(target, thisArg, args: unknown[]) {\n const [event, ...data] = args;\n if (event !== 'request') {\n return target.apply(thisArg, args);\n }\n\n const client = getClient();\n const [request, response] = data as [HttpIncomingMessage, HttpServerResponse];\n\n if (!client || !markRequest(request)) {\n return target.apply(thisArg, args);\n }\n\n DEBUG_BUILD && debug.log(INTEGRATION_NAME, 'Handling incoming request');\n const isolationScope = getIsolationScope().clone();\n isolationScope.setClient(client);\n\n const ipAddress = request.socket?.remoteAddress;\n const url = request.url || '/';\n const normalizedRequest = httpRequestToRequestData(request);\n const {\n maxRequestBodySize = 'medium',\n ignoreRequestBody,\n sessions = true,\n sessionFlushingDelayMS = 60_000,\n } = options;\n\n if (maxRequestBodySize !== 'none' && !ignoreRequestBody?.(url, request)) {\n patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize, INTEGRATION_NAME);\n }\n\n // Update the isolation scope, isolate this request\n isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });\n\n // attempt to update the scope's `transactionName` based on the request\n // URL. Ideally, framework instrumentations coming after the\n // HttpInstrumentation update the transactionName once we get a\n // parameterized route.\n const httpMethod = (request.method || 'GET').toUpperCase();\n const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);\n\n const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;\n\n isolationScope.setTransactionName(bestEffortTransactionName);\n\n if (sessions) {\n recordRequestSession(client, {\n requestIsolationScope: isolationScope,\n response,\n sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60_000,\n });\n }\n\n return withIsolationScope(isolationScope, () => {\n const sentryTrace = normalizedRequest.headers?.['sentry-trace'];\n const baggage = normalizedRequest.headers?.['baggage'];\n const sentryTraceValue = Array.isArray(sentryTrace) ? sentryTrace[0] : sentryTrace;\n return continueTrace(\n {\n sentryTrace: sentryTraceValue,\n baggage: Array.isArray(baggage) ? baggage[0] : baggage,\n },\n () => {\n const propagationContext = getCurrentScope().getPropagationContext();\n // Set propagationSpanId after continueTrace because it calls\n // withScope + setPropagationContext internally, which would\n // overwrite any previously set value.\n propagationContext.propagationSpanId = generateSpanId();\n // In OTel mode, continueTrace does not generate a new traceId\n // when there is no incoming sentry-trace header. We generate one\n // explicitly here so each request gets a unique trace ID even when\n // tracing is disabled.\n if (!sentryTraceValue) {\n propagationContext.traceId = generateTraceId();\n propagationContext.sampleRand = safeMathRandom();\n }\n\n response.once('close', () => {\n isolationScope.setContext('response', {\n status_code: response.statusCode,\n });\n });\n\n const wrap = options.wrapServerEmitRequest;\n let emitResult: boolean = false;\n if (wrap) {\n wrap(request, response, normalizedRequest, () => {\n emitResult = target.apply(thisArg, args) as boolean;\n });\n } else {\n emitResult = target.apply(thisArg, args) as boolean;\n }\n return emitResult;\n },\n );\n });\n },\n });\n\n lastSentryEmitMap.set(server, newEmit);\n server.emit = newEmit;\n}\n\nexport function getHttpServerSubscriptions(options: HttpInstrumentationOptions): HttpServerSubscriptions {\n // The decision whether to create spans is evaluated per request (not once\n // here), so it stays responsive to client-state changes after setup. This\n // mirrors `getHttpClientSubscriptions`. Callers can force the no-span path\n // with explicit `spans: false` (the node OTel `httpServerIntegration` does\n // this because it creates spans through a separate code path).\n const userWrap = options.wrapServerEmitRequest;\n const spanWrap = buildServerSpanWrap(options);\n\n const effectiveOptions: HttpInstrumentationOptions = {\n ...options,\n wrapServerEmitRequest(request, response, normalizedRequest, next) {\n const clientOptions = getClient()?.getOptions();\n const createSpans = options.spans ?? (clientOptions ? hasSpansEnabled(clientOptions) : false);\n if (createSpans) {\n // spanWrap composes the user's wrap (outer) with span creation (inner).\n spanWrap(request, response, normalizedRequest, next);\n } else if (userWrap) {\n userWrap(request, response, normalizedRequest, next);\n } else {\n next();\n }\n },\n };\n\n const onHttpServerRequest: ChannelListener = (data: unknown): void => {\n const { server } = data as { server: HttpServer };\n instrumentServer(effectiveOptions, server);\n };\n\n return { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest };\n}\n\nfunction buildServerSpanWrap(\n options: HttpInstrumentationOptions,\n): NonNullable<HttpInstrumentationOptions['wrapServerEmitRequest']> {\n const {\n wrapServerEmitRequest: userWrap,\n ignoreIncomingRequests,\n ignoreStaticAssets = true,\n onSpanCreated,\n errorMonitor = 'error',\n onSpanEnd,\n } = options;\n\n return (request, response, normalizedRequest, next) => {\n if (typeof __SENTRY_TRACING__ !== 'undefined' && !__SENTRY_TRACING__) {\n return next();\n }\n\n // User wrap runs outside the span so it can set up context\n // (e.g. OTel propagation) before the span is created.\n return userWrap ? userWrap(request, response, normalizedRequest, createSpan) : createSpan();\n\n function createSpan(): unknown {\n const isolationScope = getIsolationScope();\n const client = isolationScope.getClient();\n if (!client) {\n return next();\n }\n\n if (\n shouldIgnoreSpansForIncomingRequest(request, {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n })\n ) {\n DEBUG_BUILD && debug.log(SPANS_INTEGRATION_NAME, 'Skipping span creation for incoming request', request.url);\n return next();\n }\n\n const fullUrl = normalizedRequest.url || request.url || '/';\n const urlObj = parseStringToURLObject(fullUrl);\n const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);\n const method = (request.method || 'GET').toUpperCase();\n const name = `${method} ${httpTargetWithoutQueryFragment}`;\n const headers = request.headers;\n const userAgent = headers['user-agent'];\n const ips = headers['x-forwarded-for'];\n const httpVersion = request.httpVersion;\n const host = headers.host as undefined | string;\n const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, '$1') || 'localhost';\n const scheme = fullUrl.startsWith('https') ? 'https' : 'http';\n const { socket } = request;\n const { localAddress, localPort, remoteAddress, remotePort } = socket ?? {};\n\n return startSpanManual(\n {\n name,\n // Pass SERVER so the OTel sampler infers op='http.server' rather than\n // 'http', which it does for the INTERNAL default.\n kind: SPAN_KIND.SERVER,\n attributes: {\n // Sentry-specific attributes\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n // Set http.route to the URL path as a best-effort route name.\n // Framework integrations (Express, etc.) update this via onSpanEnd.\n 'http.route': httpTargetWithoutQueryFragment,\n // OTel kind (explicit attribute so it appears in span data)\n 'otel.kind': 'SERVER',\n // Network attributes\n 'net.host.ip': localAddress,\n 'net.host.port': localPort,\n 'net.peer.ip': remoteAddress,\n 'net.peer.port': remotePort,\n 'sentry.http.prefetch': isKnownPrefetchRequest(request) || undefined,\n // Old Semantic Conventions attributes for compatibility\n 'http.url': fullUrl,\n 'http.method': method,\n 'http.target': urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,\n 'http.host': host,\n 'net.host.name': hostname,\n 'http.client_ip': typeof ips === 'string' ? ips.split(',')[0] : undefined,\n 'http.user_agent': userAgent,\n 'http.scheme': scheme,\n 'http.flavor': httpVersion,\n 'net.transport': httpVersion?.toUpperCase() === 'QUIC' ? 'ip_udp' : 'ip_tcp',\n ...getRequestContentLengthAttribute(request),\n ...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, client.getDataCollectionOptions()),\n },\n },\n span => {\n onSpanCreated?.(span, request, response);\n // Ensure we only end the span once\n // E.g. error can be emitted before close is emitted\n let isEnded = false;\n\n function endSpan(status: SpanStatus): void {\n if (isEnded) {\n return;\n }\n\n isEnded = true;\n // set attributes that come from the response\n span.setAttributes({\n 'http.status_text': response.statusMessage?.toUpperCase(),\n 'http.response.status_code': response.statusCode,\n 'http.status_code': response.statusCode,\n ...httpHeadersToSpanAttributes(\n headersToDict(response.headers),\n client?.getDataCollectionOptions() ?? false,\n 'response',\n ),\n });\n span.setStatus(status);\n onSpanEnd?.(span, request, response);\n span.end();\n }\n\n response.once('close', () => {\n endSpan(getSpanStatusFromHttpCode(response.statusCode));\n });\n\n response.once(errorMonitor, () => {\n const httpStatus = getSpanStatusFromHttpCode(response.statusCode);\n // Ensure we def. have an error status here\n endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });\n });\n\n // Continue handling the request inside the active span context\n next();\n },\n );\n }\n };\n}\n\nfunction shouldIgnoreSpansForIncomingRequest(\n request: HttpIncomingMessage,\n {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n }: {\n ignoreStaticAssets?: boolean;\n ignoreIncomingRequests?: (urlPath: string, request: HttpIncomingMessage) => boolean;\n },\n): boolean {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as spans\n if (method === 'OPTIONS' || method === 'HEAD' || !urlPath) {\n return true;\n }\n\n // Default static asset filtering\n if (ignoreStaticAssets && method === 'GET' && isStaticAssetRequest(urlPath)) {\n return true;\n }\n\n if (ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n}\n\nexport function isStaticAssetRequest(urlPath: string): boolean {\n const path = stripUrlQueryAndFragment(urlPath);\n // Common static file extensions\n if (path.match(/\\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {\n return true;\n }\n\n // Common metadata files\n if (path.match(/^\\/(robots\\.txt|sitemap\\.xml|manifest\\.json|browserconfig\\.xml)$/)) {\n return true;\n }\n\n return false;\n}\n\nfunction isKnownPrefetchRequest(req: HttpIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getRequestContentLengthAttribute(request: HttpIncomingMessage): SpanAttributes {\n const { headers } = request;\n const contentLengthHeader = headers['content-length'];\n const length = contentLengthHeader ? parseInt(String(contentLengthHeader), 10) : -1;\n const encoding = headers['content-encoding'];\n return length >= 0\n ? encoding && encoding !== 'identity'\n ? { 'http.request_content_length': length }\n : { 'http.request_content_length_uncompressed': length }\n : {};\n}\n"],"names":["getClient","request","DEBUG_BUILD","debug","getIsolationScope","url","httpRequestToRequestData","patchRequestToCaptureBody","stripUrlQueryAndFragment","recordRequestSession","withIsolationScope","continueTrace","propagationContext","getCurrentScope","generateSpanId","generateTraceId","safeMathRandom","hasSpansEnabled","HTTP_ON_SERVER_REQUEST","parseStringToURLObject","startSpanManual","SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","httpHeadersToSpanAttributes","headersToDict","getSpanStatusFromHttpCode","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA,MAAM,gBAAA,GAAmB,aAAA;AACzB,MAAM,sBAAA,GAAyB,wBAAA;AAO/B,MAAM,iBAAA,uBAAwB,OAAA,EAAwC;AAEtE,MAAM,YAAA,mBAAe,MAAA,CAAO,GAAA,CAAI,iCAAiC,CAAA;AAMjE,SAAS,YAAY,OAAA,EAAiC;AACpD,EAAA,OAAO,CAAC,OAAA,CAAQ,YAAY,CAAA,KAAM,OAAA,CAAQ,YAAY,CAAA,GAAI,IAAA,CAAA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Q,gBAAgB,CAAA;AACpD,EAAA,MAAM,SAAS,mBAAA,GAAsB,QAAA,CAAS,OAAO,mBAAmB,CAAA,EAAG,EAAE,CAAA,GAAI,EAAA;AACjF,EAAA,MAAM,QAAA,GAAW,QAAQ,kBAAkB,CAAA;AAC3C,EAAA,OAAO,MAAA,IAAU,CAAA,GACb,QAAA,IAAY,QAAA,KAAa,UAAA,GACvB,EAAE,6BAAA,EAA+B,MAAA,EAAO,GACxC,EAAE,0CAAA,EAA4C,MAAA,KAChD,EAAC;AACP;;;;;;"} |
@@ -10,4 +10,4 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const debugLogger = require('../utils/debug-logger.js'); | ||
| const is = require('../utils/is.js'); | ||
| const misc = require('../utils/misc.js'); | ||
| const is = require('../utils/is.js'); | ||
| const spanstatus = require('../tracing/spanstatus.js'); | ||
@@ -14,0 +14,0 @@ const trace = require('../tracing/trace.js'); |
+8
-16
@@ -159,11 +159,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or | ||
| * an object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param newAttributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
@@ -175,3 +171,3 @@ * @example | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: { value: 'render_duration', unit: 'ms' }, | ||
| * render_duration: 150, | ||
| * }); | ||
@@ -191,12 +187,8 @@ * ``` | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - the attribute value. You can either pass in a raw value, or an attribute | ||
| * object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param value - The attribute value. | ||
| * | ||
@@ -206,3 +198,3 @@ * @example | ||
| * scope.setAttribute('is_admin', true); | ||
| * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' }); | ||
| * scope.setAttribute('render_duration', 150); | ||
| * ``` | ||
@@ -209,0 +201,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"scope.js","sources":["../../src/scope.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport type { Client } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { updateSession } from './session';\nimport type { Attachment } from './types/attachment';\nimport type { Breadcrumb } from './types/breadcrumb';\nimport type { Context, Contexts } from './types/context';\nimport type { DynamicSamplingContext } from './types/envelope';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { RequestEventData } from './types/request';\nimport type { Session } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { Span } from './types/span';\nimport type { PropagationContext } from './types/tracing';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isPlainObject } from './utils/is';\nimport { merge } from './utils/merge';\nimport { uuid4 } from './utils/misc';\nimport { generateTraceId } from './utils/propagationContext';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope';\nimport { truncate } from './utils/string';\nimport { dateTimestampInSeconds } from './utils/time';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * A context to be used for capturing an event.\n * This can either be a Scope, or a partial ScopeContext,\n * or a callback that receives the current scope and returns a new scope to use.\n */\nexport type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);\n\n/**\n * Data that can be converted to a Scope.\n */\nexport interface ScopeContext {\n user: User;\n level: SeverityLevel;\n extra: Extras;\n contexts: Contexts;\n tags: { [key: string]: Primitive };\n attributes?: RawAttributes<Record<string, unknown>>;\n fingerprint: string[];\n propagationContext: PropagationContext;\n conversationId?: string;\n}\n\nexport interface SdkProcessingMetadata {\n [key: string]: unknown;\n requestSession?: {\n status: 'ok' | 'errored' | 'crashed';\n };\n normalizedRequest?: RequestEventData;\n dynamicSamplingContext?: Partial<DynamicSamplingContext>;\n capturedSpanScope?: Scope;\n capturedSpanIsolationScope?: Scope;\n spanCountBeforeProcessing?: number;\n ipAddress?: string;\n}\n\n/**\n * Normalized data of the Scope, ready to be used.\n */\nexport interface ScopeData {\n eventProcessors: EventProcessor[];\n breadcrumbs: Breadcrumb[];\n user: User;\n tags: { [key: string]: Primitive };\n // TODO(v11): Make this a required field (could be subtly breaking if we did it today)\n attributes?: RawAttributes<Record<string, unknown>>;\n extra: Extras;\n contexts: Contexts;\n attachments: Attachment[];\n propagationContext: PropagationContext;\n sdkProcessingMetadata: SdkProcessingMetadata;\n fingerprint: string[];\n level?: SeverityLevel;\n transactionName?: string;\n span?: Span;\n conversationId?: string;\n}\n\n/**\n * Holds additional event information.\n */\nexport class Scope {\n /** Flag if notifying is happening. */\n protected _notifyingListeners: boolean;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void>;\n\n /** Callback list that will be called during event processing. */\n protected _eventProcessors: EventProcessor[];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[];\n\n /** User */\n protected _user: User;\n\n /** Tags */\n protected _tags: { [key: string]: Primitive };\n\n /** Attributes */\n protected _attributes: RawAttributes<Record<string, unknown>>;\n\n /** Extra */\n protected _extra: Extras;\n\n /** Contexts */\n protected _contexts: Contexts;\n\n /** Attachments */\n protected _attachments: Attachment[];\n\n /** Propagation Context for distributed tracing */\n protected _propagationContext: PropagationContext;\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n protected _sdkProcessingMetadata: SdkProcessingMetadata;\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: SeverityLevel;\n\n /**\n * Transaction Name\n *\n * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.\n * It's purpose is to assign a transaction to the scope that's added to non-transaction events.\n */\n protected _transactionName?: string;\n\n /** Session */\n protected _session?: Session;\n\n /** The client on this scope */\n protected _client?: Client;\n\n /** Contains the last event id of a captured event. */\n protected _lastEventId?: string;\n\n /** Conversation ID */\n protected _conversationId?: string;\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n public constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = {\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n };\n }\n\n /**\n * Clone all data from this scope into a new scope.\n */\n public clone(): Scope {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._attributes = { ...this._attributes };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n if (this._contexts.flags) {\n // We need to copy the `values` array so insertions on a cloned scope\n // won't affect the original array.\n newScope._contexts.flags = {\n values: [...this._contexts.flags.values],\n };\n }\n\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n newScope._lastEventId = this._lastEventId;\n newScope._conversationId = this._conversationId;\n\n _setSpanForScope(newScope, _getSpanForScope(this));\n\n return newScope;\n }\n\n /**\n * Update the client assigned to this scope.\n * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,\n * as well as manually created scopes.\n */\n public setClient(client: Client | undefined): void {\n this._client = client;\n }\n\n /**\n * Set the ID of the last captured error event.\n * This is generally only captured on the isolation scope.\n */\n public setLastEventId(lastEventId: string | undefined): void {\n this._lastEventId = lastEventId;\n }\n\n /**\n * Get the client assigned to this scope.\n */\n public getClient<C extends Client>(): C | undefined {\n return this._client as C | undefined;\n }\n\n /**\n * Get the ID of the last captured error event.\n * This is generally only available on the isolation scope.\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * Add an event processor that will be called before an event is sent.\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * Set the user for this scope.\n * Set to `null` to unset the user.\n */\n public setUser(user: User | null): this {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the user from this scope.\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * Set the conversation ID for this scope.\n * Set to `null` to unset the conversation ID.\n */\n public setConversationId(conversationId: string | null | undefined): this {\n this._conversationId = conversationId || undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set an object that will be merged into existing tags on the scope,\n * and will be sent as tags data with the event.\n */\n public setTags(tags: { [key: string]: Primitive }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single tag that will be sent as tags data with the event.\n */\n public setTag(key: string, value: Primitive): this {\n return this.setTags({ [key]: value });\n }\n\n /**\n * Sets attributes onto the scope.\n *\n * These attributes are currently applied to logs and metrics.\n * In the future, they will also be applied to spans.\n *\n * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for\n * more complex attribute types. We'll add this support in the future but already specify the wider type to\n * avoid a breaking change in the future.\n *\n * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or\n * an object with a `value` and an optional `unit` (if applicable to your attribute).\n *\n * @example\n * ```typescript\n * scope.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: { value: 'render_duration', unit: 'ms' },\n * });\n * ```\n */\n public setAttributes<T extends Record<string, unknown>>(newAttributes: RawAttributes<T>): this {\n this._attributes = {\n ...this._attributes,\n ...newAttributes,\n };\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets an attribute onto the scope.\n *\n * These attributes are currently applied to logs and metrics.\n * In the future, they will also be applied to spans.\n *\n * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for\n * more complex attribute types. We'll add this support in the future but already specify the wider type to\n * avoid a breaking change in the future.\n *\n * @param key - The attribute key.\n * @param value - the attribute value. You can either pass in a raw value, or an attribute\n * object with a `value` and an optional `unit` (if applicable to your attribute).\n *\n * @example\n * ```typescript\n * scope.setAttribute('is_admin', true);\n * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' });\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setAttribute<T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown>(\n key: string,\n value: RawAttribute<T>,\n ): this {\n return this.setAttributes({ [key]: value });\n }\n\n /**\n * Removes the attribute with the given key from the scope.\n *\n * @param key - The attribute key.\n *\n * @example\n * ```typescript\n * scope.removeAttribute('is_admin');\n * ```\n */\n public removeAttribute(key: string): this {\n if (key in this._attributes) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._attributes[key];\n this._notifyScopeListeners();\n }\n return this;\n }\n\n /**\n * Set an object that will be merged into existing extra on the scope,\n * and will be sent as extra data with the event.\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single key:value extra entry that will be sent as extra data with the event.\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the fingerprint on the scope to send with the events.\n * @param {string[]} fingerprint Fingerprint to group events in Sentry.\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the level on the scope for future events.\n */\n public setLevel(level: SeverityLevel): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope so that the name of e.g. taken server route or\n * the page location is attached to future events.\n *\n * IMPORTANT: Calling this function does NOT change the name of the currently active\n * root span. If you want to change the name of the active root span, use\n * `Sentry.updateSpanName(rootSpan, 'new name')` instead.\n *\n * By default, the SDK updates the scope's transaction name automatically on sensible\n * occasions, such as a page navigation or when handling a new request on the server.\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets context data with the given name.\n * Data passed as context will be normalized. You can also pass `null` to unset the context.\n * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set the session for the scope.\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the session from the scope.\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * Updates the scope with provided data. Can work in three variations:\n * - plain object containing updatable attributes\n * - Scope instance that'll extract the attributes from\n * - callback function that'll receive the current scope as an argument and allow for modifications\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n const scopeInstance =\n scopeToMerge instanceof Scope\n ? scopeToMerge.getScopeData()\n : isPlainObject(scopeToMerge)\n ? (captureContext as ScopeContext)\n : undefined;\n\n const {\n tags,\n attributes,\n extra,\n user,\n contexts,\n level,\n fingerprint = [],\n propagationContext,\n conversationId,\n } = scopeInstance || {};\n\n this._tags = { ...this._tags, ...tags };\n this._attributes = { ...this._attributes, ...attributes };\n this._extra = { ...this._extra, ...extra };\n this._contexts = { ...this._contexts, ...contexts };\n\n if (user && Object.keys(user).length) {\n this._user = user;\n }\n\n if (level) {\n this._level = level;\n }\n\n if (fingerprint.length) {\n this._fingerprint = fingerprint;\n }\n\n if (propagationContext) {\n this._propagationContext = propagationContext;\n }\n\n if (conversationId) {\n this._conversationId = conversationId;\n }\n\n return this;\n }\n\n /**\n * Clears the current scope and resets its properties.\n * Note: The client will not be cleared.\n */\n public clear(): this {\n // client is not cleared here on purpose!\n this._breadcrumbs = [];\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._session = undefined;\n this._conversationId = undefined;\n _setSpanForScope(this, undefined);\n this._attachments = [];\n this.setPropagationContext({\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n });\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Adds a breadcrumb to the scope.\n * By default, the last 100 breadcrumbs are kept.\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb: Breadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory\n message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,\n };\n\n this._breadcrumbs.push(mergedBreadcrumb);\n if (this._breadcrumbs.length > maxCrumbs) {\n this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);\n this._client?.recordDroppedEvent('buffer_overflow', 'log_item');\n }\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * Get the last breadcrumb of the scope.\n */\n public getLastBreadcrumb(): Breadcrumb | undefined {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * Clear all breadcrumbs from the scope.\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Add an attachment to the scope.\n */\n public addAttachment(attachment: Attachment): this {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * Clear all attachments from the scope.\n */\n public clearAttachments(): this {\n this._attachments = [];\n return this;\n }\n\n /**\n * Get the data of this scope, which should be applied to an event during processing.\n */\n public getScopeData(): ScopeData {\n return {\n breadcrumbs: this._breadcrumbs,\n attachments: this._attachments,\n contexts: this._contexts,\n tags: this._tags,\n attributes: this._attributes,\n extra: this._extra,\n user: this._user,\n level: this._level,\n fingerprint: this._fingerprint || [],\n eventProcessors: this._eventProcessors,\n propagationContext: this._propagationContext,\n sdkProcessingMetadata: this._sdkProcessingMetadata,\n transactionName: this._transactionName,\n span: _getSpanForScope(this),\n conversationId: this._conversationId,\n };\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry.\n */\n public setSDKProcessingMetadata(newData: SdkProcessingMetadata): this {\n this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);\n return this;\n }\n\n /**\n * Add propagation context to the scope, used for distributed tracing\n */\n public setPropagationContext(context: PropagationContext): this {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * Get propagation context from the scope, used for distributed tracing\n */\n public getPropagationContext(): PropagationContext {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @returns {string} The id of the captured Sentry event.\n */\n public captureException(exception: unknown, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @returns {string} The id of the captured message.\n */\n public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = hint?.syntheticException ?? new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a Sentry event for this scope.\n *\n * @returns {string} The id of the captured event.\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = event.event_id || hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n"],"names":["generateTraceId","safeMathRandom","_setSpanForScope","_getSpanForScope","updateSession","isPlainObject","dateTimestampInSeconds","truncate","merge","uuid4","DEBUG_BUILD","debug"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,uBAAA,GAA0B,GAAA;AA8DzB,MAAM,KAAA,CAAM;AAAA;AAAA,EAoEV,WAAA,GAAc;AACnB,IAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAC3B,IAAA,IAAA,CAAK,kBAAkB,EAAC;AACxB,IAAA,IAAA,CAAK,mBAAmB,EAAC;AACzB,IAAA,IAAA,CAAK,eAAe,EAAC;AACrB,IAAA,IAAA,CAAK,eAAe,EAAC;AACrB,IAAA,IAAA,CAAK,QAAQ,EAAC;AACd,IAAA,IAAA,CAAK,QAAQ,EAAC;AACd,IAAA,IAAA,CAAK,cAAc,EAAC;AACpB,IAAA,IAAA,CAAK,SAAS,EAAC;AACf,IAAA,IAAA,CAAK,YAAY,EAAC;AAClB,IAAA,IAAA,CAAK,yBAAyB,EAAC;AAC/B,IAAA,IAAA,CAAK,mBAAA,GAAsB;AAAA,MACzB,SAASA,kCAAA,EAAgB;AAAA,MACzB,YAAYC,gCAAA;AAAe,KAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,KAAA,GAAe;AACpB,IAAA,MAAM,QAAA,GAAW,IAAI,KAAA,EAAM;AAC3B,IAAA,QAAA,CAAS,YAAA,GAAe,CAAC,GAAG,IAAA,CAAK,YAAY,CAAA;AAC7C,IAAA,QAAA,CAAS,KAAA,GAAQ,EAAE,GAAG,IAAA,CAAK,KAAA,EAAM;AACjC,IAAA,QAAA,CAAS,WAAA,GAAc,EAAE,GAAG,IAAA,C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AAK,OAAA,CAAQ,cAAA;AAAA,MACX,OAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,QACE,iBAAA,EAAmB,OAAA;AAAA,QACnB,kBAAA;AAAA,QACA,GAAG,IAAA;AAAA,QACH,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,KACF;AAEA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,YAAA,CAAa,OAAc,IAAA,EAA0B;AAC1D,IAAA,MAAM,OAAA,GAAU,KAAA,CAAM,QAAA,IAAY,IAAA,EAAM,YAAYF,UAAA,EAAM;AAE1D,IAAA,IAAI,CAAC,KAAK,OAAA,EAAS;AACjB,MAAAC,sBAAA,IAAeC,iBAAA,CAAM,KAAK,yDAAyD,CAAA;AACnF,MAAA,OAAO,OAAA;AAAA,IACT;AAEA,IAAA,IAAA,CAAK,OAAA,CAAQ,aAAa,KAAA,EAAO,EAAE,GAAG,IAAA,EAAM,QAAA,EAAU,OAAA,EAAQ,EAAG,IAAI,CAAA;AAErE,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKU,qBAAA,GAA8B;AAItC,IAAA,IAAI,CAAC,KAAK,mBAAA,EAAqB;AAC7B,MAAA,IAAA,CAAK,mBAAA,GAAsB,IAAA;AAC3B,MAAA,IAAA,CAAK,eAAA,CAAgB,QAAQ,CAAA,QAAA,KAAY;AACvC,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACf,CAAC,CAAA;AACD,MAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAAA,IAC7B;AAAA,EACF;AACF;;;;"} | ||
| {"version":3,"file":"scope.js","sources":["../../src/scope.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport type { Client } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { updateSession } from './session';\nimport type { Attachment } from './types/attachment';\nimport type { Breadcrumb } from './types/breadcrumb';\nimport type { Context, Contexts } from './types/context';\nimport type { DynamicSamplingContext } from './types/envelope';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { RequestEventData } from './types/request';\nimport type { Session } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { Span } from './types/span';\nimport type { PropagationContext } from './types/tracing';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isPlainObject } from './utils/is';\nimport { merge } from './utils/merge';\nimport { uuid4 } from './utils/misc';\nimport { generateTraceId } from './utils/propagationContext';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope';\nimport { truncate } from './utils/string';\nimport { dateTimestampInSeconds } from './utils/time';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * A context to be used for capturing an event.\n * This can either be a Scope, or a partial ScopeContext,\n * or a callback that receives the current scope and returns a new scope to use.\n */\nexport type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);\n\n/**\n * Data that can be converted to a Scope.\n */\nexport interface ScopeContext {\n user: User;\n level: SeverityLevel;\n extra: Extras;\n contexts: Contexts;\n tags: { [key: string]: Primitive };\n attributes?: RawAttributes<Record<string, unknown>>;\n fingerprint: string[];\n propagationContext: PropagationContext;\n conversationId?: string;\n}\n\nexport interface SdkProcessingMetadata {\n [key: string]: unknown;\n requestSession?: {\n status: 'ok' | 'errored' | 'crashed';\n };\n normalizedRequest?: RequestEventData;\n dynamicSamplingContext?: Partial<DynamicSamplingContext>;\n capturedSpanScope?: Scope;\n capturedSpanIsolationScope?: Scope;\n spanCountBeforeProcessing?: number;\n ipAddress?: string;\n}\n\n/**\n * Normalized data of the Scope, ready to be used.\n */\nexport interface ScopeData {\n eventProcessors: EventProcessor[];\n breadcrumbs: Breadcrumb[];\n user: User;\n tags: { [key: string]: Primitive };\n // TODO(v11): Make this a required field (could be subtly breaking if we did it today)\n attributes?: RawAttributes<Record<string, unknown>>;\n extra: Extras;\n contexts: Contexts;\n attachments: Attachment[];\n propagationContext: PropagationContext;\n sdkProcessingMetadata: SdkProcessingMetadata;\n fingerprint: string[];\n level?: SeverityLevel;\n transactionName?: string;\n span?: Span;\n conversationId?: string;\n}\n\n/**\n * Holds additional event information.\n */\nexport class Scope {\n /** Flag if notifying is happening. */\n protected _notifyingListeners: boolean;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void>;\n\n /** Callback list that will be called during event processing. */\n protected _eventProcessors: EventProcessor[];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[];\n\n /** User */\n protected _user: User;\n\n /** Tags */\n protected _tags: { [key: string]: Primitive };\n\n /** Attributes */\n protected _attributes: RawAttributes<Record<string, unknown>>;\n\n /** Extra */\n protected _extra: Extras;\n\n /** Contexts */\n protected _contexts: Contexts;\n\n /** Attachments */\n protected _attachments: Attachment[];\n\n /** Propagation Context for distributed tracing */\n protected _propagationContext: PropagationContext;\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n protected _sdkProcessingMetadata: SdkProcessingMetadata;\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: SeverityLevel;\n\n /**\n * Transaction Name\n *\n * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.\n * It's purpose is to assign a transaction to the scope that's added to non-transaction events.\n */\n protected _transactionName?: string;\n\n /** Session */\n protected _session?: Session;\n\n /** The client on this scope */\n protected _client?: Client;\n\n /** Contains the last event id of a captured event. */\n protected _lastEventId?: string;\n\n /** Conversation ID */\n protected _conversationId?: string;\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n public constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = {\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n };\n }\n\n /**\n * Clone all data from this scope into a new scope.\n */\n public clone(): Scope {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._attributes = { ...this._attributes };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n if (this._contexts.flags) {\n // We need to copy the `values` array so insertions on a cloned scope\n // won't affect the original array.\n newScope._contexts.flags = {\n values: [...this._contexts.flags.values],\n };\n }\n\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n newScope._lastEventId = this._lastEventId;\n newScope._conversationId = this._conversationId;\n\n _setSpanForScope(newScope, _getSpanForScope(this));\n\n return newScope;\n }\n\n /**\n * Update the client assigned to this scope.\n * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,\n * as well as manually created scopes.\n */\n public setClient(client: Client | undefined): void {\n this._client = client;\n }\n\n /**\n * Set the ID of the last captured error event.\n * This is generally only captured on the isolation scope.\n */\n public setLastEventId(lastEventId: string | undefined): void {\n this._lastEventId = lastEventId;\n }\n\n /**\n * Get the client assigned to this scope.\n */\n public getClient<C extends Client>(): C | undefined {\n return this._client as C | undefined;\n }\n\n /**\n * Get the ID of the last captured error event.\n * This is generally only available on the isolation scope.\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * Add an event processor that will be called before an event is sent.\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * Set the user for this scope.\n * Set to `null` to unset the user.\n */\n public setUser(user: User | null): this {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the user from this scope.\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * Set the conversation ID for this scope.\n * Set to `null` to unset the conversation ID.\n */\n public setConversationId(conversationId: string | null | undefined): this {\n this._conversationId = conversationId || undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set an object that will be merged into existing tags on the scope,\n * and will be sent as tags data with the event.\n */\n public setTags(tags: { [key: string]: Primitive }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single tag that will be sent as tags data with the event.\n */\n public setTag(key: string, value: Primitive): this {\n return this.setTags({ [key]: value });\n }\n\n /**\n * Sets attributes onto the scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param newAttributes - The attributes to set on the scope, as key-value pairs.\n *\n * @example\n * ```typescript\n * scope.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: 150,\n * });\n * ```\n */\n public setAttributes<T extends Record<string, unknown>>(newAttributes: RawAttributes<T>): this {\n this._attributes = {\n ...this._attributes,\n ...newAttributes,\n };\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets an attribute onto the scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param key - The attribute key.\n * @param value - The attribute value.\n *\n * @example\n * ```typescript\n * scope.setAttribute('is_admin', true);\n * scope.setAttribute('render_duration', 150);\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setAttribute<T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown>(\n key: string,\n value: RawAttribute<T>,\n ): this {\n return this.setAttributes({ [key]: value });\n }\n\n /**\n * Removes the attribute with the given key from the scope.\n *\n * @param key - The attribute key.\n *\n * @example\n * ```typescript\n * scope.removeAttribute('is_admin');\n * ```\n */\n public removeAttribute(key: string): this {\n if (key in this._attributes) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._attributes[key];\n this._notifyScopeListeners();\n }\n return this;\n }\n\n /**\n * Set an object that will be merged into existing extra on the scope,\n * and will be sent as extra data with the event.\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single key:value extra entry that will be sent as extra data with the event.\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the fingerprint on the scope to send with the events.\n * @param {string[]} fingerprint Fingerprint to group events in Sentry.\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the level on the scope for future events.\n */\n public setLevel(level: SeverityLevel): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope so that the name of e.g. taken server route or\n * the page location is attached to future events.\n *\n * IMPORTANT: Calling this function does NOT change the name of the currently active\n * root span. If you want to change the name of the active root span, use\n * `Sentry.updateSpanName(rootSpan, 'new name')` instead.\n *\n * By default, the SDK updates the scope's transaction name automatically on sensible\n * occasions, such as a page navigation or when handling a new request on the server.\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets context data with the given name.\n * Data passed as context will be normalized. You can also pass `null` to unset the context.\n * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set the session for the scope.\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the session from the scope.\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * Updates the scope with provided data. Can work in three variations:\n * - plain object containing updatable attributes\n * - Scope instance that'll extract the attributes from\n * - callback function that'll receive the current scope as an argument and allow for modifications\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n const scopeInstance =\n scopeToMerge instanceof Scope\n ? scopeToMerge.getScopeData()\n : isPlainObject(scopeToMerge)\n ? (captureContext as ScopeContext)\n : undefined;\n\n const {\n tags,\n attributes,\n extra,\n user,\n contexts,\n level,\n fingerprint = [],\n propagationContext,\n conversationId,\n } = scopeInstance || {};\n\n this._tags = { ...this._tags, ...tags };\n this._attributes = { ...this._attributes, ...attributes };\n this._extra = { ...this._extra, ...extra };\n this._contexts = { ...this._contexts, ...contexts };\n\n if (user && Object.keys(user).length) {\n this._user = user;\n }\n\n if (level) {\n this._level = level;\n }\n\n if (fingerprint.length) {\n this._fingerprint = fingerprint;\n }\n\n if (propagationContext) {\n this._propagationContext = propagationContext;\n }\n\n if (conversationId) {\n this._conversationId = conversationId;\n }\n\n return this;\n }\n\n /**\n * Clears the current scope and resets its properties.\n * Note: The client will not be cleared.\n */\n public clear(): this {\n // client is not cleared here on purpose!\n this._breadcrumbs = [];\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._session = undefined;\n this._conversationId = undefined;\n _setSpanForScope(this, undefined);\n this._attachments = [];\n this.setPropagationContext({\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n });\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Adds a breadcrumb to the scope.\n * By default, the last 100 breadcrumbs are kept.\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb: Breadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory\n message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,\n };\n\n this._breadcrumbs.push(mergedBreadcrumb);\n if (this._breadcrumbs.length > maxCrumbs) {\n this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);\n this._client?.recordDroppedEvent('buffer_overflow', 'log_item');\n }\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * Get the last breadcrumb of the scope.\n */\n public getLastBreadcrumb(): Breadcrumb | undefined {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * Clear all breadcrumbs from the scope.\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Add an attachment to the scope.\n */\n public addAttachment(attachment: Attachment): this {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * Clear all attachments from the scope.\n */\n public clearAttachments(): this {\n this._attachments = [];\n return this;\n }\n\n /**\n * Get the data of this scope, which should be applied to an event during processing.\n */\n public getScopeData(): ScopeData {\n return {\n breadcrumbs: this._breadcrumbs,\n attachments: this._attachments,\n contexts: this._contexts,\n tags: this._tags,\n attributes: this._attributes,\n extra: this._extra,\n user: this._user,\n level: this._level,\n fingerprint: this._fingerprint || [],\n eventProcessors: this._eventProcessors,\n propagationContext: this._propagationContext,\n sdkProcessingMetadata: this._sdkProcessingMetadata,\n transactionName: this._transactionName,\n span: _getSpanForScope(this),\n conversationId: this._conversationId,\n };\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry.\n */\n public setSDKProcessingMetadata(newData: SdkProcessingMetadata): this {\n this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);\n return this;\n }\n\n /**\n * Add propagation context to the scope, used for distributed tracing\n */\n public setPropagationContext(context: PropagationContext): this {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * Get propagation context from the scope, used for distributed tracing\n */\n public getPropagationContext(): PropagationContext {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @returns {string} The id of the captured Sentry event.\n */\n public captureException(exception: unknown, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @returns {string} The id of the captured message.\n */\n public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = hint?.syntheticException ?? new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a Sentry event for this scope.\n *\n * @returns {string} The id of the captured event.\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = event.event_id || hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n"],"names":["generateTraceId","safeMathRandom","_setSpanForScope","_getSpanForScope","updateSession","isPlainObject","dateTimestampInSeconds","truncate","merge","uuid4","DEBUG_BUILD","debug"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,uBAAA,GAA0B,GAAA;AA8DzB,MAAM,KAAA,CAAM;AAAA;AAAA,EAoEV,WAAA,GAAc;AACnB,IAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAC3B,IAAA,IAAA,CAAK,kBAAkB,EAAC;AACxB,IAAA,IAAA,CAAK,mBAAmB,EAAC;AACzB,IAAA,IAAA,CAAK,eAAe,EAAC;AACrB,IAAA,IAAA,CAAK,eAAe,EAAC;AACrB,IAAA,IAAA,CAAK,QAAQ,EAAC;AACd,IAAA,IAAA,CAAK,QAAQ,EAAC;AACd,IAAA,IAAA,CAAK,cAAc,EAAC;AACpB,IAAA,IAAA,CAAK,SAAS,EAAC;AACf,IAAA,IAAA,CAAK,YAAY,EAAC;AAClB,IAAA,IAAA,CAAK,yBAAyB,EAAC;AAC/B,IAAA,IAAA,CAAK,mBAAA,GAAsB;AAAA,MACzB,SAASA,kCAAA,EAAgB;AAAA,MACzB,YAAYC,gCAAA;AAAe,KAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,KAAA,GAAe;AACpB,IAAA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-21,3 +21,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const defaultScopes = require('./defaultScopes.js'); | ||
| const index$7 = require('./asyncContext/index.js'); | ||
| const index = require('./asyncContext/index.js'); | ||
| const carrier = require('./carrier.js'); | ||
@@ -61,2 +61,3 @@ const session = require('./session.js'); | ||
| const constants$1 = require('./constants.js'); | ||
| const spanKind = require('./spanKind.js'); | ||
| const breadcrumbs = require('./breadcrumbs.js'); | ||
@@ -88,15 +89,15 @@ const functiontostring = require('./integrations/functiontostring.js'); | ||
| const consola = require('./integrations/consola.js'); | ||
| const index = require('./tracing/vercel-ai/index.js'); | ||
| const index$1 = require('./tracing/vercel-ai/index.js'); | ||
| const utils = require('./tracing/vercel-ai/utils.js'); | ||
| const constants$7 = require('./tracing/vercel-ai/constants.js'); | ||
| const index$6 = require('./tracing/openai/index.js'); | ||
| const index$7 = require('./tracing/openai/index.js'); | ||
| const constants$6 = require('./tracing/openai/constants.js'); | ||
| const index$3 = require('./tracing/anthropic-ai/index.js'); | ||
| const index$4 = require('./tracing/anthropic-ai/index.js'); | ||
| const constants = require('./tracing/anthropic-ai/constants.js'); | ||
| const index$5 = require('./tracing/google-genai/index.js'); | ||
| const index$6 = require('./tracing/google-genai/index.js'); | ||
| const constants$2 = require('./tracing/google-genai/constants.js'); | ||
| const index$1 = require('./tracing/langchain/index.js'); | ||
| const index$2 = require('./tracing/langchain/index.js'); | ||
| const utils$1 = require('./tracing/langchain/utils.js'); | ||
| const constants$4 = require('./tracing/langchain/constants.js'); | ||
| const index$4 = require('./tracing/langgraph/index.js'); | ||
| const index$5 = require('./tracing/langgraph/index.js'); | ||
| const constants$5 = require('./tracing/langgraph/constants.js'); | ||
@@ -157,4 +158,5 @@ const spanBuffer = require('./tracing/spans/spanBuffer.js'); | ||
| const timer = require('./utils/timer.js'); | ||
| const index$2 = require('./integrations/express/index.js'); | ||
| const index$3 = require('./integrations/express/index.js'); | ||
| const postgresjs = require('./integrations/postgresjs.js'); | ||
| const sql = require('./utils/sql.js'); | ||
| const clientPatch = require('./integrations/http/client-patch.js'); | ||
@@ -249,2 +251,4 @@ const clientSubscriptions = require('./integrations/http/client-subscriptions.js'); | ||
| exports.lastEventId = exports$1.lastEventId; | ||
| exports.setAttribute = exports$1.setAttribute; | ||
| exports.setAttributes = exports$1.setAttributes; | ||
| exports.setContext = exports$1.setContext; | ||
@@ -271,3 +275,5 @@ exports.setConversationId = exports$1.setConversationId; | ||
| exports.getDefaultIsolationScope = defaultScopes.getDefaultIsolationScope; | ||
| exports.setAsyncContextStrategy = index$7.setAsyncContextStrategy; | ||
| exports._INTERNAL_createTracingChannelBinding = index._INTERNAL_createTracingChannelBinding; | ||
| exports._INTERNAL_getTracingChannelBinding = index.getTracingChannelBinding; | ||
| exports.setAsyncContextStrategy = index.setAsyncContextStrategy; | ||
| exports.getGlobalSingleton = carrier.getGlobalSingleton; | ||
@@ -351,2 +357,3 @@ exports.getMainCarrier = carrier.getMainCarrier; | ||
| exports.DEV_ENVIRONMENT = constants$1.DEV_ENVIRONMENT; | ||
| exports.SPAN_KIND = spanKind.SPAN_KIND; | ||
| exports.addBreadcrumb = breadcrumbs.addBreadcrumb; | ||
@@ -385,18 +392,18 @@ exports.functionToStringIntegration = functiontostring.functionToStringIntegration; | ||
| exports.createConsolaReporter = consola.createConsolaReporter; | ||
| exports.addVercelAiProcessors = index.addVercelAiProcessors; | ||
| exports.addVercelAiProcessors = index$1.addVercelAiProcessors; | ||
| exports._INTERNAL_cleanupToolCallSpanContext = utils._INTERNAL_cleanupToolCallSpanContext; | ||
| exports._INTERNAL_getSpanContextForToolCallId = utils._INTERNAL_getSpanContextForToolCallId; | ||
| exports._INTERNAL_toolCallSpanContextMap = constants$7.toolCallSpanContextMap; | ||
| exports.instrumentOpenAiClient = index$6.instrumentOpenAiClient; | ||
| exports.instrumentOpenAiClient = index$7.instrumentOpenAiClient; | ||
| exports.OPENAI_INTEGRATION_NAME = constants$6.OPENAI_INTEGRATION_NAME; | ||
| exports.instrumentAnthropicAiClient = index$3.instrumentAnthropicAiClient; | ||
| exports.instrumentAnthropicAiClient = index$4.instrumentAnthropicAiClient; | ||
| exports.ANTHROPIC_AI_INTEGRATION_NAME = constants.ANTHROPIC_AI_INTEGRATION_NAME; | ||
| exports.instrumentGoogleGenAIClient = index$5.instrumentGoogleGenAIClient; | ||
| exports.instrumentGoogleGenAIClient = index$6.instrumentGoogleGenAIClient; | ||
| exports.GOOGLE_GENAI_INTEGRATION_NAME = constants$2.GOOGLE_GENAI_INTEGRATION_NAME; | ||
| exports.createLangChainCallbackHandler = index$1.createLangChainCallbackHandler; | ||
| exports.createLangChainCallbackHandler = index$2.createLangChainCallbackHandler; | ||
| exports._INTERNAL_mergeLangChainCallbackHandler = utils$1._INTERNAL_mergeLangChainCallbackHandler; | ||
| exports.LANGCHAIN_INTEGRATION_NAME = constants$4.LANGCHAIN_INTEGRATION_NAME; | ||
| exports.instrumentCreateReactAgent = index$4.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$4.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$4.instrumentStateGraphCompile; | ||
| exports.instrumentCreateReactAgent = index$5.instrumentCreateReactAgent; | ||
| exports.instrumentLangGraph = index$5.instrumentLangGraph; | ||
| exports.instrumentStateGraphCompile = index$5.instrumentStateGraphCompile; | ||
| exports.LANGGRAPH_INTEGRATION_NAME = constants$5.LANGGRAPH_INTEGRATION_NAME; | ||
@@ -573,6 +580,8 @@ exports.SpanBuffer = spanBuffer.SpanBuffer; | ||
| exports._INTERNAL_safeUnref = timer.safeUnref; | ||
| exports.expressErrorHandler = index$2.expressErrorHandler; | ||
| exports.patchExpressModule = index$2.patchExpressModule; | ||
| exports.setupExpressErrorHandler = index$2.setupExpressErrorHandler; | ||
| exports.expressErrorHandler = index$3.expressErrorHandler; | ||
| exports.patchExpressModule = index$3.patchExpressModule; | ||
| exports.setupExpressErrorHandler = index$3.setupExpressErrorHandler; | ||
| exports._INTERNAL_sanitizeSqlQuery = postgresjs._sanitizeSqlQuery; | ||
| exports.instrumentPostgresJsSql = postgresjs.instrumentPostgresJsSql; | ||
| exports._INTERNAL_getSqlQuerySummary = sql.getSqlQuerySummary; | ||
| exports.patchHttpModuleClient = clientPatch.patchHttpModuleClient; | ||
@@ -579,0 +588,0 @@ exports.getHttpClientSubscriptions = clientSubscriptions.getHttpClientSubscriptions; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -26,3 +26,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| } | ||
| return !hasSpanStreamingEnabled.hasSpanStreamingEnabled(client) && !client.getOptions().streamGenAiSpans; | ||
| return !hasSpanStreamingEnabled.hasSpanStreamingEnabled(client) && client.getOptions().streamGenAiSpans === false; | ||
| } | ||
@@ -29,0 +29,0 @@ function buildMethodPath(currentPath, prop) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"utils.js","sources":["../../../../src/tracing/ai/utils.ts"],"sourcesContent":["/**\n * Shared utils for AI integrations (OpenAI, Anthropic, Verce.AI, etc.)\n */\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { hasSpanStreamingEnabled } from '../spans/hasSpanStreamingEnabled';\nimport type { Span } from '../../types/span';\nimport { isThenable } from '../../utils/is';\nimport {\n GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_STREAMING_ATTRIBUTE,\n GEN_AI_RESPONSE_TEXT_ATTRIBUTE,\n GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,\n} from './gen-ai-attributes';\nimport { truncateGenAiMessages, truncateGenAiStringInput } from './messageTruncation';\n\nexport interface AIRecordingOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n}\n\n/**\n * A method registry entry describes a single instrumented method:\n * which gen_ai operation it maps to and whether it is intrinsically streaming.\n */\nexport interface InstrumentedMethodEntry {\n /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */\n operation?: string;\n /** True if the method itself is always streaming (not param-based) */\n streaming?: boolean;\n /** When set, the method's return value is re-proxied with this as the base path */\n proxyResultPath?: string;\n}\n\n/**\n * Maps method paths to their registry entries.\n * Used by proxy-based AI client instrumentations to determine which methods\n * to instrument, what operation name to use, and whether they stream.\n */\nexport type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>;\n\n/**\n * Resolves AI recording options by falling back to the client's `dataCollection.genAI` settings.\n * Precedence: explicit option > dataCollection.genAI > sendDefaultPii > false\n */\nexport function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions> {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n return {\n ...options,\n recordInputs: options?.recordInputs ?? genAI?.inputs ?? false,\n recordOutputs: options?.recordOutputs ?? genAI?.outputs ?? false,\n } as T & Required<AIRecordingOptions>;\n}\n\n/**\n * Resolves whether truncation should be enabled.\n * If the user explicitly set `enableTruncation`, that value is used.\n * Otherwise, truncation is disabled whenever gen_ai spans are sent through the span streaming / v2\n * span path, i.e. full span streaming (`traceLifecycle: 'stream'`) or `streamGenAiSpans`. That path\n * is not subject to the transaction payload-size limits that truncation works around, so the full\n * message data can be retained.\n */\nexport function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean {\n if (enableTruncation !== undefined) {\n return enableTruncation;\n }\n\n const client = getClient();\n if (!client) {\n return true;\n }\n\n return !hasSpanStreamingEnabled(client) && !client.getOptions().streamGenAiSpans;\n}\n\n/**\n * Build method path from current traversal\n */\nexport function buildMethodPath(currentPath: string, prop: string): string {\n return currentPath ? `${currentPath}.${prop}` : prop;\n}\n\n/**\n * Set token usage attributes\n * @param span - The span to add attributes to\n * @param promptTokens - The number of prompt tokens\n * @param completionTokens - The number of completion tokens\n * @param cachedInputTokens - The number of cached input tokens\n * @param cachedOutputTokens - The number of cached output tokens\n */\nexport function setTokenUsageAttributes(\n span: Span,\n promptTokens?: number,\n completionTokens?: number,\n cachedInputTokens?: number,\n cachedOutputTokens?: number,\n): void {\n if (promptTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: promptTokens,\n });\n }\n if (completionTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: completionTokens,\n });\n }\n if (\n promptTokens !== undefined ||\n completionTokens !== undefined ||\n cachedInputTokens !== undefined ||\n cachedOutputTokens !== undefined\n ) {\n /**\n * Total input tokens in a request is the summation of `input_tokens`,\n * `cache_creation_input_tokens`, and `cache_read_input_tokens`.\n */\n const totalTokens =\n (promptTokens ?? 0) + (completionTokens ?? 0) + (cachedInputTokens ?? 0) + (cachedOutputTokens ?? 0);\n\n span.setAttributes({\n [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: totalTokens,\n });\n }\n}\n\nexport interface StreamResponseState {\n responseId?: string;\n responseModel?: string;\n finishReasons: string[];\n responseTexts: string[];\n toolCalls: unknown[];\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n cacheCreationInputTokens?: number;\n cacheReadInputTokens?: number;\n}\n\n/**\n * Ends a streaming span by setting all accumulated response attributes and ending the span.\n * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.\n */\nexport function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void {\n if (!span.isRecording()) {\n return;\n }\n\n const attrs: Record<string, string | number | boolean> = {\n [GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true,\n };\n\n if (state.responseId) attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;\n if (state.responseModel) attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;\n\n if (state.promptTokens !== undefined) attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;\n if (state.completionTokens !== undefined) attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;\n\n // Use explicit total if provided (OpenAI, Google), otherwise compute from cache tokens (Anthropic)\n if (state.totalTokens !== undefined) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;\n } else if (\n state.promptTokens !== undefined ||\n state.completionTokens !== undefined ||\n state.cacheCreationInputTokens !== undefined ||\n state.cacheReadInputTokens !== undefined\n ) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] =\n (state.promptTokens ?? 0) +\n (state.completionTokens ?? 0) +\n (state.cacheCreationInputTokens ?? 0) +\n (state.cacheReadInputTokens ?? 0);\n }\n\n if (state.finishReasons.length) {\n attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);\n }\n if (recordOutputs && state.responseTexts.length) {\n attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join('');\n }\n if (recordOutputs && state.toolCalls.length) {\n attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);\n }\n\n span.setAttributes(attrs);\n span.end();\n}\n\n/**\n * Serialize a value to a JSON string without truncation.\n * Strings are returned as-is, arrays and objects are JSON-stringified.\n */\nexport function getJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n return value;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Get the truncated JSON string for a string or array of strings.\n *\n * @param value - The string or array of strings to truncate\n * @returns The truncated JSON string\n */\nexport function getTruncatedJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n // Some values are already JSON strings, so we don't need to duplicate the JSON parsing\n return truncateGenAiStringInput(value);\n }\n if (Array.isArray(value)) {\n // truncateGenAiMessages returns an array of strings, so we need to stringify it\n const truncatedMessages = truncateGenAiMessages(value);\n return JSON.stringify(truncatedMessages);\n }\n // value is an object, so we need to stringify it\n return JSON.stringify(value);\n}\n\n/**\n * Extract system instructions from messages array.\n * Finds the first system message and formats it according to OpenTelemetry semantic conventions.\n *\n * @param messages - Array of messages to extract system instructions from\n * @returns systemInstructions (JSON string) and filteredMessages (without system message)\n */\nexport function extractSystemInstructions(messages: unknown[] | unknown): {\n systemInstructions: string | undefined;\n filteredMessages: unknown[] | unknown;\n} {\n if (!Array.isArray(messages)) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessageIndex = messages.findIndex(\n msg => msg && typeof msg === 'object' && 'role' in msg && (msg as { role: string }).role === 'system',\n );\n\n if (systemMessageIndex === -1) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessage = messages[systemMessageIndex] as { role: string; content?: string | unknown };\n const systemContent =\n typeof systemMessage.content === 'string'\n ? systemMessage.content\n : systemMessage.content !== undefined\n ? JSON.stringify(systemMessage.content)\n : undefined;\n\n if (!systemContent) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemInstructions = JSON.stringify([{ type: 'text', content: systemContent }]);\n const filteredMessages = [...messages.slice(0, systemMessageIndex), ...messages.slice(systemMessageIndex + 1)];\n\n return { systemInstructions, filteredMessages };\n}\n\n/**\n * Creates a wrapped version of .withResponse() that replaces the data field\n * with the instrumented result while preserving metadata (response, request_id).\n */\nasync function createWithResponseWrapper<T>(\n originalWithResponse: Promise<unknown>,\n instrumentedPromise: Promise<T>,\n mechanismType: string,\n): Promise<unknown> {\n // Attach catch handler to originalWithResponse immediately to prevent unhandled rejection\n // If instrumentedPromise rejects first, we still need this handled\n const safeOriginalWithResponse = originalWithResponse.catch(error => {\n captureException(error, {\n mechanism: {\n handled: false,\n type: mechanismType,\n },\n });\n throw error;\n });\n\n const instrumentedResult = await instrumentedPromise;\n const originalWrapper = await safeOriginalWithResponse;\n\n // Combine instrumented result with original metadata\n if (originalWrapper && typeof originalWrapper === 'object' && 'data' in originalWrapper) {\n return {\n ...originalWrapper,\n data: instrumentedResult,\n };\n }\n return instrumentedResult;\n}\n\n/**\n * Wraps a promise-like object to preserve additional methods (like .withResponse())\n * that AI SDK clients (OpenAI, Anthropic) attach to their APIPromise return values.\n *\n * Standard Promise methods (.then, .catch, .finally) are routed to the instrumented\n * promise to preserve Sentry's span instrumentation, while custom SDK methods are\n * forwarded to the original promise to maintain the SDK's API surface.\n */\nexport function wrapPromiseWithMethods<R>(\n originalPromiseLike: Promise<R>,\n instrumentedPromise: Promise<R>,\n mechanismType: string,\n): Promise<R> {\n // If the original result is not thenable, return the instrumented promise\n if (!isThenable(originalPromiseLike)) {\n return instrumentedPromise;\n }\n\n // Create a proxy that forwards Promise methods to instrumentedPromise\n // and preserves additional methods from the original result\n return new Proxy(originalPromiseLike, {\n get(target: object, prop: string | symbol): unknown {\n // For standard Promise methods (.then, .catch, .finally, Symbol.toStringTag),\n // use instrumentedPromise to preserve Sentry instrumentation.\n // For custom methods (like .withResponse()), use the original target.\n const useInstrumentedPromise = prop in Promise.prototype || prop === Symbol.toStringTag;\n const source = useInstrumentedPromise ? instrumentedPromise : target;\n\n const value = Reflect.get(source, prop) as unknown;\n\n // Special handling for .withResponse() to preserve instrumentation\n // .withResponse() returns { data: T, response: Response, request_id: string }\n if (prop === 'withResponse' && typeof value === 'function') {\n return function wrappedWithResponse(this: unknown): unknown {\n const originalWithResponse = (value as (...args: unknown[]) => unknown).call(target);\n return createWithResponseWrapper(originalWithResponse, instrumentedPromise, mechanismType);\n };\n }\n\n return typeof value === 'function' ? value.bind(source) : value;\n },\n }) as Promise<R>;\n}\n"],"names":["getClient","hasSpanStreamingEnabled","GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE","GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE","GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE","GEN_AI_RESPONSE_STREAMING_ATTRIBUTE","GEN_AI_RESPONSE_ID_ATTRIBUTE","GEN_AI_RESPONSE_MODEL_ATTRIBUTE","GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE","GEN_AI_RESPONSE_TEXT_ATTRIBUTE","GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE","truncateGenAiStringInput","truncateGenAiMessages","captureException","isThenable"],"mappings":";;;;;;;;;AAkDO,SAAS,0BAAwD,OAAA,EAA+C;AACrH,EAAA,MAAM,KAAA,GAAQA,uBAAA,EAAU,EAAG,wBAAA,EAAyB,CAAE,KAAA;AACtD,EAAA,OAAO;AAAA,IACL,GAAG,OAAA;AAAA,IACH,YAAA,EAAc,OAAA,EAAS,YAAA,IAAgB,KAAA,EAAO,MAAA,IAAU,KAAA;AAAA,IACxD,aAAA,EAAe,OAAA,EAAS,aAAA,IAAiB,KAAA,EAAO,OAAA,IAAW;AAAA,GAC7D;AACF;AAUO,SAAS,uBAAuB,gBAAA,EAAgD;AACrF,EAAA,IAAI,qBAAqB,MAAA,EAAW;AAClC,IAAA,OAAO,gBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAASA,uBAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAACC,+CAAA,CAAwB,MAAM,KAAK,CAAC,MAAA,CAAO,YAAW,CAAE,gBAAA;AAClE;AAKO,SAAS,eAAA,CAAgB,aAAqB,IAAA,EAAsB;AACzE,EAAA,OAAO,WAA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AA,EAAqB;AAAA,IACpC,GAAA,CAAI,QAAgB,IAAA,EAAgC;AAIlD,MAAA,MAAM,sBAAA,GAAyB,IAAA,IAAQ,OAAA,CAAQ,SAAA,IAAa,SAAS,MAAA,CAAO,WAAA;AAC5E,MAAA,MAAM,MAAA,GAAS,yBAAyB,mBAAA,GAAsB,MAAA;AAE9D,MAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,IAAI,CAAA;AAItC,MAAA,IAAI,IAAA,KAAS,cAAA,IAAkB,OAAO,KAAA,KAAU,UAAA,EAAY;AAC1D,QAAA,OAAO,SAAS,mBAAA,GAA4C;AAC1D,UAAA,MAAM,oBAAA,GAAwB,KAAA,CAA0C,IAAA,CAAK,MAAM,CAAA;AACnF,UAAA,OAAO,yBAAA,CAA0B,oBAAA,EAAsB,mBAAA,EAAqB,aAAa,CAAA;AAAA,QAC3F,CAAA;AAAA,MACF;AAEA,MAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH;;;;;;;;;;;;"} | ||
| {"version":3,"file":"utils.js","sources":["../../../../src/tracing/ai/utils.ts"],"sourcesContent":["/**\n * Shared utils for AI integrations (OpenAI, Anthropic, Verce.AI, etc.)\n */\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { hasSpanStreamingEnabled } from '../spans/hasSpanStreamingEnabled';\nimport type { Span } from '../../types/span';\nimport { isThenable } from '../../utils/is';\nimport {\n GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_STREAMING_ATTRIBUTE,\n GEN_AI_RESPONSE_TEXT_ATTRIBUTE,\n GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,\n} from './gen-ai-attributes';\nimport { truncateGenAiMessages, truncateGenAiStringInput } from './messageTruncation';\n\nexport interface AIRecordingOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n}\n\n/**\n * A method registry entry describes a single instrumented method:\n * which gen_ai operation it maps to and whether it is intrinsically streaming.\n */\nexport interface InstrumentedMethodEntry {\n /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */\n operation?: string;\n /** True if the method itself is always streaming (not param-based) */\n streaming?: boolean;\n /** When set, the method's return value is re-proxied with this as the base path */\n proxyResultPath?: string;\n}\n\n/**\n * Maps method paths to their registry entries.\n * Used by proxy-based AI client instrumentations to determine which methods\n * to instrument, what operation name to use, and whether they stream.\n */\nexport type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>;\n\n/**\n * Resolves AI recording options by falling back to the client's `dataCollection.genAI` settings.\n * Precedence: explicit option > dataCollection.genAI > sendDefaultPii > false\n */\nexport function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions> {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n return {\n ...options,\n recordInputs: options?.recordInputs ?? genAI?.inputs ?? false,\n recordOutputs: options?.recordOutputs ?? genAI?.outputs ?? false,\n } as T & Required<AIRecordingOptions>;\n}\n\n/**\n * Resolves whether truncation should be enabled.\n * If the user explicitly set `enableTruncation`, that value is used.\n * Otherwise, truncation is disabled whenever gen_ai spans are sent through the span streaming / v2\n * span path, i.e. full span streaming (`traceLifecycle: 'stream'`) or `streamGenAiSpans`. That path\n * is not subject to the transaction payload-size limits that truncation works around, so the full\n * message data can be retained. `streamGenAiSpans` is opt-out (on unless explicitly set to `false`).\n */\nexport function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean {\n if (enableTruncation !== undefined) {\n return enableTruncation;\n }\n\n const client = getClient();\n if (!client) {\n return true;\n }\n\n return !hasSpanStreamingEnabled(client) && client.getOptions().streamGenAiSpans === false;\n}\n\n/**\n * Build method path from current traversal\n */\nexport function buildMethodPath(currentPath: string, prop: string): string {\n return currentPath ? `${currentPath}.${prop}` : prop;\n}\n\n/**\n * Set token usage attributes\n * @param span - The span to add attributes to\n * @param promptTokens - The number of prompt tokens\n * @param completionTokens - The number of completion tokens\n * @param cachedInputTokens - The number of cached input tokens\n * @param cachedOutputTokens - The number of cached output tokens\n */\nexport function setTokenUsageAttributes(\n span: Span,\n promptTokens?: number,\n completionTokens?: number,\n cachedInputTokens?: number,\n cachedOutputTokens?: number,\n): void {\n if (promptTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: promptTokens,\n });\n }\n if (completionTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: completionTokens,\n });\n }\n if (\n promptTokens !== undefined ||\n completionTokens !== undefined ||\n cachedInputTokens !== undefined ||\n cachedOutputTokens !== undefined\n ) {\n /**\n * Total input tokens in a request is the summation of `input_tokens`,\n * `cache_creation_input_tokens`, and `cache_read_input_tokens`.\n */\n const totalTokens =\n (promptTokens ?? 0) + (completionTokens ?? 0) + (cachedInputTokens ?? 0) + (cachedOutputTokens ?? 0);\n\n span.setAttributes({\n [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: totalTokens,\n });\n }\n}\n\nexport interface StreamResponseState {\n responseId?: string;\n responseModel?: string;\n finishReasons: string[];\n responseTexts: string[];\n toolCalls: unknown[];\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n cacheCreationInputTokens?: number;\n cacheReadInputTokens?: number;\n}\n\n/**\n * Ends a streaming span by setting all accumulated response attributes and ending the span.\n * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.\n */\nexport function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void {\n if (!span.isRecording()) {\n return;\n }\n\n const attrs: Record<string, string | number | boolean> = {\n [GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true,\n };\n\n if (state.responseId) attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;\n if (state.responseModel) attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;\n\n if (state.promptTokens !== undefined) attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;\n if (state.completionTokens !== undefined) attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;\n\n // Use explicit total if provided (OpenAI, Google), otherwise compute from cache tokens (Anthropic)\n if (state.totalTokens !== undefined) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;\n } else if (\n state.promptTokens !== undefined ||\n state.completionTokens !== undefined ||\n state.cacheCreationInputTokens !== undefined ||\n state.cacheReadInputTokens !== undefined\n ) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] =\n (state.promptTokens ?? 0) +\n (state.completionTokens ?? 0) +\n (state.cacheCreationInputTokens ?? 0) +\n (state.cacheReadInputTokens ?? 0);\n }\n\n if (state.finishReasons.length) {\n attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);\n }\n if (recordOutputs && state.responseTexts.length) {\n attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join('');\n }\n if (recordOutputs && state.toolCalls.length) {\n attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);\n }\n\n span.setAttributes(attrs);\n span.end();\n}\n\n/**\n * Serialize a value to a JSON string without truncation.\n * Strings are returned as-is, arrays and objects are JSON-stringified.\n */\nexport function getJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n return value;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Get the truncated JSON string for a string or array of strings.\n *\n * @param value - The string or array of strings to truncate\n * @returns The truncated JSON string\n */\nexport function getTruncatedJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n // Some values are already JSON strings, so we don't need to duplicate the JSON parsing\n return truncateGenAiStringInput(value);\n }\n if (Array.isArray(value)) {\n // truncateGenAiMessages returns an array of strings, so we need to stringify it\n const truncatedMessages = truncateGenAiMessages(value);\n return JSON.stringify(truncatedMessages);\n }\n // value is an object, so we need to stringify it\n return JSON.stringify(value);\n}\n\n/**\n * Extract system instructions from messages array.\n * Finds the first system message and formats it according to OpenTelemetry semantic conventions.\n *\n * @param messages - Array of messages to extract system instructions from\n * @returns systemInstructions (JSON string) and filteredMessages (without system message)\n */\nexport function extractSystemInstructions(messages: unknown[] | unknown): {\n systemInstructions: string | undefined;\n filteredMessages: unknown[] | unknown;\n} {\n if (!Array.isArray(messages)) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessageIndex = messages.findIndex(\n msg => msg && typeof msg === 'object' && 'role' in msg && (msg as { role: string }).role === 'system',\n );\n\n if (systemMessageIndex === -1) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessage = messages[systemMessageIndex] as { role: string; content?: string | unknown };\n const systemContent =\n typeof systemMessage.content === 'string'\n ? systemMessage.content\n : systemMessage.content !== undefined\n ? JSON.stringify(systemMessage.content)\n : undefined;\n\n if (!systemContent) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemInstructions = JSON.stringify([{ type: 'text', content: systemContent }]);\n const filteredMessages = [...messages.slice(0, systemMessageIndex), ...messages.slice(systemMessageIndex + 1)];\n\n return { systemInstructions, filteredMessages };\n}\n\n/**\n * Creates a wrapped version of .withResponse() that replaces the data field\n * with the instrumented result while preserving metadata (response, request_id).\n */\nasync function createWithResponseWrapper<T>(\n originalWithResponse: Promise<unknown>,\n instrumentedPromise: Promise<T>,\n mechanismType: string,\n): Promise<unknown> {\n // Attach catch handler to originalWithResponse immediately to prevent unhandled rejection\n // If instrumentedPromise rejects first, we still need this handled\n const safeOriginalWithResponse = originalWithResponse.catch(error => {\n captureException(error, {\n mechanism: {\n handled: false,\n type: mechanismType,\n },\n });\n throw error;\n });\n\n const instrumentedResult = await instrumentedPromise;\n const originalWrapper = await safeOriginalWithResponse;\n\n // Combine instrumented result with original metadata\n if (originalWrapper && typeof originalWrapper === 'object' && 'data' in originalWrapper) {\n return {\n ...originalWrapper,\n data: instrumentedResult,\n };\n }\n return instrumentedResult;\n}\n\n/**\n * Wraps a promise-like object to preserve additional methods (like .withResponse())\n * that AI SDK clients (OpenAI, Anthropic) attach to their APIPromise return values.\n *\n * Standard Promise methods (.then, .catch, .finally) are routed to the instrumented\n * promise to preserve Sentry's span instrumentation, while custom SDK methods are\n * forwarded to the original promise to maintain the SDK's API surface.\n */\nexport function wrapPromiseWithMethods<R>(\n originalPromiseLike: Promise<R>,\n instrumentedPromise: Promise<R>,\n mechanismType: string,\n): Promise<R> {\n // If the original result is not thenable, return the instrumented promise\n if (!isThenable(originalPromiseLike)) {\n return instrumentedPromise;\n }\n\n // Create a proxy that forwards Promise methods to instrumentedPromise\n // and preserves additional methods from the original result\n return new Proxy(originalPromiseLike, {\n get(target: object, prop: string | symbol): unknown {\n // For standard Promise methods (.then, .catch, .finally, Symbol.toStringTag),\n // use instrumentedPromise to preserve Sentry instrumentation.\n // For custom methods (like .withResponse()), use the original target.\n const useInstrumentedPromise = prop in Promise.prototype || prop === Symbol.toStringTag;\n const source = useInstrumentedPromise ? instrumentedPromise : target;\n\n const value = Reflect.get(source, prop) as unknown;\n\n // Special handling for .withResponse() to preserve instrumentation\n // .withResponse() returns { data: T, response: Response, request_id: string }\n if (prop === 'withResponse' && typeof value === 'function') {\n return function wrappedWithResponse(this: unknown): unknown {\n const originalWithResponse = (value as (...args: unknown[]) => unknown).call(target);\n return createWithResponseWrapper(originalWithResponse, instrumentedPromise, mechanismType);\n };\n }\n\n return typeof value === 'function' ? value.bind(source) : value;\n },\n }) as Promise<R>;\n}\n"],"names":["getClient","hasSpanStreamingEnabled","GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE","GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE","GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE","GEN_AI_RESPONSE_STREAMING_ATTRIBUTE","GEN_AI_RESPONSE_ID_ATTRIBUTE","GEN_AI_RESPONSE_MODEL_ATTRIBUTE","GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE","GEN_AI_RESPONSE_TEXT_ATTRIBUTE","GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE","truncateGenAiStringInput","truncateGenAiMessages","captureException","isThenable"],"mappings":";;;;;;;;;AAkDO,SAAS,0BAAwD,OAAA,EAA+C;AACrH,EAAA,MAAM,KAAA,GAAQA,uBAAA,EAAU,EAAG,wBAAA,EAAyB,CAAE,KAAA;AACtD,EAAA,OAAO;AAAA,IACL,GAAG,OAAA;AAAA,IACH,YAAA,EAAc,OAAA,EAAS,YAAA,IAAgB,KAAA,EAAO,MAAA,IAAU,KAAA;AAAA,IACxD,aAAA,EAAe,OAAA,EAAS,aAAA,IAAiB,KAAA,EAAO,OAAA,IAAW;AAAA,GAC7D;AACF;AAUO,SAAS,uBAAuB,gBAAA,EAAgD;AACrF,EAAA,IAAI,qBAAqB,MAAA,EAAW;AAClC,IAAA,OAAO,gBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAASA,uBAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAACC,+CAAA,CAAwB,MAAM,KAAK,MAAA,CAAO,UAAA,GAAa,gBAAA,KAAqB,KAAA;AACtF;AAKO,SAAS,eAAA,CAAgB,aAAqB,IAAA,EAAsB;AACzE,EAAA,OAAO,WAAA,GAAc,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,IAAI,CAAA,CA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lD,MAAA,MAAM,sBAAA,GAAyB,IAAA,IAAQ,OAAA,CAAQ,SAAA,IAAa,SAAS,MAAA,CAAO,WAAA;AAC5E,MAAA,MAAM,MAAA,GAAS,yBAAyB,mBAAA,GAAsB,MAAA;AAE9D,MAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,IAAI,CAAA;AAItC,MAAA,IAAI,IAAA,KAAS,cAAA,IAAkB,OAAO,KAAA,KAAU,UAAA,EAAY;AAC1D,QAAA,OAAO,SAAS,mBAAA,GAA4C;AAC1D,UAAA,MAAM,oBAAA,GAAwB,KAAA,CAA0C,IAAA,CAAK,MAAM,CAAA;AACnF,UAAA,OAAO,yBAAA,CAA0B,oBAAA,EAAsB,mBAAA,EAAqB,aAAa,CAAA;AAAA,QAC3F,CAAA;AAAA,MACF;AAEA,MAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH;;;;;;;;;;;;"} |
@@ -8,3 +8,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| function extractGenAiSpansFromEvent(event, client) { | ||
| if (event.type !== "transaction" || !event.spans?.length || !event.sdkProcessingMetadata?.hasGenAiSpans || !client.getOptions().streamGenAiSpans || hasSpanStreamingEnabled.hasSpanStreamingEnabled(client)) { | ||
| if (event.type !== "transaction" || !event.spans?.length || !event.sdkProcessingMetadata?.hasGenAiSpans || client.getOptions().streamGenAiSpans === false || hasSpanStreamingEnabled.hasSpanStreamingEnabled(client)) { | ||
| return void 0; | ||
@@ -11,0 +11,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"extractGenAiSpans.js","sources":["../../../../src/tracing/spans/extractGenAiSpans.ts"],"sourcesContent":["import type { Client } from '../../client';\nimport type { SpanContainerItem } from '../../types/envelope';\nimport type { Event } from '../../types/event';\nimport { isBrowser } from '../../utils/isBrowser';\nimport { hasSpanStreamingEnabled } from './hasSpanStreamingEnabled';\nimport { spanJsonToSerializedStreamedSpan } from './spanJsonToStreamedSpan';\n\n/**\n * Extracts gen_ai spans from a transaction event, converts them to span v2 format,\n * and returns them as a SpanContainerItem.\n *\n * Only applies to static mode (non-streaming) transactions.\n *\n * WARNING: This function mutates `event.spans` by removing the extracted gen_ai spans\n * from the array. Call this before creating the event envelope so the transaction\n * item does not include the extracted spans.\n */\nexport function extractGenAiSpansFromEvent(event: Event, client: Client): SpanContainerItem | undefined {\n if (\n event.type !== 'transaction' ||\n !event.spans?.length ||\n !event.sdkProcessingMetadata?.hasGenAiSpans ||\n !client.getOptions().streamGenAiSpans ||\n hasSpanStreamingEnabled(client)\n ) {\n return undefined;\n }\n\n const genAiSpans = [];\n const remainingSpans = [];\n\n for (const span of event.spans) {\n if (span.op?.startsWith('gen_ai.')) {\n genAiSpans.push(spanJsonToSerializedStreamedSpan(span));\n } else {\n remainingSpans.push(span);\n }\n }\n\n if (genAiSpans.length === 0) {\n return undefined;\n }\n\n event.spans = remainingSpans;\n\n const inferSetting = client.getDataCollectionOptions().userInfo ? 'auto' : 'never';\n\n return [\n { type: 'span', item_count: genAiSpans.length, content_type: 'application/vnd.sentry.items.span.v2+json' },\n {\n version: 2,\n ...(isBrowser() && {\n ingest_settings: { infer_ip: inferSetting, infer_user_agent: inferSetting },\n }),\n items: genAiSpans,\n },\n ];\n}\n"],"names":["hasSpanStreamingEnabled","spanJsonToSerializedStreamedSpan","isBrowser"],"mappings":";;;;;;AAiBO,SAAS,0BAAA,CAA2B,OAAc,MAAA,EAA+C;AACtG,EAAA,IACE,MAAM,IAAA,KAAS,aAAA,IACf,CAAC,KAAA,CAAM,KAAA,EAAO,UACd,CAAC,KAAA,CAAM,qBAAA,EAAuB,aAAA,IAC9B,CAAC,MAAA,CAAO,UAAA,GAAa,gBAAA,IACrBA,+CAAA,CAAwB,MAAM,CAAA,EAC9B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,aAAa,EAAC;AACpB,EAAA,MAAM,iBAAiB,EAAC;AAExB,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,IAAI,IAAA,CAAK,EAAA,EAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAClC,MAAA,UAAA,CAAW,IAAA,CAAKC,uDAAA,CAAiC,IAAI,CAAC,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,cAAA,CAAe,KAAK,IAAI,CAAA;AAAA,IAC1B;AAAA,EACF;AAEA,EAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,KAAA,CAAM,KAAA,GAAQ,cAAA;AAEd,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAW,MAAA,GAAS,OAAA;AAE3E,EAAA,OAAO;AAAA,IACL,EAAE,IAAA,EAAM,MAAA,EAAQ,YAAY,UAAA,CAAW,MAAA,EAAQ,cAAc,2CAAA,EAA4C;AAAA,IACzG;AAAA,MACE,OAAA,EAAS,CAAA;AAAA,MACT,GAAIC,qBAAU,IAAK;AAAA,QACjB,eAAA,EAAiB,EAAE,QAAA,EAAU,YAAA,EAAc,kBAAkB,YAAA;AAAa,OAC5E;AAAA,MACA,KAAA,EAAO;AAAA;AACT,GACF;AACF;;;;"} | ||
| {"version":3,"file":"extractGenAiSpans.js","sources":["../../../../src/tracing/spans/extractGenAiSpans.ts"],"sourcesContent":["import type { Client } from '../../client';\nimport type { SpanContainerItem } from '../../types/envelope';\nimport type { Event } from '../../types/event';\nimport { isBrowser } from '../../utils/isBrowser';\nimport { hasSpanStreamingEnabled } from './hasSpanStreamingEnabled';\nimport { spanJsonToSerializedStreamedSpan } from './spanJsonToStreamedSpan';\n\n/**\n * Extracts gen_ai spans from a transaction event, converts them to span v2 format,\n * and returns them as a SpanContainerItem.\n *\n * Only applies to static mode (non-streaming) transactions.\n *\n * WARNING: This function mutates `event.spans` by removing the extracted gen_ai spans\n * from the array. Call this before creating the event envelope so the transaction\n * item does not include the extracted spans.\n */\nexport function extractGenAiSpansFromEvent(event: Event, client: Client): SpanContainerItem | undefined {\n if (\n event.type !== 'transaction' ||\n !event.spans?.length ||\n !event.sdkProcessingMetadata?.hasGenAiSpans ||\n client.getOptions().streamGenAiSpans === false ||\n hasSpanStreamingEnabled(client)\n ) {\n return undefined;\n }\n\n const genAiSpans = [];\n const remainingSpans = [];\n\n for (const span of event.spans) {\n if (span.op?.startsWith('gen_ai.')) {\n genAiSpans.push(spanJsonToSerializedStreamedSpan(span));\n } else {\n remainingSpans.push(span);\n }\n }\n\n if (genAiSpans.length === 0) {\n return undefined;\n }\n\n event.spans = remainingSpans;\n\n const inferSetting = client.getDataCollectionOptions().userInfo ? 'auto' : 'never';\n\n return [\n { type: 'span', item_count: genAiSpans.length, content_type: 'application/vnd.sentry.items.span.v2+json' },\n {\n version: 2,\n ...(isBrowser() && {\n ingest_settings: { infer_ip: inferSetting, infer_user_agent: inferSetting },\n }),\n items: genAiSpans,\n },\n ];\n}\n"],"names":["hasSpanStreamingEnabled","spanJsonToSerializedStreamedSpan","isBrowser"],"mappings":";;;;;;AAiBO,SAAS,0BAAA,CAA2B,OAAc,MAAA,EAA+C;AACtG,EAAA,IACE,MAAM,IAAA,KAAS,aAAA,IACf,CAAC,KAAA,CAAM,KAAA,EAAO,UACd,CAAC,KAAA,CAAM,qBAAA,EAAuB,aAAA,IAC9B,OAAO,UAAA,EAAW,CAAE,qBAAqB,KAAA,IACzCA,+CAAA,CAAwB,MAAM,CAAA,EAC9B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,aAAa,EAAC;AACpB,EAAA,MAAM,iBAAiB,EAAC;AAExB,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,IAAI,IAAA,CAAK,EAAA,EAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAClC,MAAA,UAAA,CAAW,IAAA,CAAKC,uDAAA,CAAiC,IAAI,CAAC,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,cAAA,CAAe,KAAK,IAAI,CAAA;AAAA,IAC1B;AAAA,EACF;AAEA,EAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,KAAA,CAAM,KAAA,GAAQ,cAAA;AAEd,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAW,MAAA,GAAS,OAAA;AAE3E,EAAA,OAAO;AAAA,IACL,EAAE,IAAA,EAAM,MAAA,EAAQ,YAAY,UAAA,CAAW,MAAA,EAAQ,cAAc,2CAAA,EAA4C;AAAA,IACzG;AAAA,MACE,OAAA,EAAS,CAAA;AAAA,MACT,GAAIC,qBAAU,IAAK;AAAA,QACjB,eAAA,EAAiB,EAAE,QAAA,EAAU,YAAA,EAAc,kBAAkB,YAAA;AAAa,OAC5E;AAAA,MACA,KAAA,EAAO;AAAA;AACT,GACF;AACF;;;;"} |
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| const SDK_VERSION = "10.60.0" ; | ||
| const SDK_VERSION = "10.61.0" ; | ||
| exports.SDK_VERSION = SDK_VERSION; | ||
| //# sourceMappingURL=version.js.map |
| import { getMainCarrier, getSentryCarrier } from '../carrier.js'; | ||
| import { _setSpanForScope } from '../utils/spanOnScope.js'; | ||
| import { getStackAsyncContextStrategy } from './stackStrategy.js'; | ||
@@ -16,4 +17,18 @@ | ||
| } | ||
| function getTracingChannelBinding() { | ||
| return getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.(); | ||
| } | ||
| function _INTERNAL_createTracingChannelBinding(asyncLocalStorage, getScopes) { | ||
| return { | ||
| asyncLocalStorage, | ||
| getStoreWithActiveSpan: (span) => { | ||
| const { scope, isolationScope } = getScopes(); | ||
| const activeScope = scope.clone(); | ||
| _setSpanForScope(activeScope, span); | ||
| return { scope: activeScope, isolationScope }; | ||
| } | ||
| }; | ||
| } | ||
| export { getAsyncContextStrategy, setAsyncContextStrategy }; | ||
| export { _INTERNAL_createTracingChannelBinding, getAsyncContextStrategy, getTracingChannelBinding, setAsyncContextStrategy }; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../../src/asyncContext/index.ts"],"sourcesContent":["import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,wBAAwB,QAAA,EAAkD;AAExF,EAAA,MAAM,WAAW,cAAA,EAAe;AAChC,EAAA,MAAM,MAAA,GAAS,iBAAiB,QAAQ,CAAA;AACxC,EAAA,MAAA,CAAO,GAAA,GAAM,QAAA;AACf;AAMO,SAAS,wBAAwB,OAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAAS,iBAAiB,OAAO,CAAA;AAEvC,EAAA,IAAI,OAAO,GAAA,EAAK;AACd,IAAA,OAAO,MAAA,CAAO,GAAA;AAAA,EAChB;AAGA,EAAA,OAAO,4BAAA,EAA6B;AACtC;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../../src/asyncContext/index.ts"],"sourcesContent":["import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport type { Scope } from './../scope';\nimport { _setSpanForScope } from './../utils/spanOnScope';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy, TracingChannelBinding } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n\n/**\n * Get the runtime binding needed to connect tracing channels to async context.\n */\nexport function getTracingChannelBinding(): TracingChannelBinding | undefined {\n return getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n}\n\n/**\n * Build the default {@link TracingChannelBinding} shared by AsyncLocalStorage-based strategies.\n *\n * The ALS instance is supplied by the caller (kept as `unknown`).\n * The binding clones the current scope, plants the span on it, and reuses the existing isolation scope.\n *\n * The OpenTelemetry strategy does not use this: its store value is an OTel context, not a\n * `{ scope, isolationScope }` pair.\n */\nexport function _INTERNAL_createTracingChannelBinding(\n asyncLocalStorage: unknown,\n getScopes: () => { scope: Scope; isolationScope: Scope },\n): TracingChannelBinding {\n return {\n asyncLocalStorage,\n getStoreWithActiveSpan: span => {\n const { scope, isolationScope } = getScopes();\n const activeScope = scope.clone();\n _setSpanForScope(activeScope, span);\n\n return { scope: activeScope, isolationScope };\n },\n };\n}\n"],"names":[],"mappings":";;;;AAYO,SAAS,wBAAwB,QAAA,EAAkD;AAExF,EAAA,MAAM,WAAW,cAAA,EAAe;AAChC,EAAA,MAAM,MAAA,GAAS,iBAAiB,QAAQ,CAAA;AACxC,EAAA,MAAA,CAAO,GAAA,GAAM,QAAA;AACf;AAMO,SAAS,wBAAwB,OAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAAS,iBAAiB,OAAO,CAAA;AAEvC,EAAA,IAAI,OAAO,GAAA,EAAK;AACd,IAAA,OAAO,MAAA,CAAO,GAAA;AAAA,EAChB;AAGA,EAAA,OAAO,4BAAA,EAA6B;AACtC;AAKO,SAAS,wBAAA,GAA8D;AAC5E,EAAA,OAAO,uBAAA,CAAwB,cAAA,EAAgB,CAAA,CAAE,wBAAA,IAA2B;AAC9E;AAWO,SAAS,qCAAA,CACd,mBACA,SAAA,EACuB;AACvB,EAAA,OAAO;AAAA,IACL,iBAAA;AAAA,IACA,wBAAwB,CAAA,IAAA,KAAQ;AAC9B,MAAA,MAAM,EAAE,KAAA,EAAO,cAAA,EAAe,GAAI,SAAA,EAAU;AAC5C,MAAA,MAAM,WAAA,GAAc,MAAM,KAAA,EAAM;AAChC,MAAA,gBAAA,CAAiB,aAAa,IAAI,CAAA;AAElC,MAAA,OAAO,EAAE,KAAA,EAAO,WAAA,EAAa,cAAA,EAAe;AAAA,IAC9C;AAAA,GACF;AACF;;;;"} |
@@ -16,6 +16,6 @@ export { registerSpanErrorInstrumentation } from './tracing/errors.js'; | ||
| export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setAttribute, setAttributes, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { getClient, getCurrentScope, getExternalPropagationContext, getGlobalScope, getIsolationScope, getTraceContextFromScope, hasExternalPropagationContext, registerExternalPropagationContext, withIsolationScope, withScope } from './currentScopes.js'; | ||
| export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes.js'; | ||
| export { setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { _INTERNAL_createTracingChannelBinding, getTracingChannelBinding as _INTERNAL_getTracingChannelBinding, setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { getGlobalSingleton, getMainCarrier } from './carrier.js'; | ||
@@ -59,2 +59,3 @@ export { closeSession, makeSession, updateSession } from './session.js'; | ||
| export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants.js'; | ||
| export { SPAN_KIND } from './spanKind.js'; | ||
| export { addBreadcrumb } from './breadcrumbs.js'; | ||
@@ -61,0 +62,0 @@ export { functionToStringIntegration } from './integrations/functiontostring.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -39,2 +39,8 @@ import { getIsolationScope, getCurrentScope, getClient, withIsolationScope } from './currentScopes.js'; | ||
| } | ||
| function setAttributes(attributes) { | ||
| getIsolationScope().setAttributes(attributes); | ||
| } | ||
| function setAttribute(key, value) { | ||
| getIsolationScope().setAttribute(key, value); | ||
| } | ||
| function setUser(user) { | ||
@@ -161,3 +167,3 @@ getIsolationScope().setUser(user); | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor }; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setAttribute, setAttributes, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor }; | ||
| //# sourceMappingURL=exports.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"exports.js","sources":["../../src/exports.ts"],"sourcesContent":["import { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { CaptureContext } from './scope';\nimport { closeSession, makeSession, updateSession } from './session';\nimport { startNewTrace } from './tracing/trace';\nimport type { CheckIn, FinishedCheckIn, MonitorConfig } from './types/checkin';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { Session, SessionContext } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isThenable } from './utils/is';\nimport { uuid4 } from './utils/misc';\nimport type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { getCombinedScopeData } from './utils/scopeData';\nimport { timestampInSeconds } from './utils/time';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureException(exception: unknown, hint?: ExclusiveEventHintOrCaptureContext): string {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const hint = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, hint);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nexport function captureEvent(event: Event, hint?: EventHint): string {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\nexport function setContext(name: string, context: { [key: string]: unknown } | null): void {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: Primitive }): void {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nexport function setTag(key: string, value: Primitive): void {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n getIsolationScope().setUser(user);\n}\n\n/**\n * Sets the conversation ID for the current isolation scope.\n *\n * @param conversationId The conversation ID to set. Pass `null` or `undefined` to unset the conversation ID.\n */\nexport function setConversationId(conversationId: string | null | undefined): void {\n getIsolationScope().setConversationId(conversationId);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nexport function lastEventId(): string | undefined {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param callback Callback to be monitored\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function withMonitor<T>(\n monitorSlug: CheckIn['monitorSlug'],\n callback: () => T,\n upsertMonitorConfig?: MonitorConfig,\n): T {\n function runCallback(): T {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status: FinishedCheckIn['status']): void {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n // Default behavior without isolateTrace\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n r => {\n finishCheckIn('ok');\n return r;\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n ) as T;\n }\n finishCheckIn('ok');\n\n return maybePromiseResult;\n }\n\n return withIsolationScope(() => (upsertMonitorConfig?.isolateTrace ? startNewTrace(runCallback) : runCallback()));\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function flush(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function close(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nexport function isInitialized(): boolean {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nexport function isEnabled(): boolean {\n const client = getClient();\n return client?.getOptions().enabled !== false && !!client?.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nexport function addEventProcessor(callback: EventProcessor): void {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nexport function startSession(context?: SessionContext): Session {\n const isolationScope = getIsolationScope();\n\n const { user } = getCombinedScopeData(isolationScope, getCurrentScope());\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n user,\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession?.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nexport function endSession(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const isolationScope = getIsolationScope();\n const client = getClient();\n const session = isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nexport function captureSession(end: boolean = false): void {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BO,SAAS,gBAAA,CAAiB,WAAoB,IAAA,EAAmD;AACtG,EAAA,OAAO,iBAAgB,CAAE,gBAAA,CAAiB,SAAA,EAAW,8BAAA,CAA+B,IAAI,CAAC,CAAA;AAC3F;AASO,SAAS,cAAA,CAAe,SAAiB,cAAA,EAAyD;AAGvG,EAAA,MAAM,KAAA,GAAQ,OAAO,cAAA,KAAmB,QAAA,GAAW,cAAA,GAA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["import type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { CaptureContext } from './scope';\nimport { closeSession, makeSession, updateSession } from './session';\nimport { startNewTrace } from './tracing/trace';\nimport type { CheckIn, FinishedCheckIn, MonitorConfig } from './types/checkin';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { Session, SessionContext } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isThenable } from './utils/is';\nimport { uuid4 } from './utils/misc';\nimport type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { getCombinedScopeData } from './utils/scopeData';\nimport { timestampInSeconds } from './utils/time';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureException(exception: unknown, hint?: ExclusiveEventHintOrCaptureContext): string {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const hint = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, hint);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nexport function captureEvent(event: Event, hint?: EventHint): string {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\nexport function setContext(name: string, context: { [key: string]: unknown } | null): void {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: Primitive }): void {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nexport function setTag(key: string, value: Primitive): void {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Sets attributes on the isolation scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param attributes - The attributes to set on the scope, as key-value pairs.\n *\n * @example\n * ```typescript\n * Sentry.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: 150,\n * });\n * ```\n */\nexport function setAttributes<T extends Record<string, unknown>>(attributes: RawAttributes<T>): void {\n getIsolationScope().setAttributes(attributes);\n}\n\n/**\n * Sets an attribute on the isolation scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param key - The attribute key.\n * @param value - The attribute value.\n *\n * @example\n * ```typescript\n * Sentry.setAttribute('is_admin', true);\n * Sentry.setAttribute('render_duration', 150);\n * ```\n */\nexport function setAttribute<\n // oxlint-disable-next-line typescript-eslint/no-explicit-any\n T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown,\n>(key: string, value: RawAttribute<T>): void {\n getIsolationScope().setAttribute(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n getIsolationScope().setUser(user);\n}\n\n/**\n * Sets the conversation ID for the current isolation scope.\n *\n * @param conversationId The conversation ID to set. Pass `null` or `undefined` to unset the conversation ID.\n */\nexport function setConversationId(conversationId: string | null | undefined): void {\n getIsolationScope().setConversationId(conversationId);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nexport function lastEventId(): string | undefined {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param callback Callback to be monitored\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function withMonitor<T>(\n monitorSlug: CheckIn['monitorSlug'],\n callback: () => T,\n upsertMonitorConfig?: MonitorConfig,\n): T {\n function runCallback(): T {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status: FinishedCheckIn['status']): void {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n // Default behavior without isolateTrace\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n r => {\n finishCheckIn('ok');\n return r;\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n ) as T;\n }\n finishCheckIn('ok');\n\n return maybePromiseResult;\n }\n\n return withIsolationScope(() => (upsertMonitorConfig?.isolateTrace ? startNewTrace(runCallback) : runCallback()));\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function flush(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function close(timeout?: number): Promise<boolean> {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nexport function isInitialized(): boolean {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nexport function isEnabled(): boolean {\n const client = getClient();\n return client?.getOptions().enabled !== false && !!client?.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nexport function addEventProcessor(callback: EventProcessor): void {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nexport function startSession(context?: SessionContext): Session {\n const isolationScope = getIsolationScope();\n\n const { user } = getCombinedScopeData(isolationScope, getCurrentScope());\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n user,\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession?.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nexport function endSession(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const isolationScope = getIsolationScope();\n const client = getClient();\n const session = isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nexport function captureSession(end: boolean = false): void {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\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EACtB;AACA,EAAA,kBAAA,EAAmB;AAGnB,EAAA,cAAA,CAAe,UAAA,EAAW;AAC5B;AAKA,SAAS,kBAAA,GAA2B;AAClC,EAAA,MAAM,iBAAiB,iBAAA,EAAkB;AACzC,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,OAAA,GAAU,eAAe,UAAA,EAAW;AAC1C,EAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,IAAA,MAAA,CAAO,eAAe,OAAO,CAAA;AAAA,EAC/B;AACF;AAQO,SAAS,cAAA,CAAe,MAAe,KAAA,EAAa;AAEzD,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,UAAA,EAAW;AACX,IAAA;AAAA,EACF;AAGA,EAAA,kBAAA,EAAmB;AACrB;;;;"} |
@@ -16,6 +16,6 @@ export { registerSpanErrorInstrumentation } from './tracing/errors.js'; | ||
| export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setAttribute, setAttributes, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { getClient, getCurrentScope, getExternalPropagationContext, getGlobalScope, getIsolationScope, getTraceContextFromScope, hasExternalPropagationContext, registerExternalPropagationContext, withIsolationScope, withScope } from './currentScopes.js'; | ||
| export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes.js'; | ||
| export { setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { _INTERNAL_createTracingChannelBinding, getTracingChannelBinding as _INTERNAL_getTracingChannelBinding, setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { getGlobalSingleton, getMainCarrier } from './carrier.js'; | ||
@@ -59,2 +59,3 @@ export { closeSession, makeSession, updateSession } from './session.js'; | ||
| export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants.js'; | ||
| export { SPAN_KIND } from './spanKind.js'; | ||
| export { addBreadcrumb } from './breadcrumbs.js'; | ||
@@ -157,3 +158,4 @@ export { functionToStringIntegration } from './integrations/functiontostring.js'; | ||
| export { expressErrorHandler, patchExpressModule, setupExpressErrorHandler } from './integrations/express/index.js'; | ||
| export { instrumentPostgresJsSql } from './integrations/postgresjs.js'; | ||
| export { _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, instrumentPostgresJsSql } from './integrations/postgresjs.js'; | ||
| export { getSqlQuerySummary as _INTERNAL_getSqlQuerySummary } from './utils/sql.js'; | ||
| export { patchHttpModuleClient } from './integrations/http/client-patch.js'; | ||
@@ -160,0 +162,0 @@ export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -15,2 +15,3 @@ import { HTTP_ON_SERVER_REQUEST } from './constants.js'; | ||
| import { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR } from '../../tracing/spanstatus.js'; | ||
| import { SPAN_KIND } from '../../spanKind.js'; | ||
@@ -174,6 +175,5 @@ const INTEGRATION_NAME = "Http.Server"; | ||
| name, | ||
| // SpanKind.SERVER = 1; pass this so the OTel sampler infers | ||
| // op='http.server' rather than 'http', which it does for | ||
| // SpanKind.INTERNAL = 0, the default | ||
| kind: 1, | ||
| // Pass SERVER so the OTel sampler infers op='http.server' rather than | ||
| // 'http', which it does for the INTERNAL default. | ||
| kind: SPAN_KIND.SERVER, | ||
| attributes: { | ||
@@ -180,0 +180,0 @@ // Sentry-specific attributes |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server-subscription.js","sources":["../../../../src/integrations/http/server-subscription.ts"],"sourcesContent":["/**\n * Provide the `http.server.request.start` subscription function that we use\n * to instrument incoming HTTP requests that use the `node:http` module.\n *\n * On Node.js v18.7 and up, we can just assign the diagnostics channel\n * listener, and that's enough. But for older node versions, or other SSJS\n * platforms, we have to explicitly fire the provided method an a patched\n * Server.emit method.\n *\n * This decision is made in the relevant Node/Bun/Deno SDKs; core just\n * provides them with the methods to use.\n *\n * When `options.spans` is enabled (explicitly or via the client's tracing\n * config), this also creates server spans around the emitted `'request'`\n * event. The OTel-mode node integration creates spans through a different\n * code path and opts out via explicit `spans: false`.\n */\n\nimport type { ServerSubscriptionName } from './constants';\ntype ChannelListener = (message: unknown, name: string | symbol) => void;\nimport { HTTP_ON_SERVER_REQUEST } from './constants';\nimport type { HttpIncomingMessage, HttpInstrumentationOptions, HttpServer, HttpServerResponse } from './types';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { debug } from '../../utils/debug-logger';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from '../../currentScopes';\nimport { hasSpansEnabled } from '../../utils/hasSpansEnabled';\nimport { headersToDict, httpHeadersToSpanAttributes, httpRequestToRequestData } from '../../utils/request';\nimport { patchRequestToCaptureBody } from './patch-request-to-capture-body';\nimport { parseStringToURLObject, stripUrlQueryAndFragment } from '../../utils/url';\nimport { recordRequestSession } from './record-request-session';\nimport { generateSpanId, generateTraceId } from '../../utils/propagationContext';\nimport { continueTrace } from '../../tracing/trace';\nimport { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, startSpanManual } from '../../tracing';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../../semanticAttributes';\nimport { safeMathRandom } from '../../utils/randomSafeContext';\nimport type { SpanAttributes } from '../../types/span';\nimport type { SpanStatus } from '../../types/spanStatus';\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nconst INTEGRATION_NAME = 'Http.Server';\nconst SPANS_INTEGRATION_NAME = 'Http.SentryServerSpans';\n\nexport type HttpServerSubscriptions = Record<ServerSubscriptionName, ChannelListener>;\n\n// Tracks the last Sentry-created emit wrapper for each server so we can detect\n// when user code has replaced server.emit (e.g. with a proxy of the original)\n// and re-wrap it to restore Sentry's instrumentation.\nconst lastSentryEmitMap = new WeakMap<HttpServer, HttpServer['emit']>();\n\nconst kRequestMark = Symbol.for('sentry_http_server_instrumented');\ntype MarkedRequest = HttpIncomingMessage & {\n [kRequestMark]?: boolean;\n};\n\n/** return true if it is NOT already marked */\nfunction markRequest(request: MarkedRequest): boolean {\n return !request[kRequestMark] && (request[kRequestMark] = true);\n}\n\nexport function instrumentServer(options: HttpInstrumentationOptions, server: HttpServer): void {\n // Use a proxy and a WeakSet of server objects here, rather than a\n // wrappedFunction, because NestJS has been observed to \"fork\" emit\n // methods, including copying properties, leading to false positives.\n // Furthermore, we mark the Request object so that if two copies of this\n // instrumentation both are run on forked emit() methods for the same\n // request, we still only ever create a single root span. Previously,\n // this was done with a flag on the OTEL context, but in this non-OTEL\n // version, we mark the Request itself with a non-enumerable prop instead.\n\n // oxlint-disable-next-line typescript/unbound-method -- `this` is forwarded via Proxy/target.apply below\n const currentEmit = server.emit;\n const instrumentedEmit = lastSentryEmitMap.get(server);\n\n // Skip re-wrapping only if already instrumented AND server.emit still points\n // to our wrapper. If user code replaced server.emit (e.g. with a proxy of the\n // original pre-Sentry emit), re-wrap so Sentry's instrumentation is restored.\n if (currentEmit === instrumentedEmit) {\n return;\n }\n\n const newEmit = new Proxy(currentEmit, {\n apply(target, thisArg, args: unknown[]) {\n const [event, ...data] = args;\n if (event !== 'request') {\n return target.apply(thisArg, args);\n }\n\n const client = getClient();\n const [request, response] = data as [HttpIncomingMessage, HttpServerResponse];\n\n if (!client || !markRequest(request)) {\n return target.apply(thisArg, args);\n }\n\n DEBUG_BUILD && debug.log(INTEGRATION_NAME, 'Handling incoming request');\n const isolationScope = getIsolationScope().clone();\n isolationScope.setClient(client);\n\n const ipAddress = request.socket?.remoteAddress;\n const url = request.url || '/';\n const normalizedRequest = httpRequestToRequestData(request);\n const {\n maxRequestBodySize = 'medium',\n ignoreRequestBody,\n sessions = true,\n sessionFlushingDelayMS = 60_000,\n } = options;\n\n if (maxRequestBodySize !== 'none' && !ignoreRequestBody?.(url, request)) {\n patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize, INTEGRATION_NAME);\n }\n\n // Update the isolation scope, isolate this request\n isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });\n\n // attempt to update the scope's `transactionName` based on the request\n // URL. Ideally, framework instrumentations coming after the\n // HttpInstrumentation update the transactionName once we get a\n // parameterized route.\n const httpMethod = (request.method || 'GET').toUpperCase();\n const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);\n\n const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;\n\n isolationScope.setTransactionName(bestEffortTransactionName);\n\n if (sessions) {\n recordRequestSession(client, {\n requestIsolationScope: isolationScope,\n response,\n sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60_000,\n });\n }\n\n return withIsolationScope(isolationScope, () => {\n const sentryTrace = normalizedRequest.headers?.['sentry-trace'];\n const baggage = normalizedRequest.headers?.['baggage'];\n const sentryTraceValue = Array.isArray(sentryTrace) ? sentryTrace[0] : sentryTrace;\n return continueTrace(\n {\n sentryTrace: sentryTraceValue,\n baggage: Array.isArray(baggage) ? baggage[0] : baggage,\n },\n () => {\n const propagationContext = getCurrentScope().getPropagationContext();\n // Set propagationSpanId after continueTrace because it calls\n // withScope + setPropagationContext internally, which would\n // overwrite any previously set value.\n propagationContext.propagationSpanId = generateSpanId();\n // In OTel mode, continueTrace does not generate a new traceId\n // when there is no incoming sentry-trace header. We generate one\n // explicitly here so each request gets a unique trace ID even when\n // tracing is disabled.\n if (!sentryTraceValue) {\n propagationContext.traceId = generateTraceId();\n propagationContext.sampleRand = safeMathRandom();\n }\n\n response.once('close', () => {\n isolationScope.setContext('response', {\n status_code: response.statusCode,\n });\n });\n\n const wrap = options.wrapServerEmitRequest;\n let emitResult: boolean = false;\n if (wrap) {\n wrap(request, response, normalizedRequest, () => {\n emitResult = target.apply(thisArg, args) as boolean;\n });\n } else {\n emitResult = target.apply(thisArg, args) as boolean;\n }\n return emitResult;\n },\n );\n });\n },\n });\n\n lastSentryEmitMap.set(server, newEmit);\n server.emit = newEmit;\n}\n\nexport function getHttpServerSubscriptions(options: HttpInstrumentationOptions): HttpServerSubscriptions {\n // The decision whether to create spans is evaluated per request (not once\n // here), so it stays responsive to client-state changes after setup. This\n // mirrors `getHttpClientSubscriptions`. Callers can force the no-span path\n // with explicit `spans: false` (the node OTel `httpServerIntegration` does\n // this because it creates spans through a separate code path).\n const userWrap = options.wrapServerEmitRequest;\n const spanWrap = buildServerSpanWrap(options);\n\n const effectiveOptions: HttpInstrumentationOptions = {\n ...options,\n wrapServerEmitRequest(request, response, normalizedRequest, next) {\n const clientOptions = getClient()?.getOptions();\n const createSpans = options.spans ?? (clientOptions ? hasSpansEnabled(clientOptions) : false);\n if (createSpans) {\n // spanWrap composes the user's wrap (outer) with span creation (inner).\n spanWrap(request, response, normalizedRequest, next);\n } else if (userWrap) {\n userWrap(request, response, normalizedRequest, next);\n } else {\n next();\n }\n },\n };\n\n const onHttpServerRequest: ChannelListener = (data: unknown): void => {\n const { server } = data as { server: HttpServer };\n instrumentServer(effectiveOptions, server);\n };\n\n return { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest };\n}\n\nfunction buildServerSpanWrap(\n options: HttpInstrumentationOptions,\n): NonNullable<HttpInstrumentationOptions['wrapServerEmitRequest']> {\n const {\n wrapServerEmitRequest: userWrap,\n ignoreIncomingRequests,\n ignoreStaticAssets = true,\n onSpanCreated,\n errorMonitor = 'error',\n onSpanEnd,\n } = options;\n\n return (request, response, normalizedRequest, next) => {\n if (typeof __SENTRY_TRACING__ !== 'undefined' && !__SENTRY_TRACING__) {\n return next();\n }\n\n // User wrap runs outside the span so it can set up context\n // (e.g. OTel propagation) before the span is created.\n return userWrap ? userWrap(request, response, normalizedRequest, createSpan) : createSpan();\n\n function createSpan(): unknown {\n const isolationScope = getIsolationScope();\n const client = isolationScope.getClient();\n if (!client) {\n return next();\n }\n\n if (\n shouldIgnoreSpansForIncomingRequest(request, {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n })\n ) {\n DEBUG_BUILD && debug.log(SPANS_INTEGRATION_NAME, 'Skipping span creation for incoming request', request.url);\n return next();\n }\n\n const fullUrl = normalizedRequest.url || request.url || '/';\n const urlObj = parseStringToURLObject(fullUrl);\n const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);\n const method = (request.method || 'GET').toUpperCase();\n const name = `${method} ${httpTargetWithoutQueryFragment}`;\n const headers = request.headers;\n const userAgent = headers['user-agent'];\n const ips = headers['x-forwarded-for'];\n const httpVersion = request.httpVersion;\n const host = headers.host as undefined | string;\n const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, '$1') || 'localhost';\n const scheme = fullUrl.startsWith('https') ? 'https' : 'http';\n const { socket } = request;\n const { localAddress, localPort, remoteAddress, remotePort } = socket ?? {};\n\n return startSpanManual(\n {\n name,\n // SpanKind.SERVER = 1; pass this so the OTel sampler infers\n // op='http.server' rather than 'http', which it does for\n // SpanKind.INTERNAL = 0, the default\n kind: 1,\n attributes: {\n // Sentry-specific attributes\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n // Set http.route to the URL path as a best-effort route name.\n // Framework integrations (Express, etc.) update this via onSpanEnd.\n 'http.route': httpTargetWithoutQueryFragment,\n // OTel kind (explicit attribute so it appears in span data)\n 'otel.kind': 'SERVER',\n // Network attributes\n 'net.host.ip': localAddress,\n 'net.host.port': localPort,\n 'net.peer.ip': remoteAddress,\n 'net.peer.port': remotePort,\n 'sentry.http.prefetch': isKnownPrefetchRequest(request) || undefined,\n // Old Semantic Conventions attributes for compatibility\n 'http.url': fullUrl,\n 'http.method': method,\n 'http.target': urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,\n 'http.host': host,\n 'net.host.name': hostname,\n 'http.client_ip': typeof ips === 'string' ? ips.split(',')[0] : undefined,\n 'http.user_agent': userAgent,\n 'http.scheme': scheme,\n 'http.flavor': httpVersion,\n 'net.transport': httpVersion?.toUpperCase() === 'QUIC' ? 'ip_udp' : 'ip_tcp',\n ...getRequestContentLengthAttribute(request),\n ...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, client.getDataCollectionOptions()),\n },\n },\n span => {\n onSpanCreated?.(span, request, response);\n // Ensure we only end the span once\n // E.g. error can be emitted before close is emitted\n let isEnded = false;\n\n function endSpan(status: SpanStatus): void {\n if (isEnded) {\n return;\n }\n\n isEnded = true;\n // set attributes that come from the response\n span.setAttributes({\n 'http.status_text': response.statusMessage?.toUpperCase(),\n 'http.response.status_code': response.statusCode,\n 'http.status_code': response.statusCode,\n ...httpHeadersToSpanAttributes(\n headersToDict(response.headers),\n client?.getDataCollectionOptions() ?? false,\n 'response',\n ),\n });\n span.setStatus(status);\n onSpanEnd?.(span, request, response);\n span.end();\n }\n\n response.once('close', () => {\n endSpan(getSpanStatusFromHttpCode(response.statusCode));\n });\n\n response.once(errorMonitor, () => {\n const httpStatus = getSpanStatusFromHttpCode(response.statusCode);\n // Ensure we def. have an error status here\n endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });\n });\n\n // Continue handling the request inside the active span context\n next();\n },\n );\n }\n };\n}\n\nfunction shouldIgnoreSpansForIncomingRequest(\n request: HttpIncomingMessage,\n {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n }: {\n ignoreStaticAssets?: boolean;\n ignoreIncomingRequests?: (urlPath: string, request: HttpIncomingMessage) => boolean;\n },\n): boolean {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as spans\n if (method === 'OPTIONS' || method === 'HEAD' || !urlPath) {\n return true;\n }\n\n // Default static asset filtering\n if (ignoreStaticAssets && method === 'GET' && isStaticAssetRequest(urlPath)) {\n return true;\n }\n\n if (ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n}\n\nexport function isStaticAssetRequest(urlPath: string): boolean {\n const path = stripUrlQueryAndFragment(urlPath);\n // Common static file extensions\n if (path.match(/\\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {\n return true;\n }\n\n // Common metadata files\n if (path.match(/^\\/(robots\\.txt|sitemap\\.xml|manifest\\.json|browserconfig\\.xml)$/)) {\n return true;\n }\n\n return false;\n}\n\nfunction isKnownPrefetchRequest(req: HttpIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getRequestContentLengthAttribute(request: HttpIncomingMessage): SpanAttributes {\n const { headers } = request;\n const contentLengthHeader = headers['content-length'];\n const length = contentLengthHeader ? parseInt(String(contentLengthHeader), 10) : -1;\n const encoding = headers['content-encoding'];\n return length >= 0\n ? encoding && encoding !== 'identity'\n ? { 'http.request_content_length': length }\n : { 'http.request_content_length_uncompressed': length }\n : {};\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAM,gBAAA,GAAmB,aAAA;AACzB,MAAM,sBAAA,GAAyB,wBAAA;AAO/B,MAAM,iBAAA,uBAAwB,OAAA,EAAwC;AAEtE,MAAM,YAAA,mBAAe,MAAA,CAAO,GAAA,CAAI,iCAAiC,CAAA;AAMjE,SAAS,YAAY,OAAA,EAAiC;AACpD,EAAA,OAAO,CAAC,OAAA,CAAQ,YAAY,CAAA,KAAM,OAAA,CAAQ,YAAY,CAAA,GAAI,IAAA,CAAA;AAC5D;AAEO,SAAS,gBAAA,CAAiB,SAAqC,MAAA,EAA0B;AAW9F,EAAA,MAAM,cAAc,MAAA,CAAO,IAAA;AAC3B,EAAA,MAAM,gBAAA,GAAmB,iBAAA,CAAkB,GAAA,CAAI,MAAM,CAAA;AAKrD,EAAA,IAAI,gBAAgB,gBAAA,EAAkB;AACpC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,OAAA,GAAU,IAAI,KAAA,CAAM,WAAA,EAAa;AAAA,IACrC,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAiB;AACtC,MAAA,MAAM,CAAC,KAAA,EAAO,GAAG,IAAI,CAAA,GAAI,IAAA;AACzB,MAAA,IAAI,UAAU,SAAA,EAAW;AACvB,QAAA,OAAO,MAAA,CAAO,KAAA,CAAM,OAAA,EAAS,IAAI,CAAA;AAAA,MACnC;AAEA,MAAA,MAAM,SAAS,SAAA,EAAU;AACzB,MAAA,MAAM,CAAC,OAAA,EAAS,QAAQ,CAAA,GAAI,IAAA;AAE5B,MAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,CAAY,OAAO,CAAA,EAAG;AACpC,QAAA,OAAO,MAAA,CAAO,KA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AAG;AACnF,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,IAAA,CAAK,KAAA,CAAM,kEAAkE,CAAA,EAAG;AAClF,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,uBAAuB,GAAA,EAAmC;AAEjE,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,sBAAsB,CAAA,KAAM,GAAA;AACjD;AAEA,SAAS,iCAAiC,OAAA,EAA8C;AACtF,EAAA,MAAM,EAAE,SAAQ,GAAI,OAAA;AACpB,EAAA,MAAM,mBAAA,GAAsB,QAAQ,gBAAgB,CAAA;AACpD,EAAA,MAAM,SAAS,mBAAA,GAAsB,QAAA,CAAS,OAAO,mBAAmB,CAAA,EAAG,EAAE,CAAA,GAAI,EAAA;AACjF,EAAA,MAAM,QAAA,GAAW,QAAQ,kBAAkB,CAAA;AAC3C,EAAA,OAAO,MAAA,IAAU,CAAA,GACb,QAAA,IAAY,QAAA,KAAa,UAAA,GACvB,EAAE,6BAAA,EAA+B,MAAA,EAAO,GACxC,EAAE,0CAAA,EAA4C,MAAA,KAChD,EAAC;AACP;;;;"} | ||
| {"version":3,"file":"server-subscription.js","sources":["../../../../src/integrations/http/server-subscription.ts"],"sourcesContent":["/**\n * Provide the `http.server.request.start` subscription function that we use\n * to instrument incoming HTTP requests that use the `node:http` module.\n *\n * On Node.js v18.7 and up, we can just assign the diagnostics channel\n * listener, and that's enough. But for older node versions, or other SSJS\n * platforms, we have to explicitly fire the provided method an a patched\n * Server.emit method.\n *\n * This decision is made in the relevant Node/Bun/Deno SDKs; core just\n * provides them with the methods to use.\n *\n * When `options.spans` is enabled (explicitly or via the client's tracing\n * config), this also creates server spans around the emitted `'request'`\n * event. The OTel-mode node integration creates spans through a different\n * code path and opts out via explicit `spans: false`.\n */\n\nimport type { ServerSubscriptionName } from './constants';\ntype ChannelListener = (message: unknown, name: string | symbol) => void;\nimport { HTTP_ON_SERVER_REQUEST } from './constants';\nimport type { HttpIncomingMessage, HttpInstrumentationOptions, HttpServer, HttpServerResponse } from './types';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { debug } from '../../utils/debug-logger';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from '../../currentScopes';\nimport { hasSpansEnabled } from '../../utils/hasSpansEnabled';\nimport { headersToDict, httpHeadersToSpanAttributes, httpRequestToRequestData } from '../../utils/request';\nimport { patchRequestToCaptureBody } from './patch-request-to-capture-body';\nimport { parseStringToURLObject, stripUrlQueryAndFragment } from '../../utils/url';\nimport { recordRequestSession } from './record-request-session';\nimport { generateSpanId, generateTraceId } from '../../utils/propagationContext';\nimport { continueTrace } from '../../tracing/trace';\nimport { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, startSpanManual } from '../../tracing';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../../semanticAttributes';\nimport { safeMathRandom } from '../../utils/randomSafeContext';\nimport { SPAN_KIND } from '../../spanKind';\nimport type { SpanAttributes } from '../../types/span';\nimport type { SpanStatus } from '../../types/spanStatus';\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nconst INTEGRATION_NAME = 'Http.Server';\nconst SPANS_INTEGRATION_NAME = 'Http.SentryServerSpans';\n\nexport type HttpServerSubscriptions = Record<ServerSubscriptionName, ChannelListener>;\n\n// Tracks the last Sentry-created emit wrapper for each server so we can detect\n// when user code has replaced server.emit (e.g. with a proxy of the original)\n// and re-wrap it to restore Sentry's instrumentation.\nconst lastSentryEmitMap = new WeakMap<HttpServer, HttpServer['emit']>();\n\nconst kRequestMark = Symbol.for('sentry_http_server_instrumented');\ntype MarkedRequest = HttpIncomingMessage & {\n [kRequestMark]?: boolean;\n};\n\n/** return true if it is NOT already marked */\nfunction markRequest(request: MarkedRequest): boolean {\n return !request[kRequestMark] && (request[kRequestMark] = true);\n}\n\nexport function instrumentServer(options: HttpInstrumentationOptions, server: HttpServer): void {\n // Use a proxy and a WeakSet of server objects here, rather than a\n // wrappedFunction, because NestJS has been observed to \"fork\" emit\n // methods, including copying properties, leading to false positives.\n // Furthermore, we mark the Request object so that if two copies of this\n // instrumentation both are run on forked emit() methods for the same\n // request, we still only ever create a single root span. Previously,\n // this was done with a flag on the OTEL context, but in this non-OTEL\n // version, we mark the Request itself with a non-enumerable prop instead.\n\n // oxlint-disable-next-line typescript/unbound-method -- `this` is forwarded via Proxy/target.apply below\n const currentEmit = server.emit;\n const instrumentedEmit = lastSentryEmitMap.get(server);\n\n // Skip re-wrapping only if already instrumented AND server.emit still points\n // to our wrapper. If user code replaced server.emit (e.g. with a proxy of the\n // original pre-Sentry emit), re-wrap so Sentry's instrumentation is restored.\n if (currentEmit === instrumentedEmit) {\n return;\n }\n\n const newEmit = new Proxy(currentEmit, {\n apply(target, thisArg, args: unknown[]) {\n const [event, ...data] = args;\n if (event !== 'request') {\n return target.apply(thisArg, args);\n }\n\n const client = getClient();\n const [request, response] = data as [HttpIncomingMessage, HttpServerResponse];\n\n if (!client || !markRequest(request)) {\n return target.apply(thisArg, args);\n }\n\n DEBUG_BUILD && debug.log(INTEGRATION_NAME, 'Handling incoming request');\n const isolationScope = getIsolationScope().clone();\n isolationScope.setClient(client);\n\n const ipAddress = request.socket?.remoteAddress;\n const url = request.url || '/';\n const normalizedRequest = httpRequestToRequestData(request);\n const {\n maxRequestBodySize = 'medium',\n ignoreRequestBody,\n sessions = true,\n sessionFlushingDelayMS = 60_000,\n } = options;\n\n if (maxRequestBodySize !== 'none' && !ignoreRequestBody?.(url, request)) {\n patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize, INTEGRATION_NAME);\n }\n\n // Update the isolation scope, isolate this request\n isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });\n\n // attempt to update the scope's `transactionName` based on the request\n // URL. Ideally, framework instrumentations coming after the\n // HttpInstrumentation update the transactionName once we get a\n // parameterized route.\n const httpMethod = (request.method || 'GET').toUpperCase();\n const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);\n\n const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;\n\n isolationScope.setTransactionName(bestEffortTransactionName);\n\n if (sessions) {\n recordRequestSession(client, {\n requestIsolationScope: isolationScope,\n response,\n sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60_000,\n });\n }\n\n return withIsolationScope(isolationScope, () => {\n const sentryTrace = normalizedRequest.headers?.['sentry-trace'];\n const baggage = normalizedRequest.headers?.['baggage'];\n const sentryTraceValue = Array.isArray(sentryTrace) ? sentryTrace[0] : sentryTrace;\n return continueTrace(\n {\n sentryTrace: sentryTraceValue,\n baggage: Array.isArray(baggage) ? baggage[0] : baggage,\n },\n () => {\n const propagationContext = getCurrentScope().getPropagationContext();\n // Set propagationSpanId after continueTrace because it calls\n // withScope + setPropagationContext internally, which would\n // overwrite any previously set value.\n propagationContext.propagationSpanId = generateSpanId();\n // In OTel mode, continueTrace does not generate a new traceId\n // when there is no incoming sentry-trace header. We generate one\n // explicitly here so each request gets a unique trace ID even when\n // tracing is disabled.\n if (!sentryTraceValue) {\n propagationContext.traceId = generateTraceId();\n propagationContext.sampleRand = safeMathRandom();\n }\n\n response.once('close', () => {\n isolationScope.setContext('response', {\n status_code: response.statusCode,\n });\n });\n\n const wrap = options.wrapServerEmitRequest;\n let emitResult: boolean = false;\n if (wrap) {\n wrap(request, response, normalizedRequest, () => {\n emitResult = target.apply(thisArg, args) as boolean;\n });\n } else {\n emitResult = target.apply(thisArg, args) as boolean;\n }\n return emitResult;\n },\n );\n });\n },\n });\n\n lastSentryEmitMap.set(server, newEmit);\n server.emit = newEmit;\n}\n\nexport function getHttpServerSubscriptions(options: HttpInstrumentationOptions): HttpServerSubscriptions {\n // The decision whether to create spans is evaluated per request (not once\n // here), so it stays responsive to client-state changes after setup. This\n // mirrors `getHttpClientSubscriptions`. Callers can force the no-span path\n // with explicit `spans: false` (the node OTel `httpServerIntegration` does\n // this because it creates spans through a separate code path).\n const userWrap = options.wrapServerEmitRequest;\n const spanWrap = buildServerSpanWrap(options);\n\n const effectiveOptions: HttpInstrumentationOptions = {\n ...options,\n wrapServerEmitRequest(request, response, normalizedRequest, next) {\n const clientOptions = getClient()?.getOptions();\n const createSpans = options.spans ?? (clientOptions ? hasSpansEnabled(clientOptions) : false);\n if (createSpans) {\n // spanWrap composes the user's wrap (outer) with span creation (inner).\n spanWrap(request, response, normalizedRequest, next);\n } else if (userWrap) {\n userWrap(request, response, normalizedRequest, next);\n } else {\n next();\n }\n },\n };\n\n const onHttpServerRequest: ChannelListener = (data: unknown): void => {\n const { server } = data as { server: HttpServer };\n instrumentServer(effectiveOptions, server);\n };\n\n return { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest };\n}\n\nfunction buildServerSpanWrap(\n options: HttpInstrumentationOptions,\n): NonNullable<HttpInstrumentationOptions['wrapServerEmitRequest']> {\n const {\n wrapServerEmitRequest: userWrap,\n ignoreIncomingRequests,\n ignoreStaticAssets = true,\n onSpanCreated,\n errorMonitor = 'error',\n onSpanEnd,\n } = options;\n\n return (request, response, normalizedRequest, next) => {\n if (typeof __SENTRY_TRACING__ !== 'undefined' && !__SENTRY_TRACING__) {\n return next();\n }\n\n // User wrap runs outside the span so it can set up context\n // (e.g. OTel propagation) before the span is created.\n return userWrap ? userWrap(request, response, normalizedRequest, createSpan) : createSpan();\n\n function createSpan(): unknown {\n const isolationScope = getIsolationScope();\n const client = isolationScope.getClient();\n if (!client) {\n return next();\n }\n\n if (\n shouldIgnoreSpansForIncomingRequest(request, {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n })\n ) {\n DEBUG_BUILD && debug.log(SPANS_INTEGRATION_NAME, 'Skipping span creation for incoming request', request.url);\n return next();\n }\n\n const fullUrl = normalizedRequest.url || request.url || '/';\n const urlObj = parseStringToURLObject(fullUrl);\n const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);\n const method = (request.method || 'GET').toUpperCase();\n const name = `${method} ${httpTargetWithoutQueryFragment}`;\n const headers = request.headers;\n const userAgent = headers['user-agent'];\n const ips = headers['x-forwarded-for'];\n const httpVersion = request.httpVersion;\n const host = headers.host as undefined | string;\n const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, '$1') || 'localhost';\n const scheme = fullUrl.startsWith('https') ? 'https' : 'http';\n const { socket } = request;\n const { localAddress, localPort, remoteAddress, remotePort } = socket ?? {};\n\n return startSpanManual(\n {\n name,\n // Pass SERVER so the OTel sampler infers op='http.server' rather than\n // 'http', which it does for the INTERNAL default.\n kind: SPAN_KIND.SERVER,\n attributes: {\n // Sentry-specific attributes\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n // Set http.route to the URL path as a best-effort route name.\n // Framework integrations (Express, etc.) update this via onSpanEnd.\n 'http.route': httpTargetWithoutQueryFragment,\n // OTel kind (explicit attribute so it appears in span data)\n 'otel.kind': 'SERVER',\n // Network attributes\n 'net.host.ip': localAddress,\n 'net.host.port': localPort,\n 'net.peer.ip': remoteAddress,\n 'net.peer.port': remotePort,\n 'sentry.http.prefetch': isKnownPrefetchRequest(request) || undefined,\n // Old Semantic Conventions attributes for compatibility\n 'http.url': fullUrl,\n 'http.method': method,\n 'http.target': urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,\n 'http.host': host,\n 'net.host.name': hostname,\n 'http.client_ip': typeof ips === 'string' ? ips.split(',')[0] : undefined,\n 'http.user_agent': userAgent,\n 'http.scheme': scheme,\n 'http.flavor': httpVersion,\n 'net.transport': httpVersion?.toUpperCase() === 'QUIC' ? 'ip_udp' : 'ip_tcp',\n ...getRequestContentLengthAttribute(request),\n ...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, client.getDataCollectionOptions()),\n },\n },\n span => {\n onSpanCreated?.(span, request, response);\n // Ensure we only end the span once\n // E.g. error can be emitted before close is emitted\n let isEnded = false;\n\n function endSpan(status: SpanStatus): void {\n if (isEnded) {\n return;\n }\n\n isEnded = true;\n // set attributes that come from the response\n span.setAttributes({\n 'http.status_text': response.statusMessage?.toUpperCase(),\n 'http.response.status_code': response.statusCode,\n 'http.status_code': response.statusCode,\n ...httpHeadersToSpanAttributes(\n headersToDict(response.headers),\n client?.getDataCollectionOptions() ?? false,\n 'response',\n ),\n });\n span.setStatus(status);\n onSpanEnd?.(span, request, response);\n span.end();\n }\n\n response.once('close', () => {\n endSpan(getSpanStatusFromHttpCode(response.statusCode));\n });\n\n response.once(errorMonitor, () => {\n const httpStatus = getSpanStatusFromHttpCode(response.statusCode);\n // Ensure we def. have an error status here\n endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });\n });\n\n // Continue handling the request inside the active span context\n next();\n },\n );\n }\n };\n}\n\nfunction shouldIgnoreSpansForIncomingRequest(\n request: HttpIncomingMessage,\n {\n ignoreStaticAssets,\n ignoreIncomingRequests,\n }: {\n ignoreStaticAssets?: boolean;\n ignoreIncomingRequests?: (urlPath: string, request: HttpIncomingMessage) => boolean;\n },\n): boolean {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as spans\n if (method === 'OPTIONS' || method === 'HEAD' || !urlPath) {\n return true;\n }\n\n // Default static asset filtering\n if (ignoreStaticAssets && method === 'GET' && isStaticAssetRequest(urlPath)) {\n return true;\n }\n\n if (ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n}\n\nexport function isStaticAssetRequest(urlPath: string): boolean {\n const path = stripUrlQueryAndFragment(urlPath);\n // Common static file extensions\n if (path.match(/\\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {\n return true;\n }\n\n // Common metadata files\n if (path.match(/^\\/(robots\\.txt|sitemap\\.xml|manifest\\.json|browserconfig\\.xml)$/)) {\n return true;\n }\n\n return false;\n}\n\nfunction isKnownPrefetchRequest(req: HttpIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getRequestContentLengthAttribute(request: HttpIncomingMessage): SpanAttributes {\n const { headers } = request;\n const contentLengthHeader = headers['content-length'];\n const length = contentLengthHeader ? parseInt(String(contentLengthHeader), 10) : -1;\n const encoding = headers['content-encoding'];\n return length >= 0\n ? encoding && encoding !== 'identity'\n ? { 'http.request_content_length': length }\n : { 'http.request_content_length_uncompressed': length }\n : {};\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,gBAAA,GAAmB,aAAA;AACzB,MAAM,sBAAA,GAAyB,wBAAA;AAO/B,MAAM,iBAAA,uBAAwB,OAAA,EAAwC;AAEtE,MAAM,YAAA,mBAAe,MAAA,CAAO,GAAA,CAAI,iCAAiC,CAAA;AAMjE,SAAS,YAAY,OAAA,EAAiC;AACpD,EAAA,OAAO,CAAC,OAAA,CAAQ,YAAY,CAAA,KAAM,OAAA,CAAQ,YAAY,CAAA,GAAI,IAAA,CAAA;AAC5D;AAEO,SAAS,gBAAA,CAAiB,SAAqC,MAAA,EAA0B;AAW9F,EAAA,MAAM,cAAc,MAAA,CAAO,IAAA;AAC3B,EAAA,MAAM,gBAAA,GAAmB,iBAAA,CAAkB,GAAA,CAAI,MAAM,CAAA;AAKrD,EAAA,IAAI,gBAAgB,gBAAA,EAAkB;AACpC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,OAAA,GAAU,IAAI,KAAA,CAAM,WAAA,EAAa;AAAA,IACrC,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAiB;AACtC,MAAA,MAAM,CA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MAAA,KAAW,KAAA,IAAS,oBAAA,CAAqB,OAAO,CAAA,EAAG;AAC3E,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,sBAAA,GAAyB,OAAA,EAAS,OAAO,CAAA,EAAG;AAC9C,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,qBAAqB,OAAA,EAA0B;AAC7D,EAAA,MAAM,IAAA,GAAO,yBAAyB,OAAO,CAAA;AAE7C,EAAA,IAAI,IAAA,CAAK,KAAA,CAAM,mEAAmE,CAAA,EAAG;AACnF,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,IAAA,CAAK,KAAA,CAAM,kEAAkE,CAAA,EAAG;AAClF,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,uBAAuB,GAAA,EAAmC;AAEjE,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,sBAAsB,CAAA,KAAM,GAAA;AACjD;AAEA,SAAS,iCAAiC,OAAA,EAA8C;AACtF,EAAA,MAAM,EAAE,SAAQ,GAAI,OAAA;AACpB,EAAA,MAAM,mBAAA,GAAsB,QAAQ,gBAAgB,CAAA;AACpD,EAAA,MAAM,SAAS,mBAAA,GAAsB,QAAA,CAAS,OAAO,mBAAmB,CAAA,EAAG,EAAE,CAAA,GAAI,EAAA;AACjF,EAAA,MAAM,QAAA,GAAW,QAAQ,kBAAkB,CAAA;AAC3C,EAAA,OAAO,MAAA,IAAU,CAAA,GACb,QAAA,IAAY,QAAA,KAAa,UAAA,GACvB,EAAE,6BAAA,EAA+B,MAAA,EAAO,GACxC,EAAE,0CAAA,EAA4C,MAAA,KAChD,EAAC;AACP;;;;"} |
@@ -8,4 +8,4 @@ import { addBreadcrumb } from '../breadcrumbs.js'; | ||
| import { debug } from '../utils/debug-logger.js'; | ||
| import { isPlainObject } from '../utils/is.js'; | ||
| import { addExceptionMechanism } from '../utils/misc.js'; | ||
| import { isPlainObject } from '../utils/is.js'; | ||
| import { SPAN_STATUS_ERROR, SPAN_STATUS_OK, setHttpStatus } from '../tracing/spanstatus.js'; | ||
@@ -12,0 +12,0 @@ import { startSpan } from '../tracing/trace.js'; |
@@ -1,1 +0,1 @@ | ||
| {"type":"module","version":"10.60.0","sideEffects":false} | ||
| {"type":"module","version":"10.61.0","sideEffects":false} |
+8
-16
@@ -157,11 +157,7 @@ import { DEBUG_BUILD } from './debug-build.js'; | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or | ||
| * an object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param newAttributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
@@ -173,3 +169,3 @@ * @example | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: { value: 'render_duration', unit: 'ms' }, | ||
| * render_duration: 150, | ||
| * }); | ||
@@ -189,12 +185,8 @@ * ``` | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - the attribute value. You can either pass in a raw value, or an attribute | ||
| * object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param value - The attribute value. | ||
| * | ||
@@ -204,3 +196,3 @@ * @example | ||
| * scope.setAttribute('is_admin', true); | ||
| * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' }); | ||
| * scope.setAttribute('render_duration', 150); | ||
| * ``` | ||
@@ -207,0 +199,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"scope.js","sources":["../../src/scope.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport type { Client } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { updateSession } from './session';\nimport type { Attachment } from './types/attachment';\nimport type { Breadcrumb } from './types/breadcrumb';\nimport type { Context, Contexts } from './types/context';\nimport type { DynamicSamplingContext } from './types/envelope';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { RequestEventData } from './types/request';\nimport type { Session } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { Span } from './types/span';\nimport type { PropagationContext } from './types/tracing';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isPlainObject } from './utils/is';\nimport { merge } from './utils/merge';\nimport { uuid4 } from './utils/misc';\nimport { generateTraceId } from './utils/propagationContext';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope';\nimport { truncate } from './utils/string';\nimport { dateTimestampInSeconds } from './utils/time';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * A context to be used for capturing an event.\n * This can either be a Scope, or a partial ScopeContext,\n * or a callback that receives the current scope and returns a new scope to use.\n */\nexport type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);\n\n/**\n * Data that can be converted to a Scope.\n */\nexport interface ScopeContext {\n user: User;\n level: SeverityLevel;\n extra: Extras;\n contexts: Contexts;\n tags: { [key: string]: Primitive };\n attributes?: RawAttributes<Record<string, unknown>>;\n fingerprint: string[];\n propagationContext: PropagationContext;\n conversationId?: string;\n}\n\nexport interface SdkProcessingMetadata {\n [key: string]: unknown;\n requestSession?: {\n status: 'ok' | 'errored' | 'crashed';\n };\n normalizedRequest?: RequestEventData;\n dynamicSamplingContext?: Partial<DynamicSamplingContext>;\n capturedSpanScope?: Scope;\n capturedSpanIsolationScope?: Scope;\n spanCountBeforeProcessing?: number;\n ipAddress?: string;\n}\n\n/**\n * Normalized data of the Scope, ready to be used.\n */\nexport interface ScopeData {\n eventProcessors: EventProcessor[];\n breadcrumbs: Breadcrumb[];\n user: User;\n tags: { [key: string]: Primitive };\n // TODO(v11): Make this a required field (could be subtly breaking if we did it today)\n attributes?: RawAttributes<Record<string, unknown>>;\n extra: Extras;\n contexts: Contexts;\n attachments: Attachment[];\n propagationContext: PropagationContext;\n sdkProcessingMetadata: SdkProcessingMetadata;\n fingerprint: string[];\n level?: SeverityLevel;\n transactionName?: string;\n span?: Span;\n conversationId?: string;\n}\n\n/**\n * Holds additional event information.\n */\nexport class Scope {\n /** Flag if notifying is happening. */\n protected _notifyingListeners: boolean;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void>;\n\n /** Callback list that will be called during event processing. */\n protected _eventProcessors: EventProcessor[];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[];\n\n /** User */\n protected _user: User;\n\n /** Tags */\n protected _tags: { [key: string]: Primitive };\n\n /** Attributes */\n protected _attributes: RawAttributes<Record<string, unknown>>;\n\n /** Extra */\n protected _extra: Extras;\n\n /** Contexts */\n protected _contexts: Contexts;\n\n /** Attachments */\n protected _attachments: Attachment[];\n\n /** Propagation Context for distributed tracing */\n protected _propagationContext: PropagationContext;\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n protected _sdkProcessingMetadata: SdkProcessingMetadata;\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: SeverityLevel;\n\n /**\n * Transaction Name\n *\n * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.\n * It's purpose is to assign a transaction to the scope that's added to non-transaction events.\n */\n protected _transactionName?: string;\n\n /** Session */\n protected _session?: Session;\n\n /** The client on this scope */\n protected _client?: Client;\n\n /** Contains the last event id of a captured event. */\n protected _lastEventId?: string;\n\n /** Conversation ID */\n protected _conversationId?: string;\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n public constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = {\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n };\n }\n\n /**\n * Clone all data from this scope into a new scope.\n */\n public clone(): Scope {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._attributes = { ...this._attributes };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n if (this._contexts.flags) {\n // We need to copy the `values` array so insertions on a cloned scope\n // won't affect the original array.\n newScope._contexts.flags = {\n values: [...this._contexts.flags.values],\n };\n }\n\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n newScope._lastEventId = this._lastEventId;\n newScope._conversationId = this._conversationId;\n\n _setSpanForScope(newScope, _getSpanForScope(this));\n\n return newScope;\n }\n\n /**\n * Update the client assigned to this scope.\n * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,\n * as well as manually created scopes.\n */\n public setClient(client: Client | undefined): void {\n this._client = client;\n }\n\n /**\n * Set the ID of the last captured error event.\n * This is generally only captured on the isolation scope.\n */\n public setLastEventId(lastEventId: string | undefined): void {\n this._lastEventId = lastEventId;\n }\n\n /**\n * Get the client assigned to this scope.\n */\n public getClient<C extends Client>(): C | undefined {\n return this._client as C | undefined;\n }\n\n /**\n * Get the ID of the last captured error event.\n * This is generally only available on the isolation scope.\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * Add an event processor that will be called before an event is sent.\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * Set the user for this scope.\n * Set to `null` to unset the user.\n */\n public setUser(user: User | null): this {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the user from this scope.\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * Set the conversation ID for this scope.\n * Set to `null` to unset the conversation ID.\n */\n public setConversationId(conversationId: string | null | undefined): this {\n this._conversationId = conversationId || undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set an object that will be merged into existing tags on the scope,\n * and will be sent as tags data with the event.\n */\n public setTags(tags: { [key: string]: Primitive }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single tag that will be sent as tags data with the event.\n */\n public setTag(key: string, value: Primitive): this {\n return this.setTags({ [key]: value });\n }\n\n /**\n * Sets attributes onto the scope.\n *\n * These attributes are currently applied to logs and metrics.\n * In the future, they will also be applied to spans.\n *\n * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for\n * more complex attribute types. We'll add this support in the future but already specify the wider type to\n * avoid a breaking change in the future.\n *\n * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or\n * an object with a `value` and an optional `unit` (if applicable to your attribute).\n *\n * @example\n * ```typescript\n * scope.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: { value: 'render_duration', unit: 'ms' },\n * });\n * ```\n */\n public setAttributes<T extends Record<string, unknown>>(newAttributes: RawAttributes<T>): this {\n this._attributes = {\n ...this._attributes,\n ...newAttributes,\n };\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets an attribute onto the scope.\n *\n * These attributes are currently applied to logs and metrics.\n * In the future, they will also be applied to spans.\n *\n * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for\n * more complex attribute types. We'll add this support in the future but already specify the wider type to\n * avoid a breaking change in the future.\n *\n * @param key - The attribute key.\n * @param value - the attribute value. You can either pass in a raw value, or an attribute\n * object with a `value` and an optional `unit` (if applicable to your attribute).\n *\n * @example\n * ```typescript\n * scope.setAttribute('is_admin', true);\n * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' });\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setAttribute<T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown>(\n key: string,\n value: RawAttribute<T>,\n ): this {\n return this.setAttributes({ [key]: value });\n }\n\n /**\n * Removes the attribute with the given key from the scope.\n *\n * @param key - The attribute key.\n *\n * @example\n * ```typescript\n * scope.removeAttribute('is_admin');\n * ```\n */\n public removeAttribute(key: string): this {\n if (key in this._attributes) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._attributes[key];\n this._notifyScopeListeners();\n }\n return this;\n }\n\n /**\n * Set an object that will be merged into existing extra on the scope,\n * and will be sent as extra data with the event.\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single key:value extra entry that will be sent as extra data with the event.\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the fingerprint on the scope to send with the events.\n * @param {string[]} fingerprint Fingerprint to group events in Sentry.\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the level on the scope for future events.\n */\n public setLevel(level: SeverityLevel): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope so that the name of e.g. taken server route or\n * the page location is attached to future events.\n *\n * IMPORTANT: Calling this function does NOT change the name of the currently active\n * root span. If you want to change the name of the active root span, use\n * `Sentry.updateSpanName(rootSpan, 'new name')` instead.\n *\n * By default, the SDK updates the scope's transaction name automatically on sensible\n * occasions, such as a page navigation or when handling a new request on the server.\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets context data with the given name.\n * Data passed as context will be normalized. You can also pass `null` to unset the context.\n * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set the session for the scope.\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the session from the scope.\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * Updates the scope with provided data. Can work in three variations:\n * - plain object containing updatable attributes\n * - Scope instance that'll extract the attributes from\n * - callback function that'll receive the current scope as an argument and allow for modifications\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n const scopeInstance =\n scopeToMerge instanceof Scope\n ? scopeToMerge.getScopeData()\n : isPlainObject(scopeToMerge)\n ? (captureContext as ScopeContext)\n : undefined;\n\n const {\n tags,\n attributes,\n extra,\n user,\n contexts,\n level,\n fingerprint = [],\n propagationContext,\n conversationId,\n } = scopeInstance || {};\n\n this._tags = { ...this._tags, ...tags };\n this._attributes = { ...this._attributes, ...attributes };\n this._extra = { ...this._extra, ...extra };\n this._contexts = { ...this._contexts, ...contexts };\n\n if (user && Object.keys(user).length) {\n this._user = user;\n }\n\n if (level) {\n this._level = level;\n }\n\n if (fingerprint.length) {\n this._fingerprint = fingerprint;\n }\n\n if (propagationContext) {\n this._propagationContext = propagationContext;\n }\n\n if (conversationId) {\n this._conversationId = conversationId;\n }\n\n return this;\n }\n\n /**\n * Clears the current scope and resets its properties.\n * Note: The client will not be cleared.\n */\n public clear(): this {\n // client is not cleared here on purpose!\n this._breadcrumbs = [];\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._session = undefined;\n this._conversationId = undefined;\n _setSpanForScope(this, undefined);\n this._attachments = [];\n this.setPropagationContext({\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n });\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Adds a breadcrumb to the scope.\n * By default, the last 100 breadcrumbs are kept.\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb: Breadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory\n message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,\n };\n\n this._breadcrumbs.push(mergedBreadcrumb);\n if (this._breadcrumbs.length > maxCrumbs) {\n this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);\n this._client?.recordDroppedEvent('buffer_overflow', 'log_item');\n }\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * Get the last breadcrumb of the scope.\n */\n public getLastBreadcrumb(): Breadcrumb | undefined {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * Clear all breadcrumbs from the scope.\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Add an attachment to the scope.\n */\n public addAttachment(attachment: Attachment): this {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * Clear all attachments from the scope.\n */\n public clearAttachments(): this {\n this._attachments = [];\n return this;\n }\n\n /**\n * Get the data of this scope, which should be applied to an event during processing.\n */\n public getScopeData(): ScopeData {\n return {\n breadcrumbs: this._breadcrumbs,\n attachments: this._attachments,\n contexts: this._contexts,\n tags: this._tags,\n attributes: this._attributes,\n extra: this._extra,\n user: this._user,\n level: this._level,\n fingerprint: this._fingerprint || [],\n eventProcessors: this._eventProcessors,\n propagationContext: this._propagationContext,\n sdkProcessingMetadata: this._sdkProcessingMetadata,\n transactionName: this._transactionName,\n span: _getSpanForScope(this),\n conversationId: this._conversationId,\n };\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry.\n */\n public setSDKProcessingMetadata(newData: SdkProcessingMetadata): this {\n this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);\n return this;\n }\n\n /**\n * Add propagation context to the scope, used for distributed tracing\n */\n public setPropagationContext(context: PropagationContext): this {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * Get propagation context from the scope, used for distributed tracing\n */\n public getPropagationContext(): PropagationContext {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @returns {string} The id of the captured Sentry event.\n */\n public captureException(exception: unknown, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @returns {string} The id of the captured message.\n */\n public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = hint?.syntheticException ?? new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a Sentry event for this scope.\n *\n * @returns {string} The id of the captured event.\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = event.event_id || hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAgCA,MAAM,uBAAA,GAA0B,GAAA;AA8DzB,MAAM,KAAA,CAAM;AAAA;AAAA,EAoEV,WAAA,GAAc;AACnB,IAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AA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D,CAAA;AACnF,MAAA,OAAO,OAAA;AAAA,IACT;AAEA,IAAA,IAAA,CAAK,OAAA,CAAQ,aAAa,KAAA,EAAO,EAAE,GAAG,IAAA,EAAM,QAAA,EAAU,OAAA,EAAQ,EAAG,IAAI,CAAA;AAErE,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKU,qBAAA,GAA8B;AAItC,IAAA,IAAI,CAAC,KAAK,mBAAA,EAAqB;AAC7B,MAAA,IAAA,CAAK,mBAAA,GAAsB,IAAA;AAC3B,MAAA,IAAA,CAAK,eAAA,CAAgB,QAAQ,CAAA,QAAA,KAAY;AACvC,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACf,CAAC,CAAA;AACD,MAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAAA,IAC7B;AAAA,EACF;AACF;;;;"} | ||
| {"version":3,"file":"scope.js","sources":["../../src/scope.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { AttributeObject, RawAttribute, RawAttributes } from './attributes';\nimport type { Client } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { updateSession } from './session';\nimport type { Attachment } from './types/attachment';\nimport type { Breadcrumb } from './types/breadcrumb';\nimport type { Context, Contexts } from './types/context';\nimport type { DynamicSamplingContext } from './types/envelope';\nimport type { Event, EventHint } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { Extra, Extras } from './types/extra';\nimport type { Primitive } from './types/misc';\nimport type { RequestEventData } from './types/request';\nimport type { Session } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { Span } from './types/span';\nimport type { PropagationContext } from './types/tracing';\nimport type { User } from './types/user';\nimport { debug } from './utils/debug-logger';\nimport { isPlainObject } from './utils/is';\nimport { merge } from './utils/merge';\nimport { uuid4 } from './utils/misc';\nimport { generateTraceId } from './utils/propagationContext';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope';\nimport { truncate } from './utils/string';\nimport { dateTimestampInSeconds } from './utils/time';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * A context to be used for capturing an event.\n * This can either be a Scope, or a partial ScopeContext,\n * or a callback that receives the current scope and returns a new scope to use.\n */\nexport type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);\n\n/**\n * Data that can be converted to a Scope.\n */\nexport interface ScopeContext {\n user: User;\n level: SeverityLevel;\n extra: Extras;\n contexts: Contexts;\n tags: { [key: string]: Primitive };\n attributes?: RawAttributes<Record<string, unknown>>;\n fingerprint: string[];\n propagationContext: PropagationContext;\n conversationId?: string;\n}\n\nexport interface SdkProcessingMetadata {\n [key: string]: unknown;\n requestSession?: {\n status: 'ok' | 'errored' | 'crashed';\n };\n normalizedRequest?: RequestEventData;\n dynamicSamplingContext?: Partial<DynamicSamplingContext>;\n capturedSpanScope?: Scope;\n capturedSpanIsolationScope?: Scope;\n spanCountBeforeProcessing?: number;\n ipAddress?: string;\n}\n\n/**\n * Normalized data of the Scope, ready to be used.\n */\nexport interface ScopeData {\n eventProcessors: EventProcessor[];\n breadcrumbs: Breadcrumb[];\n user: User;\n tags: { [key: string]: Primitive };\n // TODO(v11): Make this a required field (could be subtly breaking if we did it today)\n attributes?: RawAttributes<Record<string, unknown>>;\n extra: Extras;\n contexts: Contexts;\n attachments: Attachment[];\n propagationContext: PropagationContext;\n sdkProcessingMetadata: SdkProcessingMetadata;\n fingerprint: string[];\n level?: SeverityLevel;\n transactionName?: string;\n span?: Span;\n conversationId?: string;\n}\n\n/**\n * Holds additional event information.\n */\nexport class Scope {\n /** Flag if notifying is happening. */\n protected _notifyingListeners: boolean;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void>;\n\n /** Callback list that will be called during event processing. */\n protected _eventProcessors: EventProcessor[];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[];\n\n /** User */\n protected _user: User;\n\n /** Tags */\n protected _tags: { [key: string]: Primitive };\n\n /** Attributes */\n protected _attributes: RawAttributes<Record<string, unknown>>;\n\n /** Extra */\n protected _extra: Extras;\n\n /** Contexts */\n protected _contexts: Contexts;\n\n /** Attachments */\n protected _attachments: Attachment[];\n\n /** Propagation Context for distributed tracing */\n protected _propagationContext: PropagationContext;\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n protected _sdkProcessingMetadata: SdkProcessingMetadata;\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: SeverityLevel;\n\n /**\n * Transaction Name\n *\n * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.\n * It's purpose is to assign a transaction to the scope that's added to non-transaction events.\n */\n protected _transactionName?: string;\n\n /** Session */\n protected _session?: Session;\n\n /** The client on this scope */\n protected _client?: Client;\n\n /** Contains the last event id of a captured event. */\n protected _lastEventId?: string;\n\n /** Conversation ID */\n protected _conversationId?: string;\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n public constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = {\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n };\n }\n\n /**\n * Clone all data from this scope into a new scope.\n */\n public clone(): Scope {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._attributes = { ...this._attributes };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n if (this._contexts.flags) {\n // We need to copy the `values` array so insertions on a cloned scope\n // won't affect the original array.\n newScope._contexts.flags = {\n values: [...this._contexts.flags.values],\n };\n }\n\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n newScope._lastEventId = this._lastEventId;\n newScope._conversationId = this._conversationId;\n\n _setSpanForScope(newScope, _getSpanForScope(this));\n\n return newScope;\n }\n\n /**\n * Update the client assigned to this scope.\n * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,\n * as well as manually created scopes.\n */\n public setClient(client: Client | undefined): void {\n this._client = client;\n }\n\n /**\n * Set the ID of the last captured error event.\n * This is generally only captured on the isolation scope.\n */\n public setLastEventId(lastEventId: string | undefined): void {\n this._lastEventId = lastEventId;\n }\n\n /**\n * Get the client assigned to this scope.\n */\n public getClient<C extends Client>(): C | undefined {\n return this._client as C | undefined;\n }\n\n /**\n * Get the ID of the last captured error event.\n * This is generally only available on the isolation scope.\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * Add an event processor that will be called before an event is sent.\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * Set the user for this scope.\n * Set to `null` to unset the user.\n */\n public setUser(user: User | null): this {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the user from this scope.\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * Set the conversation ID for this scope.\n * Set to `null` to unset the conversation ID.\n */\n public setConversationId(conversationId: string | null | undefined): this {\n this._conversationId = conversationId || undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set an object that will be merged into existing tags on the scope,\n * and will be sent as tags data with the event.\n */\n public setTags(tags: { [key: string]: Primitive }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single tag that will be sent as tags data with the event.\n */\n public setTag(key: string, value: Primitive): this {\n return this.setTags({ [key]: value });\n }\n\n /**\n * Sets attributes onto the scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param newAttributes - The attributes to set on the scope, as key-value pairs.\n *\n * @example\n * ```typescript\n * scope.setAttributes({\n * is_admin: true,\n * payment_selection: 'credit_card',\n * render_duration: 150,\n * });\n * ```\n */\n public setAttributes<T extends Record<string, unknown>>(newAttributes: RawAttributes<T>): this {\n this._attributes = {\n ...this._attributes,\n ...newAttributes,\n };\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets an attribute onto the scope.\n *\n * These attributes are applied to logs, metrics and streamed spans.\n *\n * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`.\n *\n * @param key - The attribute key.\n * @param value - The attribute value.\n *\n * @example\n * ```typescript\n * scope.setAttribute('is_admin', true);\n * scope.setAttribute('render_duration', 150);\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setAttribute<T extends RawAttribute<T> extends { value: any } | { unit: any } ? AttributeObject : unknown>(\n key: string,\n value: RawAttribute<T>,\n ): this {\n return this.setAttributes({ [key]: value });\n }\n\n /**\n * Removes the attribute with the given key from the scope.\n *\n * @param key - The attribute key.\n *\n * @example\n * ```typescript\n * scope.removeAttribute('is_admin');\n * ```\n */\n public removeAttribute(key: string): this {\n if (key in this._attributes) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._attributes[key];\n this._notifyScopeListeners();\n }\n return this;\n }\n\n /**\n * Set an object that will be merged into existing extra on the scope,\n * and will be sent as extra data with the event.\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set a single key:value extra entry that will be sent as extra data with the event.\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the fingerprint on the scope to send with the events.\n * @param {string[]} fingerprint Fingerprint to group events in Sentry.\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the level on the scope for future events.\n */\n public setLevel(level: SeverityLevel): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope so that the name of e.g. taken server route or\n * the page location is attached to future events.\n *\n * IMPORTANT: Calling this function does NOT change the name of the currently active\n * root span. If you want to change the name of the active root span, use\n * `Sentry.updateSpanName(rootSpan, 'new name')` instead.\n *\n * By default, the SDK updates the scope's transaction name automatically on sensible\n * occasions, such as a page navigation or when handling a new request on the server.\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets context data with the given name.\n * Data passed as context will be normalized. You can also pass `null` to unset the context.\n * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Set the session for the scope.\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Get the session from the scope.\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * Updates the scope with provided data. Can work in three variations:\n * - plain object containing updatable attributes\n * - Scope instance that'll extract the attributes from\n * - callback function that'll receive the current scope as an argument and allow for modifications\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n const scopeInstance =\n scopeToMerge instanceof Scope\n ? scopeToMerge.getScopeData()\n : isPlainObject(scopeToMerge)\n ? (captureContext as ScopeContext)\n : undefined;\n\n const {\n tags,\n attributes,\n extra,\n user,\n contexts,\n level,\n fingerprint = [],\n propagationContext,\n conversationId,\n } = scopeInstance || {};\n\n this._tags = { ...this._tags, ...tags };\n this._attributes = { ...this._attributes, ...attributes };\n this._extra = { ...this._extra, ...extra };\n this._contexts = { ...this._contexts, ...contexts };\n\n if (user && Object.keys(user).length) {\n this._user = user;\n }\n\n if (level) {\n this._level = level;\n }\n\n if (fingerprint.length) {\n this._fingerprint = fingerprint;\n }\n\n if (propagationContext) {\n this._propagationContext = propagationContext;\n }\n\n if (conversationId) {\n this._conversationId = conversationId;\n }\n\n return this;\n }\n\n /**\n * Clears the current scope and resets its properties.\n * Note: The client will not be cleared.\n */\n public clear(): this {\n // client is not cleared here on purpose!\n this._breadcrumbs = [];\n this._tags = {};\n this._attributes = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._session = undefined;\n this._conversationId = undefined;\n _setSpanForScope(this, undefined);\n this._attachments = [];\n this.setPropagationContext({\n traceId: generateTraceId(),\n sampleRand: safeMathRandom(),\n });\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Adds a breadcrumb to the scope.\n * By default, the last 100 breadcrumbs are kept.\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb: Breadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory\n message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,\n };\n\n this._breadcrumbs.push(mergedBreadcrumb);\n if (this._breadcrumbs.length > maxCrumbs) {\n this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);\n this._client?.recordDroppedEvent('buffer_overflow', 'log_item');\n }\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * Get the last breadcrumb of the scope.\n */\n public getLastBreadcrumb(): Breadcrumb | undefined {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * Clear all breadcrumbs from the scope.\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Add an attachment to the scope.\n */\n public addAttachment(attachment: Attachment): this {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * Clear all attachments from the scope.\n */\n public clearAttachments(): this {\n this._attachments = [];\n return this;\n }\n\n /**\n * Get the data of this scope, which should be applied to an event during processing.\n */\n public getScopeData(): ScopeData {\n return {\n breadcrumbs: this._breadcrumbs,\n attachments: this._attachments,\n contexts: this._contexts,\n tags: this._tags,\n attributes: this._attributes,\n extra: this._extra,\n user: this._user,\n level: this._level,\n fingerprint: this._fingerprint || [],\n eventProcessors: this._eventProcessors,\n propagationContext: this._propagationContext,\n sdkProcessingMetadata: this._sdkProcessingMetadata,\n transactionName: this._transactionName,\n span: _getSpanForScope(this),\n conversationId: this._conversationId,\n };\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry.\n */\n public setSDKProcessingMetadata(newData: SdkProcessingMetadata): this {\n this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);\n return this;\n }\n\n /**\n * Add propagation context to the scope, used for distributed tracing\n */\n public setPropagationContext(context: PropagationContext): this {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * Get propagation context from the scope, used for distributed tracing\n */\n public getPropagationContext(): PropagationContext {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @returns {string} The id of the captured Sentry event.\n */\n public captureException(exception: unknown, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @returns {string} The id of the captured message.\n */\n public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {\n const eventId = hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = hint?.syntheticException ?? new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a Sentry event for this scope.\n *\n * @returns {string} The id of the captured event.\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = event.event_id || hint?.event_id || uuid4();\n\n if (!this._client) {\n DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAgCA,MAAM,uBAAA,GAA0B,GAAA;AA8Dz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S;AACjB,MAAA,WAAA,IAAe,KAAA,CAAM,KAAK,yDAAyD,CAAA;AACnF,MAAA,OAAO,OAAA;AAAA,IACT;AAEA,IAAA,IAAA,CAAK,OAAA,CAAQ,aAAa,KAAA,EAAO,EAAE,GAAG,IAAA,EAAM,QAAA,EAAU,OAAA,EAAQ,EAAG,IAAI,CAAA;AAErE,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKU,qBAAA,GAA8B;AAItC,IAAA,IAAI,CAAC,KAAK,mBAAA,EAAqB;AAC7B,MAAA,IAAA,CAAK,mBAAA,GAAsB,IAAA;AAC3B,MAAA,IAAA,CAAK,eAAA,CAAgB,QAAQ,CAAA,QAAA,KAAY;AACvC,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACf,CAAC,CAAA;AACD,MAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAAA,IAC7B;AAAA,EACF;AACF;;;;"} |
@@ -16,6 +16,6 @@ export { registerSpanErrorInstrumentation } from './tracing/errors.js'; | ||
| export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setAttribute, setAttributes, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
| export { getClient, getCurrentScope, getExternalPropagationContext, getGlobalScope, getIsolationScope, getTraceContextFromScope, hasExternalPropagationContext, registerExternalPropagationContext, withIsolationScope, withScope } from './currentScopes.js'; | ||
| export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes.js'; | ||
| export { setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { _INTERNAL_createTracingChannelBinding, getTracingChannelBinding as _INTERNAL_getTracingChannelBinding, setAsyncContextStrategy } from './asyncContext/index.js'; | ||
| export { getGlobalSingleton, getMainCarrier } from './carrier.js'; | ||
@@ -59,2 +59,3 @@ export { closeSession, makeSession, updateSession } from './session.js'; | ||
| export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants.js'; | ||
| export { SPAN_KIND } from './spanKind.js'; | ||
| export { addBreadcrumb } from './breadcrumbs.js'; | ||
@@ -157,3 +158,4 @@ export { functionToStringIntegration } from './integrations/functiontostring.js'; | ||
| export { expressErrorHandler, patchExpressModule, setupExpressErrorHandler } from './integrations/express/index.js'; | ||
| export { instrumentPostgresJsSql } from './integrations/postgresjs.js'; | ||
| export { _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, instrumentPostgresJsSql } from './integrations/postgresjs.js'; | ||
| export { getSqlQuerySummary as _INTERNAL_getSqlQuerySummary } from './utils/sql.js'; | ||
| export { patchHttpModuleClient } from './integrations/http/client-patch.js'; | ||
@@ -160,0 +162,0 @@ export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
@@ -24,3 +24,3 @@ import { captureException } from '../../exports.js'; | ||
| } | ||
| return !hasSpanStreamingEnabled(client) && !client.getOptions().streamGenAiSpans; | ||
| return !hasSpanStreamingEnabled(client) && client.getOptions().streamGenAiSpans === false; | ||
| } | ||
@@ -27,0 +27,0 @@ function buildMethodPath(currentPath, prop) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"utils.js","sources":["../../../../src/tracing/ai/utils.ts"],"sourcesContent":["/**\n * Shared utils for AI integrations (OpenAI, Anthropic, Verce.AI, etc.)\n */\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { hasSpanStreamingEnabled } from '../spans/hasSpanStreamingEnabled';\nimport type { Span } from '../../types/span';\nimport { isThenable } from '../../utils/is';\nimport {\n GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_STREAMING_ATTRIBUTE,\n GEN_AI_RESPONSE_TEXT_ATTRIBUTE,\n GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,\n} from './gen-ai-attributes';\nimport { truncateGenAiMessages, truncateGenAiStringInput } from './messageTruncation';\n\nexport interface AIRecordingOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n}\n\n/**\n * A method registry entry describes a single instrumented method:\n * which gen_ai operation it maps to and whether it is intrinsically streaming.\n */\nexport interface InstrumentedMethodEntry {\n /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */\n operation?: string;\n /** True if the method itself is always streaming (not param-based) */\n streaming?: boolean;\n /** When set, the method's return value is re-proxied with this as the base path */\n proxyResultPath?: string;\n}\n\n/**\n * Maps method paths to their registry entries.\n * Used by proxy-based AI client instrumentations to determine which methods\n * to instrument, what operation name to use, and whether they stream.\n */\nexport type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>;\n\n/**\n * Resolves AI recording options by falling back to the client's `dataCollection.genAI` settings.\n * Precedence: explicit option > dataCollection.genAI > sendDefaultPii > false\n */\nexport function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions> {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n return {\n ...options,\n recordInputs: options?.recordInputs ?? genAI?.inputs ?? false,\n recordOutputs: options?.recordOutputs ?? genAI?.outputs ?? false,\n } as T & Required<AIRecordingOptions>;\n}\n\n/**\n * Resolves whether truncation should be enabled.\n * If the user explicitly set `enableTruncation`, that value is used.\n * Otherwise, truncation is disabled whenever gen_ai spans are sent through the span streaming / v2\n * span path, i.e. full span streaming (`traceLifecycle: 'stream'`) or `streamGenAiSpans`. That path\n * is not subject to the transaction payload-size limits that truncation works around, so the full\n * message data can be retained.\n */\nexport function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean {\n if (enableTruncation !== undefined) {\n return enableTruncation;\n }\n\n const client = getClient();\n if (!client) {\n return true;\n }\n\n return !hasSpanStreamingEnabled(client) && !client.getOptions().streamGenAiSpans;\n}\n\n/**\n * Build method path from current traversal\n */\nexport function buildMethodPath(currentPath: string, prop: string): string {\n return currentPath ? `${currentPath}.${prop}` : prop;\n}\n\n/**\n * Set token usage attributes\n * @param span - The span to add attributes to\n * @param promptTokens - The number of prompt tokens\n * @param completionTokens - The number of completion tokens\n * @param cachedInputTokens - The number of cached input tokens\n * @param cachedOutputTokens - The number of cached output tokens\n */\nexport function setTokenUsageAttributes(\n span: Span,\n promptTokens?: number,\n completionTokens?: number,\n cachedInputTokens?: number,\n cachedOutputTokens?: number,\n): void {\n if (promptTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: promptTokens,\n });\n }\n if (completionTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: completionTokens,\n });\n }\n if (\n promptTokens !== undefined ||\n completionTokens !== undefined ||\n cachedInputTokens !== undefined ||\n cachedOutputTokens !== undefined\n ) {\n /**\n * Total input tokens in a request is the summation of `input_tokens`,\n * `cache_creation_input_tokens`, and `cache_read_input_tokens`.\n */\n const totalTokens =\n (promptTokens ?? 0) + (completionTokens ?? 0) + (cachedInputTokens ?? 0) + (cachedOutputTokens ?? 0);\n\n span.setAttributes({\n [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: totalTokens,\n });\n }\n}\n\nexport interface StreamResponseState {\n responseId?: string;\n responseModel?: string;\n finishReasons: string[];\n responseTexts: string[];\n toolCalls: unknown[];\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n cacheCreationInputTokens?: number;\n cacheReadInputTokens?: number;\n}\n\n/**\n * Ends a streaming span by setting all accumulated response attributes and ending the span.\n * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.\n */\nexport function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void {\n if (!span.isRecording()) {\n return;\n }\n\n const attrs: Record<string, string | number | boolean> = {\n [GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true,\n };\n\n if (state.responseId) attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;\n if (state.responseModel) attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;\n\n if (state.promptTokens !== undefined) attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;\n if (state.completionTokens !== undefined) attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;\n\n // Use explicit total if provided (OpenAI, Google), otherwise compute from cache tokens (Anthropic)\n if (state.totalTokens !== undefined) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;\n } else if (\n state.promptTokens !== undefined ||\n state.completionTokens !== undefined ||\n state.cacheCreationInputTokens !== undefined ||\n state.cacheReadInputTokens !== undefined\n ) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] =\n (state.promptTokens ?? 0) +\n (state.completionTokens ?? 0) +\n (state.cacheCreationInputTokens ?? 0) +\n (state.cacheReadInputTokens ?? 0);\n }\n\n if (state.finishReasons.length) {\n attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);\n }\n if (recordOutputs && state.responseTexts.length) {\n attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join('');\n }\n if (recordOutputs && state.toolCalls.length) {\n attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);\n }\n\n span.setAttributes(attrs);\n span.end();\n}\n\n/**\n * Serialize a value to a JSON string without truncation.\n * Strings are returned as-is, arrays and objects are JSON-stringified.\n */\nexport function getJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n return value;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Get the truncated JSON string for a string or array of strings.\n *\n * @param value - The string or array of strings to truncate\n * @returns The truncated JSON string\n */\nexport function getTruncatedJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n // Some values are already JSON strings, so we don't need to duplicate the JSON parsing\n return truncateGenAiStringInput(value);\n }\n if (Array.isArray(value)) {\n // truncateGenAiMessages returns an array of strings, so we need to stringify it\n const truncatedMessages = truncateGenAiMessages(value);\n return JSON.stringify(truncatedMessages);\n }\n // value is an object, so we need to stringify it\n return JSON.stringify(value);\n}\n\n/**\n * Extract system instructions from messages array.\n * Finds the first system message and formats it according to OpenTelemetry semantic conventions.\n *\n * @param messages - Array of messages to extract system instructions from\n * @returns systemInstructions (JSON string) and filteredMessages (without system message)\n */\nexport function extractSystemInstructions(messages: unknown[] | unknown): {\n systemInstructions: string | undefined;\n filteredMessages: unknown[] | unknown;\n} {\n if (!Array.isArray(messages)) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessageIndex = messages.findIndex(\n msg => msg && typeof msg === 'object' && 'role' in msg && (msg as { role: string }).role === 'system',\n );\n\n if (systemMessageIndex === -1) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessage = messages[systemMessageIndex] as { role: string; content?: string | unknown };\n const systemContent =\n typeof systemMessage.content === 'string'\n ? systemMessage.content\n : systemMessage.content !== undefined\n ? JSON.stringify(systemMessage.content)\n : undefined;\n\n if (!systemContent) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemInstructions = JSON.stringify([{ type: 'text', content: systemContent }]);\n const filteredMessages = [...messages.slice(0, systemMessageIndex), ...messages.slice(systemMessageIndex + 1)];\n\n return { systemInstructions, filteredMessages };\n}\n\n/**\n * Creates a wrapped version of .withResponse() that replaces the data field\n * with the instrumented result while preserving metadata (response, request_id).\n */\nasync function createWithResponseWrapper<T>(\n originalWithResponse: Promise<unknown>,\n instrumentedPromise: Promise<T>,\n mechanismType: string,\n): Promise<unknown> {\n // Attach catch handler to originalWithResponse immediately to prevent unhandled rejection\n // If instrumentedPromise rejects first, we still need this handled\n const safeOriginalWithResponse = originalWithResponse.catch(error => {\n captureException(error, {\n mechanism: {\n handled: false,\n type: mechanismType,\n },\n });\n throw error;\n });\n\n const instrumentedResult = await instrumentedPromise;\n const originalWrapper = await safeOriginalWithResponse;\n\n // Combine instrumented result with original metadata\n if (originalWrapper && typeof originalWrapper === 'object' && 'data' in originalWrapper) {\n return {\n ...originalWrapper,\n data: instrumentedResult,\n };\n }\n return instrumentedResult;\n}\n\n/**\n * Wraps a promise-like object to preserve additional methods (like .withResponse())\n * that AI SDK clients (OpenAI, Anthropic) attach to their APIPromise return values.\n *\n * Standard Promise methods (.then, .catch, .finally) are routed to the instrumented\n * promise to preserve Sentry's span instrumentation, while custom SDK methods are\n * forwarded to the original promise to maintain the SDK's API surface.\n */\nexport function wrapPromiseWithMethods<R>(\n originalPromiseLike: Promise<R>,\n instrumentedPromise: Promise<R>,\n mechanismType: string,\n): Promise<R> {\n // If the original result is not thenable, return the instrumented promise\n if (!isThenable(originalPromiseLike)) {\n return instrumentedPromise;\n }\n\n // Create a proxy that forwards Promise methods to instrumentedPromise\n // and preserves additional methods from the original result\n return new Proxy(originalPromiseLike, {\n get(target: object, prop: string | symbol): unknown {\n // For standard Promise methods (.then, .catch, .finally, Symbol.toStringTag),\n // use instrumentedPromise to preserve Sentry instrumentation.\n // For custom methods (like .withResponse()), use the original target.\n const useInstrumentedPromise = prop in Promise.prototype || prop === Symbol.toStringTag;\n const source = useInstrumentedPromise ? instrumentedPromise : target;\n\n const value = Reflect.get(source, prop) as unknown;\n\n // Special handling for .withResponse() to preserve instrumentation\n // .withResponse() returns { data: T, response: Response, request_id: string }\n if (prop === 'withResponse' && typeof value === 'function') {\n return function wrappedWithResponse(this: unknown): unknown {\n const originalWithResponse = (value as (...args: unknown[]) => unknown).call(target);\n return createWithResponseWrapper(originalWithResponse, instrumentedPromise, mechanismType);\n };\n }\n\n return typeof value === 'function' ? value.bind(source) : value;\n },\n }) as Promise<R>;\n}\n"],"names":[],"mappings":";;;;;;;AAkDO,SAAS,0BAAwD,OAAA,EAA+C;AACrH,EAAA,MAAM,KAAA,GAAQ,SAAA,EAAU,EAAG,wBAAA,EAAyB,CAAE,KAAA;AACtD,EAAA,OAAO;AAAA,IACL,GAAG,OAAA;AAAA,IACH,YAAA,EAAc,OAAA,EAAS,YAAA,IAAgB,KAAA,EAAO,MAAA,IAAU,KAAA;AAAA,IACxD,aAAA,EAAe,OAAA,EAAS,aAAA,IAAiB,KAAA,EAAO,OAAA,IAAW;AAAA,GAC7D;AACF;AAUO,SAAS,uBAAuB,gBAAA,EAAgD;AACrF,EAAA,IAAI,qBAAqB,MAAA,EAAW;AAClC,IAAA,OAAO,gBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,IAAI,CA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kBAAA;AACT;AAUO,SAAS,sBAAA,CACd,mBAAA,EACA,mBAAA,EACA,aAAA,EACY;AAEZ,EAAA,IAAI,CAAC,UAAA,CAAW,mBAAmB,CAAA,EAAG;AACpC,IAAA,OAAO,mBAAA;AAAA,EACT;AAIA,EAAA,OAAO,IAAI,MAAM,mBAAA,EAAqB;AAAA,IACpC,GAAA,CAAI,QAAgB,IAAA,EAAgC;AAIlD,MAAA,MAAM,sBAAA,GAAyB,IAAA,IAAQ,OAAA,CAAQ,SAAA,IAAa,SAAS,MAAA,CAAO,WAAA;AAC5E,MAAA,MAAM,MAAA,GAAS,yBAAyB,mBAAA,GAAsB,MAAA;AAE9D,MAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,IAAI,CAAA;AAItC,MAAA,IAAI,IAAA,KAAS,cAAA,IAAkB,OAAO,KAAA,KAAU,UAAA,EAAY;AAC1D,QAAA,OAAO,SAAS,mBAAA,GAA4C;AAC1D,UAAA,MAAM,oBAAA,GAAwB,KAAA,CAA0C,IAAA,CAAK,MAAM,CAAA;AACnF,UAAA,OAAO,yBAAA,CAA0B,oBAAA,EAAsB,mBAAA,EAAqB,aAAa,CAAA;AAAA,QAC3F,CAAA;AAAA,MACF;AAEA,MAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH;;;;"} | ||
| {"version":3,"file":"utils.js","sources":["../../../../src/tracing/ai/utils.ts"],"sourcesContent":["/**\n * Shared utils for AI integrations (OpenAI, Anthropic, Verce.AI, etc.)\n */\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { hasSpanStreamingEnabled } from '../spans/hasSpanStreamingEnabled';\nimport type { Span } from '../../types/span';\nimport { isThenable } from '../../utils/is';\nimport {\n GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_STREAMING_ATTRIBUTE,\n GEN_AI_RESPONSE_TEXT_ATTRIBUTE,\n GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,\n} from './gen-ai-attributes';\nimport { truncateGenAiMessages, truncateGenAiStringInput } from './messageTruncation';\n\nexport interface AIRecordingOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n}\n\n/**\n * A method registry entry describes a single instrumented method:\n * which gen_ai operation it maps to and whether it is intrinsically streaming.\n */\nexport interface InstrumentedMethodEntry {\n /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */\n operation?: string;\n /** True if the method itself is always streaming (not param-based) */\n streaming?: boolean;\n /** When set, the method's return value is re-proxied with this as the base path */\n proxyResultPath?: string;\n}\n\n/**\n * Maps method paths to their registry entries.\n * Used by proxy-based AI client instrumentations to determine which methods\n * to instrument, what operation name to use, and whether they stream.\n */\nexport type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>;\n\n/**\n * Resolves AI recording options by falling back to the client's `dataCollection.genAI` settings.\n * Precedence: explicit option > dataCollection.genAI > sendDefaultPii > false\n */\nexport function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions> {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n return {\n ...options,\n recordInputs: options?.recordInputs ?? genAI?.inputs ?? false,\n recordOutputs: options?.recordOutputs ?? genAI?.outputs ?? false,\n } as T & Required<AIRecordingOptions>;\n}\n\n/**\n * Resolves whether truncation should be enabled.\n * If the user explicitly set `enableTruncation`, that value is used.\n * Otherwise, truncation is disabled whenever gen_ai spans are sent through the span streaming / v2\n * span path, i.e. full span streaming (`traceLifecycle: 'stream'`) or `streamGenAiSpans`. That path\n * is not subject to the transaction payload-size limits that truncation works around, so the full\n * message data can be retained. `streamGenAiSpans` is opt-out (on unless explicitly set to `false`).\n */\nexport function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean {\n if (enableTruncation !== undefined) {\n return enableTruncation;\n }\n\n const client = getClient();\n if (!client) {\n return true;\n }\n\n return !hasSpanStreamingEnabled(client) && client.getOptions().streamGenAiSpans === false;\n}\n\n/**\n * Build method path from current traversal\n */\nexport function buildMethodPath(currentPath: string, prop: string): string {\n return currentPath ? `${currentPath}.${prop}` : prop;\n}\n\n/**\n * Set token usage attributes\n * @param span - The span to add attributes to\n * @param promptTokens - The number of prompt tokens\n * @param completionTokens - The number of completion tokens\n * @param cachedInputTokens - The number of cached input tokens\n * @param cachedOutputTokens - The number of cached output tokens\n */\nexport function setTokenUsageAttributes(\n span: Span,\n promptTokens?: number,\n completionTokens?: number,\n cachedInputTokens?: number,\n cachedOutputTokens?: number,\n): void {\n if (promptTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: promptTokens,\n });\n }\n if (completionTokens !== undefined) {\n span.setAttributes({\n [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: completionTokens,\n });\n }\n if (\n promptTokens !== undefined ||\n completionTokens !== undefined ||\n cachedInputTokens !== undefined ||\n cachedOutputTokens !== undefined\n ) {\n /**\n * Total input tokens in a request is the summation of `input_tokens`,\n * `cache_creation_input_tokens`, and `cache_read_input_tokens`.\n */\n const totalTokens =\n (promptTokens ?? 0) + (completionTokens ?? 0) + (cachedInputTokens ?? 0) + (cachedOutputTokens ?? 0);\n\n span.setAttributes({\n [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: totalTokens,\n });\n }\n}\n\nexport interface StreamResponseState {\n responseId?: string;\n responseModel?: string;\n finishReasons: string[];\n responseTexts: string[];\n toolCalls: unknown[];\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n cacheCreationInputTokens?: number;\n cacheReadInputTokens?: number;\n}\n\n/**\n * Ends a streaming span by setting all accumulated response attributes and ending the span.\n * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.\n */\nexport function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void {\n if (!span.isRecording()) {\n return;\n }\n\n const attrs: Record<string, string | number | boolean> = {\n [GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true,\n };\n\n if (state.responseId) attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;\n if (state.responseModel) attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;\n\n if (state.promptTokens !== undefined) attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;\n if (state.completionTokens !== undefined) attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;\n\n // Use explicit total if provided (OpenAI, Google), otherwise compute from cache tokens (Anthropic)\n if (state.totalTokens !== undefined) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;\n } else if (\n state.promptTokens !== undefined ||\n state.completionTokens !== undefined ||\n state.cacheCreationInputTokens !== undefined ||\n state.cacheReadInputTokens !== undefined\n ) {\n attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] =\n (state.promptTokens ?? 0) +\n (state.completionTokens ?? 0) +\n (state.cacheCreationInputTokens ?? 0) +\n (state.cacheReadInputTokens ?? 0);\n }\n\n if (state.finishReasons.length) {\n attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);\n }\n if (recordOutputs && state.responseTexts.length) {\n attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join('');\n }\n if (recordOutputs && state.toolCalls.length) {\n attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);\n }\n\n span.setAttributes(attrs);\n span.end();\n}\n\n/**\n * Serialize a value to a JSON string without truncation.\n * Strings are returned as-is, arrays and objects are JSON-stringified.\n */\nexport function getJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n return value;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Get the truncated JSON string for a string or array of strings.\n *\n * @param value - The string or array of strings to truncate\n * @returns The truncated JSON string\n */\nexport function getTruncatedJsonString<T>(value: T | T[]): string {\n if (typeof value === 'string') {\n // Some values are already JSON strings, so we don't need to duplicate the JSON parsing\n return truncateGenAiStringInput(value);\n }\n if (Array.isArray(value)) {\n // truncateGenAiMessages returns an array of strings, so we need to stringify it\n const truncatedMessages = truncateGenAiMessages(value);\n return JSON.stringify(truncatedMessages);\n }\n // value is an object, so we need to stringify it\n return JSON.stringify(value);\n}\n\n/**\n * Extract system instructions from messages array.\n * Finds the first system message and formats it according to OpenTelemetry semantic conventions.\n *\n * @param messages - Array of messages to extract system instructions from\n * @returns systemInstructions (JSON string) and filteredMessages (without system message)\n */\nexport function extractSystemInstructions(messages: unknown[] | unknown): {\n systemInstructions: string | undefined;\n filteredMessages: unknown[] | unknown;\n} {\n if (!Array.isArray(messages)) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessageIndex = messages.findIndex(\n msg => msg && typeof msg === 'object' && 'role' in msg && (msg as { role: string }).role === 'system',\n );\n\n if (systemMessageIndex === -1) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemMessage = messages[systemMessageIndex] as { role: string; content?: string | unknown };\n const systemContent =\n typeof systemMessage.content === 'string'\n ? systemMessage.content\n : systemMessage.content !== undefined\n ? JSON.stringify(systemMessage.content)\n : undefined;\n\n if (!systemContent) {\n return { systemInstructions: undefined, filteredMessages: messages };\n }\n\n const systemInstructions = JSON.stringify([{ type: 'text', content: systemContent }]);\n const filteredMessages = [...messages.slice(0, systemMessageIndex), ...messages.slice(systemMessageIndex + 1)];\n\n return { systemInstructions, filteredMessages };\n}\n\n/**\n * Creates a wrapped version of .withResponse() that replaces the data field\n * with the instrumented result while preserving metadata (response, request_id).\n */\nasync function createWithResponseWrapper<T>(\n originalWithResponse: Promise<unknown>,\n instrumentedPromise: Promise<T>,\n mechanismType: string,\n): Promise<unknown> {\n // Attach catch handler to originalWithResponse immediately to prevent unhandled rejection\n // If instrumentedPromise rejects first, we still need this handled\n const safeOriginalWithResponse = originalWithResponse.catch(error => {\n captureException(error, {\n mechanism: {\n handled: false,\n type: mechanismType,\n },\n });\n throw error;\n });\n\n const instrumentedResult = await instrumentedPromise;\n const originalWrapper = await safeOriginalWithResponse;\n\n // Combine instrumented result with original metadata\n if (originalWrapper && typeof originalWrapper === 'object' && 'data' in originalWrapper) {\n return {\n ...originalWrapper,\n data: instrumentedResult,\n };\n }\n return instrumentedResult;\n}\n\n/**\n * Wraps a promise-like object to preserve additional methods (like .withResponse())\n * that AI SDK clients (OpenAI, Anthropic) attach to their APIPromise return values.\n *\n * Standard Promise methods (.then, .catch, .finally) are routed to the instrumented\n * promise to preserve Sentry's span instrumentation, while custom SDK methods are\n * forwarded to the original promise to maintain the SDK's API surface.\n */\nexport function wrapPromiseWithMethods<R>(\n originalPromiseLike: Promise<R>,\n instrumentedPromise: Promise<R>,\n mechanismType: string,\n): Promise<R> {\n // If the original result is not thenable, return the instrumented promise\n if (!isThenable(originalPromiseLike)) {\n return instrumentedPromise;\n }\n\n // Create a proxy that forwards Promise methods to instrumentedPromise\n // and preserves additional methods from the original result\n return new Proxy(originalPromiseLike, {\n get(target: object, prop: string | symbol): unknown {\n // For standard Promise methods (.then, .catch, .finally, Symbol.toStringTag),\n // use instrumentedPromise to preserve Sentry instrumentation.\n // For custom methods (like .withResponse()), use the original target.\n const useInstrumentedPromise = prop in Promise.prototype || prop === Symbol.toStringTag;\n const source = useInstrumentedPromise ? instrumentedPromise : target;\n\n const value = Reflect.get(source, prop) as unknown;\n\n // Special handling for .withResponse() to preserve instrumentation\n // .withResponse() returns { data: T, response: Response, request_id: string }\n if (prop === 'withResponse' && typeof value === 'function') {\n return function wrappedWithResponse(this: unknown): unknown {\n const originalWithResponse = (value as (...args: unknown[]) => unknown).call(target);\n return createWithResponseWrapper(originalWithResponse, instrumentedPromise, mechanismType);\n };\n }\n\n return typeof value === 'function' ? value.bind(source) : value;\n },\n }) as Promise<R>;\n}\n"],"names":[],"mappings":";;;;;;;AAkDO,SAAS,0BAAwD,OAAA,EAA+C;AACrH,EAAA,MAAM,KAAA,GAAQ,SAAA,EAAU,EAAG,wBAAA,EAAyB,CAAE,KAAA;AACtD,EAAA,OAAO;AAAA,IACL,GAAG,OAAA;AAAA,IACH,YAAA,EAAc,OAAA,EAAS,YAAA,IAAgB,KAAA,EAAO,MAAA,IAAU,KAAA;AAAA,IACxD,aAAA,EAAe,OAAA,EAAS,aAAA,IAAiB,KAAA,EAAO,OAAA,IAAW;AAAA,GAC7D;AACF;AAUO,SAAS,uBAAuB,gBAAA,EAAgD;AACrF,EAAA,IAAI,qBAAqB,MAAA,EAAW;AAClC,IAAA,OAAO,gBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAAC,uBAAA,CAAwB,MAAM,KAAK,MAAA,CAAO,UAAA,GAAa,gBAAA,KAAqB,KAAA;AACtF;AAKO,SAAS,eAAA,CAAgB,aAAqB,IAAA,EAAsB;AACzE,EAAA,OAAO,WAAA,GAAc,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,GAAK,IAAA;AAClD;AAUO,SAAS,uBAAA,CACd,IAAA,EACA,YAAA,EACA,gBAAA,EACA,mBACA,kBAAA,EACM;AACN,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,IAAA,CAAK,aAAA,CAAc;AAAA,MACjB,CAAC,mCAAmC,GAAG;AAAA,KACxC,CA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AA;AAItC,MAAA,IAAI,IAAA,KAAS,cAAA,IAAkB,OAAO,KAAA,KAAU,UAAA,EAAY;AAC1D,QAAA,OAAO,SAAS,mBAAA,GAA4C;AAC1D,UAAA,MAAM,oBAAA,GAAwB,KAAA,CAA0C,IAAA,CAAK,MAAM,CAAA;AACnF,UAAA,OAAO,yBAAA,CAA0B,oBAAA,EAAsB,mBAAA,EAAqB,aAAa,CAAA;AAAA,QAC3F,CAAA;AAAA,MACF;AAEA,MAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH;;;;"} |
@@ -6,3 +6,3 @@ import { isBrowser } from '../../utils/isBrowser.js'; | ||
| function extractGenAiSpansFromEvent(event, client) { | ||
| if (event.type !== "transaction" || !event.spans?.length || !event.sdkProcessingMetadata?.hasGenAiSpans || !client.getOptions().streamGenAiSpans || hasSpanStreamingEnabled(client)) { | ||
| if (event.type !== "transaction" || !event.spans?.length || !event.sdkProcessingMetadata?.hasGenAiSpans || client.getOptions().streamGenAiSpans === false || hasSpanStreamingEnabled(client)) { | ||
| return void 0; | ||
@@ -9,0 +9,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"extractGenAiSpans.js","sources":["../../../../src/tracing/spans/extractGenAiSpans.ts"],"sourcesContent":["import type { Client } from '../../client';\nimport type { SpanContainerItem } from '../../types/envelope';\nimport type { Event } from '../../types/event';\nimport { isBrowser } from '../../utils/isBrowser';\nimport { hasSpanStreamingEnabled } from './hasSpanStreamingEnabled';\nimport { spanJsonToSerializedStreamedSpan } from './spanJsonToStreamedSpan';\n\n/**\n * Extracts gen_ai spans from a transaction event, converts them to span v2 format,\n * and returns them as a SpanContainerItem.\n *\n * Only applies to static mode (non-streaming) transactions.\n *\n * WARNING: This function mutates `event.spans` by removing the extracted gen_ai spans\n * from the array. Call this before creating the event envelope so the transaction\n * item does not include the extracted spans.\n */\nexport function extractGenAiSpansFromEvent(event: Event, client: Client): SpanContainerItem | undefined {\n if (\n event.type !== 'transaction' ||\n !event.spans?.length ||\n !event.sdkProcessingMetadata?.hasGenAiSpans ||\n !client.getOptions().streamGenAiSpans ||\n hasSpanStreamingEnabled(client)\n ) {\n return undefined;\n }\n\n const genAiSpans = [];\n const remainingSpans = [];\n\n for (const span of event.spans) {\n if (span.op?.startsWith('gen_ai.')) {\n genAiSpans.push(spanJsonToSerializedStreamedSpan(span));\n } else {\n remainingSpans.push(span);\n }\n }\n\n if (genAiSpans.length === 0) {\n return undefined;\n }\n\n event.spans = remainingSpans;\n\n const inferSetting = client.getDataCollectionOptions().userInfo ? 'auto' : 'never';\n\n return [\n { type: 'span', item_count: genAiSpans.length, content_type: 'application/vnd.sentry.items.span.v2+json' },\n {\n version: 2,\n ...(isBrowser() && {\n ingest_settings: { infer_ip: inferSetting, infer_user_agent: inferSetting },\n }),\n items: genAiSpans,\n },\n ];\n}\n"],"names":[],"mappings":";;;;AAiBO,SAAS,0BAAA,CAA2B,OAAc,MAAA,EAA+C;AACtG,EAAA,IACE,MAAM,IAAA,KAAS,aAAA,IACf,CAAC,KAAA,CAAM,KAAA,EAAO,UACd,CAAC,KAAA,CAAM,qBAAA,EAAuB,aAAA,IAC9B,CAAC,MAAA,CAAO,UAAA,GAAa,gBAAA,IACrB,uBAAA,CAAwB,MAAM,CAAA,EAC9B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,aAAa,EAAC;AACpB,EAAA,MAAM,iBAAiB,EAAC;AAExB,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,IAAI,IAAA,CAAK,EAAA,EAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAClC,MAAA,UAAA,CAAW,IAAA,CAAK,gCAAA,CAAiC,IAAI,CAAC,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,cAAA,CAAe,KAAK,IAAI,CAAA;AAAA,IAC1B;AAAA,EACF;AAEA,EAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,KAAA,CAAM,KAAA,GAAQ,cAAA;AAEd,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAW,MAAA,GAAS,OAAA;AAE3E,EAAA,OAAO;AAAA,IACL,EAAE,IAAA,EAAM,MAAA,EAAQ,YAAY,UAAA,CAAW,MAAA,EAAQ,cAAc,2CAAA,EAA4C;AAAA,IACzG;AAAA,MACE,OAAA,EAAS,CAAA;AAAA,MACT,GAAI,WAAU,IAAK;AAAA,QACjB,eAAA,EAAiB,EAAE,QAAA,EAAU,YAAA,EAAc,kBAAkB,YAAA;AAAa,OAC5E;AAAA,MACA,KAAA,EAAO;AAAA;AACT,GACF;AACF;;;;"} | ||
| {"version":3,"file":"extractGenAiSpans.js","sources":["../../../../src/tracing/spans/extractGenAiSpans.ts"],"sourcesContent":["import type { Client } from '../../client';\nimport type { SpanContainerItem } from '../../types/envelope';\nimport type { Event } from '../../types/event';\nimport { isBrowser } from '../../utils/isBrowser';\nimport { hasSpanStreamingEnabled } from './hasSpanStreamingEnabled';\nimport { spanJsonToSerializedStreamedSpan } from './spanJsonToStreamedSpan';\n\n/**\n * Extracts gen_ai spans from a transaction event, converts them to span v2 format,\n * and returns them as a SpanContainerItem.\n *\n * Only applies to static mode (non-streaming) transactions.\n *\n * WARNING: This function mutates `event.spans` by removing the extracted gen_ai spans\n * from the array. Call this before creating the event envelope so the transaction\n * item does not include the extracted spans.\n */\nexport function extractGenAiSpansFromEvent(event: Event, client: Client): SpanContainerItem | undefined {\n if (\n event.type !== 'transaction' ||\n !event.spans?.length ||\n !event.sdkProcessingMetadata?.hasGenAiSpans ||\n client.getOptions().streamGenAiSpans === false ||\n hasSpanStreamingEnabled(client)\n ) {\n return undefined;\n }\n\n const genAiSpans = [];\n const remainingSpans = [];\n\n for (const span of event.spans) {\n if (span.op?.startsWith('gen_ai.')) {\n genAiSpans.push(spanJsonToSerializedStreamedSpan(span));\n } else {\n remainingSpans.push(span);\n }\n }\n\n if (genAiSpans.length === 0) {\n return undefined;\n }\n\n event.spans = remainingSpans;\n\n const inferSetting = client.getDataCollectionOptions().userInfo ? 'auto' : 'never';\n\n return [\n { type: 'span', item_count: genAiSpans.length, content_type: 'application/vnd.sentry.items.span.v2+json' },\n {\n version: 2,\n ...(isBrowser() && {\n ingest_settings: { infer_ip: inferSetting, infer_user_agent: inferSetting },\n }),\n items: genAiSpans,\n },\n ];\n}\n"],"names":[],"mappings":";;;;AAiBO,SAAS,0BAAA,CAA2B,OAAc,MAAA,EAA+C;AACtG,EAAA,IACE,MAAM,IAAA,KAAS,aAAA,IACf,CAAC,KAAA,CAAM,KAAA,EAAO,UACd,CAAC,KAAA,CAAM,qBAAA,EAAuB,aAAA,IAC9B,OAAO,UAAA,EAAW,CAAE,qBAAqB,KAAA,IACzC,uBAAA,CAAwB,MAAM,CAAA,EAC9B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,aAAa,EAAC;AACpB,EAAA,MAAM,iBAAiB,EAAC;AAExB,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,IAAI,IAAA,CAAK,EAAA,EAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAClC,MAAA,UAAA,CAAW,IAAA,CAAK,gCAAA,CAAiC,IAAI,CAAC,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,cAAA,CAAe,KAAK,IAAI,CAAA;AAAA,IAC1B;AAAA,EACF;AAEA,EAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,KAAA,CAAM,KAAA,GAAQ,cAAA;AAEd,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAW,MAAA,GAAS,OAAA;AAE3E,EAAA,OAAO;AAAA,IACL,EAAE,IAAA,EAAM,MAAA,EAAQ,YAAY,UAAA,CAAW,MAAA,EAAQ,cAAc,2CAAA,EAA4C;AAAA,IACzG;AAAA,MACE,OAAA,EAAS,CAAA;AAAA,MACT,GAAI,WAAU,IAAK;AAAA,QACjB,eAAA,EAAiB,EAAE,QAAA,EAAU,YAAA,EAAc,kBAAkB,YAAA;AAAa,OAC5E;AAAA,MACA,KAAA,EAAO;AAAA;AACT,GACF;AACF;;;;"} |
@@ -1,4 +0,4 @@ | ||
| const SDK_VERSION = "10.60.0" ; | ||
| const SDK_VERSION = "10.61.0" ; | ||
| export { SDK_VERSION }; | ||
| //# sourceMappingURL=version.js.map |
| import { Carrier } from './../carrier'; | ||
| import { AsyncContextStrategy } from './types'; | ||
| import { Scope } from './../scope'; | ||
| import { AsyncContextStrategy, TracingChannelBinding } from './types'; | ||
| /** | ||
@@ -14,2 +15,19 @@ * @private Private API with no semver guarantees! | ||
| export declare function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy; | ||
| /** | ||
| * Get the runtime binding needed to connect tracing channels to async context. | ||
| */ | ||
| export declare function getTracingChannelBinding(): TracingChannelBinding | undefined; | ||
| /** | ||
| * Build the default {@link TracingChannelBinding} shared by AsyncLocalStorage-based strategies. | ||
| * | ||
| * The ALS instance is supplied by the caller (kept as `unknown`). | ||
| * The binding clones the current scope, plants the span on it, and reuses the existing isolation scope. | ||
| * | ||
| * The OpenTelemetry strategy does not use this: its store value is an OTel context, not a | ||
| * `{ scope, isolationScope }` pair. | ||
| */ | ||
| export declare function _INTERNAL_createTracingChannelBinding(asyncLocalStorage: unknown, getScopes: () => { | ||
| scope: Scope; | ||
| isolationScope: Scope; | ||
| }): TracingChannelBinding; | ||
| //# sourceMappingURL=index.d.ts.map |
| import { Scope } from '../scope'; | ||
| import { Span } from '../types/span'; | ||
| import { getTraceData } from '../utils/traceData'; | ||
| import { continueTrace, startInactiveSpan, startNewTrace, startSpan, startSpanManual, suppressTracing, withActiveSpan } from './../tracing/trace'; | ||
| import { getActiveSpan } from './../utils/spanUtils'; | ||
| export interface TracingChannelBinding { | ||
| /** | ||
| * The ALS instance that will be bound to the channel. | ||
| */ | ||
| asyncLocalStorage: unknown; | ||
| /** | ||
| * Activates a span for the tracing channels nested invocations, the return value must be the same type as the `asyncLocalStorage` inner value. | ||
| */ | ||
| getStoreWithActiveSpan: (span: Span) => unknown; | ||
| } | ||
| /** | ||
@@ -57,3 +68,5 @@ * @private Private API with no semver guarantees! | ||
| startNewTrace?: typeof startNewTrace; | ||
| /** Get the runtime store required to bind tracing channels to an active span. */ | ||
| getTracingChannelBinding?: () => TracingChannelBinding | undefined; | ||
| } | ||
| //# sourceMappingURL=types.d.ts.map |
@@ -0,1 +1,2 @@ | ||
| import { AttributeObject, RawAttribute, RawAttributes } from './attributes'; | ||
| import { CaptureContext } from './scope'; | ||
@@ -71,2 +72,42 @@ import { CheckIn, MonitorConfig } from './types/checkin'; | ||
| /** | ||
| * Sets attributes on the isolation scope. | ||
| * | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param attributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * Sentry.setAttributes({ | ||
| * is_admin: true, | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: 150, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export declare function setAttributes<T extends Record<string, unknown>>(attributes: RawAttributes<T>): void; | ||
| /** | ||
| * Sets an attribute on the isolation scope. | ||
| * | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - The attribute value. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * Sentry.setAttribute('is_admin', true); | ||
| * Sentry.setAttribute('render_duration', 150); | ||
| * ``` | ||
| */ | ||
| export declare function setAttribute<T extends RawAttribute<T> extends { | ||
| value: any; | ||
| } | { | ||
| unit: any; | ||
| } ? AttributeObject : unknown>(key: string, value: RawAttribute<T>): void; | ||
| /** | ||
| * Updates user context information for future events. | ||
@@ -73,0 +114,0 @@ * |
@@ -186,11 +186,7 @@ import { AttributeObject, RawAttribute, RawAttributes } from './attributes'; | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or | ||
| * an object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param newAttributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
@@ -202,3 +198,3 @@ * @example | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: { value: 'render_duration', unit: 'ms' }, | ||
| * render_duration: 150, | ||
| * }); | ||
@@ -211,12 +207,8 @@ * ``` | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - the attribute value. You can either pass in a raw value, or an attribute | ||
| * object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param value - The attribute value. | ||
| * | ||
@@ -226,3 +218,3 @@ * @example | ||
| * scope.setAttribute('is_admin', true); | ||
| * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' }); | ||
| * scope.setAttribute('render_duration', 150); | ||
| * ``` | ||
@@ -229,0 +221,0 @@ */ |
@@ -14,3 +14,4 @@ export { ServerRuntimeClientOptions } from './server-runtime-client'; | ||
| export { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types'; | ||
| export { instrumentPostgresJsSql } from './integrations/postgresjs'; | ||
| export { instrumentPostgresJsSql, _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery } from './integrations/postgresjs'; | ||
| export { getSqlQuerySummary as _INTERNAL_getSqlQuerySummary } from './utils/sql'; | ||
| export { patchHttpModuleClient } from './integrations/http/client-patch'; | ||
@@ -17,0 +18,0 @@ export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions'; |
| export { ClientClass as SentryCoreCurrentScopes } from './sdk'; | ||
| export { AsyncContextStrategy } from './asyncContext/types'; | ||
| export { AsyncContextStrategy, TracingChannelBinding } from './asyncContext/types'; | ||
| export { Carrier } from './carrier'; | ||
@@ -9,6 +9,6 @@ export { OfflineStore, OfflineTransportOptions } from './transports/offline'; | ||
| export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope'; | ||
| export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
| export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
| export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, registerExternalPropagationContext, getExternalPropagationContext, hasExternalPropagationContext, } from './currentScopes'; | ||
| export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes'; | ||
| export { setAsyncContextStrategy } from './asyncContext'; | ||
| export { setAsyncContextStrategy, getTracingChannelBinding as _INTERNAL_getTracingChannelBinding, _INTERNAL_createTracingChannelBinding, } from './asyncContext'; | ||
| export { getGlobalSingleton, getMainCarrier } from './carrier'; | ||
@@ -60,2 +60,4 @@ export { makeSession, closeSession, updateSession } from './session'; | ||
| export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants'; | ||
| export { SPAN_KIND } from './spanKind'; | ||
| export { SpanKindValue } from './spanKind'; | ||
| export { addBreadcrumb } from './breadcrumbs'; | ||
@@ -62,0 +64,0 @@ export { functionToStringIntegration } from './integrations/functiontostring'; |
@@ -35,3 +35,3 @@ import { Span } from '../../types/span'; | ||
| * is not subject to the transaction payload-size limits that truncation works around, so the full | ||
| * message data can be retained. | ||
| * message data can be retained. `streamGenAiSpans` is opt-out (on unless explicitly set to `false`). | ||
| */ | ||
@@ -38,0 +38,0 @@ export declare function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean; |
@@ -513,3 +513,3 @@ import { CaptureContext } from '../scope'; | ||
| /** | ||
| * If set to `true`, gen_ai spans will be extracted from transactions and sent as v2 span envelope items. | ||
| * Unless set to `false`, gen_ai spans will be extracted from transactions and sent as v2 span envelope items. | ||
| * | ||
@@ -519,7 +519,7 @@ * This enables streaming gen_ai spans, avoiding payload size limits of usual transactions. | ||
| * Because the v2 span format is not subject to the transaction payload-size limits that gen_ai message | ||
| * truncation exists to work around, enabling this option also disables gen_ai input truncation (and the | ||
| * inline-media redaction that rides along with it) by default. Set `enableTruncation: true` on the | ||
| * respective AI integration to opt back into truncation. | ||
| * truncation exists to work around, this also disables gen_ai input truncation by default. Set | ||
| * `enableTruncation: true` on the respective AI integration to opt back into truncation, or set this | ||
| * option to `false` to send gen_ai spans as part of the transaction (which re-enables truncation by default). | ||
| * | ||
| * @default false | ||
| * @default true | ||
| */ | ||
@@ -526,0 +526,0 @@ streamGenAiSpans?: boolean; |
| import { Scope } from '../scope'; | ||
| import { SpanKindValue } from '../spanKind'; | ||
| import { SpanLink } from './link'; | ||
@@ -37,3 +38,3 @@ import { Span, SpanAttributes, SpanTimeInput } from './span'; | ||
| */ | ||
| kind?: 0 | 1 | 2 | 3 | 4; | ||
| kind?: SpanKindValue; | ||
| /** | ||
@@ -40,0 +41,0 @@ * If provided, make the new span a child of this span. |
| import type { Carrier } from './../carrier'; | ||
| import type { AsyncContextStrategy } from './types'; | ||
| import type { Scope } from './../scope'; | ||
| import type { AsyncContextStrategy, TracingChannelBinding } from './types'; | ||
| /** | ||
@@ -14,2 +15,19 @@ * @private Private API with no semver guarantees! | ||
| export declare function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy; | ||
| /** | ||
| * Get the runtime binding needed to connect tracing channels to async context. | ||
| */ | ||
| export declare function getTracingChannelBinding(): TracingChannelBinding | undefined; | ||
| /** | ||
| * Build the default {@link TracingChannelBinding} shared by AsyncLocalStorage-based strategies. | ||
| * | ||
| * The ALS instance is supplied by the caller (kept as `unknown`). | ||
| * The binding clones the current scope, plants the span on it, and reuses the existing isolation scope. | ||
| * | ||
| * The OpenTelemetry strategy does not use this: its store value is an OTel context, not a | ||
| * `{ scope, isolationScope }` pair. | ||
| */ | ||
| export declare function _INTERNAL_createTracingChannelBinding(asyncLocalStorage: unknown, getScopes: () => { | ||
| scope: Scope; | ||
| isolationScope: Scope; | ||
| }): TracingChannelBinding; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/asyncContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAKxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAS9E"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/asyncContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAKxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAS9E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,GAAG,SAAS,CAE5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,CACnD,iBAAiB,EAAE,OAAO,EAC1B,SAAS,EAAE,MAAM;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,cAAc,EAAE,KAAK,CAAA;CAAE,GACvD,qBAAqB,CAWvB"} |
| import type { Scope } from '../scope'; | ||
| import type { Span } from '../types/span'; | ||
| import type { getTraceData } from '../utils/traceData'; | ||
| import type { continueTrace, startInactiveSpan, startNewTrace, startSpan, startSpanManual, suppressTracing, withActiveSpan } from './../tracing/trace'; | ||
| import type { getActiveSpan } from './../utils/spanUtils'; | ||
| export interface TracingChannelBinding { | ||
| /** | ||
| * The ALS instance that will be bound to the channel. | ||
| */ | ||
| asyncLocalStorage: unknown; | ||
| /** | ||
| * Activates a span for the tracing channels nested invocations, the return value must be the same type as the `asyncLocalStorage` inner value. | ||
| */ | ||
| getStoreWithActiveSpan: (span: Span) => unknown; | ||
| } | ||
| /** | ||
@@ -57,3 +68,5 @@ * @private Private API with no semver guarantees! | ||
| startNewTrace?: typeof startNewTrace; | ||
| /** Get the runtime store required to bind tracing channels to an active span. */ | ||
| getTracingChannelBinding?: () => TracingChannelBinding | undefined; | ||
| } | ||
| //# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/asyncContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,kBAAkB,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAErE;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5D;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAEpE;;OAEG;IACH,qBAAqB,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/F;;OAEG;IACH,eAAe,EAAE,MAAM,KAAK,CAAC;IAE7B;;OAEG;IACH,iBAAiB,EAAE,MAAM,KAAK,CAAC;IAK/B,4BAA4B;IAC5B,SAA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C,CAAC;IAErE;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5D;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAEpE;;OAEG;IACH,qBAAqB,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/F;;OAEG;IACH,eAAe,EAAE,MAAM,KAAK,CAAC;IAE7B;;OAEG;IACH,iBAAiB,EAAE,MAAM,KAAK,CAAC;IAK/B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAE7B,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,OAAO,iBAAiB,CAAC;IAE7C,mCAAmC;IACnC,eAAe,CAAC,EAAE,OAAO,eAAe,CAAC;IAEzC,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;IAErC,kEAAkE;IAClE,cAAc,CAAC,EAAE,OAAO,cAAc,CAAC;IAEvC,6FAA6F;IAC7F,eAAe,CAAC,EAAE,OAAO,eAAe,CAAC;IAEzC,mGAAmG;IACnG,YAAY,CAAC,EAAE,OAAO,YAAY,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;IAErC,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;IAErC,iFAAiF;IACjF,wBAAwB,CAAC,EAAE,MAAM,qBAAqB,GAAG,SAAS,CAAC;CACpE"} |
@@ -0,1 +1,2 @@ | ||
| import type { AttributeObject, RawAttribute, RawAttributes } from './attributes'; | ||
| import type { CaptureContext } from './scope'; | ||
@@ -71,2 +72,42 @@ import type { CheckIn, MonitorConfig } from './types/checkin'; | ||
| /** | ||
| * Sets attributes on the isolation scope. | ||
| * | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param attributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * Sentry.setAttributes({ | ||
| * is_admin: true, | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: 150, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export declare function setAttributes<T extends Record<string, unknown>>(attributes: RawAttributes<T>): void; | ||
| /** | ||
| * Sets an attribute on the isolation scope. | ||
| * | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - The attribute value. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * Sentry.setAttribute('is_admin', true); | ||
| * Sentry.setAttribute('render_duration', 150); | ||
| * ``` | ||
| */ | ||
| export declare function setAttribute<T extends RawAttribute<T> extends { | ||
| value: any; | ||
| } | { | ||
| unit: any; | ||
| } ? AttributeObject : unknown>(key: string, value: RawAttribute<T>): void; | ||
| /** | ||
| * Updates user context information for future events. | ||
@@ -73,0 +114,0 @@ * |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,OAAO,KAAK,EAAE,OAAO,EAAmB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,KAA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GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,EACnC,QAAQ,EAAE,MAAM,CAAC,EACjB,mBAAmB,CAAC,EAAE,aAAa,GAClC,CAAC,CAmCH;AAED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9D;AAED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,2CAA2C;AAC3C,wBAAgB,SAAS,IAAI,OAAO,CAGnC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CA0B9D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAYjC;AAcD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,OAAe,GAAG,IAAI,CASzD"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server-subscription.d.ts","sourceRoot":"","sources":["../../../../src/integrations/http/server-subscription.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;AAEzE,OAAO,KAAK,EAAuB,0BAA0B,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;AA2B/G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;AAiBtF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CA2H9F;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,0BAA0B,GAAG,uBAAuB,CA+BvG;AA2KD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAa7D"} | ||
| {"version":3,"file":"server-subscription.d.ts","sourceRoot":"","sources":["../../../../src/integrations/http/server-subscription.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;AAEzE,OAAO,KAAK,EAAuB,0BAA0B,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;AA4B/G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;AAiBtF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CA2H9F;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,0BAA0B,GAAG,uBAAuB,CA+BvG;AA0KD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAa7D"} |
@@ -186,11 +186,7 @@ import type { AttributeObject, RawAttribute, RawAttributes } from './attributes'; | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param newAttributes - The attributes to set on the scope. You can either pass in key-value pairs, or | ||
| * an object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param newAttributes - The attributes to set on the scope, as key-value pairs. | ||
| * | ||
@@ -202,3 +198,3 @@ * @example | ||
| * payment_selection: 'credit_card', | ||
| * render_duration: { value: 'render_duration', unit: 'ms' }, | ||
| * render_duration: 150, | ||
| * }); | ||
@@ -211,12 +207,8 @@ * ``` | ||
| * | ||
| * These attributes are currently applied to logs and metrics. | ||
| * In the future, they will also be applied to spans. | ||
| * These attributes are applied to logs, metrics and streamed spans. | ||
| * | ||
| * Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for | ||
| * more complex attribute types. We'll add this support in the future but already specify the wider type to | ||
| * avoid a breaking change in the future. | ||
| * Supported attribute value types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. | ||
| * | ||
| * @param key - The attribute key. | ||
| * @param value - the attribute value. You can either pass in a raw value, or an attribute | ||
| * object with a `value` and an optional `unit` (if applicable to your attribute). | ||
| * @param value - The attribute value. | ||
| * | ||
@@ -226,3 +218,3 @@ * @example | ||
| * scope.setAttribute('is_admin', true); | ||
| * scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' }); | ||
| * scope.setAttribute('render_duration', 150); | ||
| * ``` | ||
@@ -229,0 +221,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/scope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;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@@ /** | ||
| export type { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types'; | ||
| export { instrumentPostgresJsSql } from './integrations/postgresjs'; | ||
| export { instrumentPostgresJsSql, _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery } from './integrations/postgresjs'; | ||
| export { getSqlQuerySummary as _INTERNAL_getSqlQuerySummary } from './utils/sql'; | ||
| export { patchHttpModuleClient } from './integrations/http/client-patch'; | ||
@@ -22,0 +23,0 @@ export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"server-exports.d.ts","sourceRoot":"","sources":["../../src/server-exports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACjH,YAAY,EACV,yBAAyB,EACzB,qBAAqB,E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,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACjH,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACrH,OAAO,EAAE,kBAAkB,IAAI,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC/F,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"} |
@@ -5,3 +5,3 @@ /** | ||
| export type { ClientClass as SentryCoreCurrentScopes } from './sdk'; | ||
| export type { AsyncContextStrategy } from './asyncContext/types'; | ||
| export type { AsyncContextStrategy, TracingChannelBinding } from './asyncContext/types'; | ||
| export type { Carrier } from './carrier'; | ||
@@ -13,6 +13,6 @@ export type { OfflineStore, OfflineTransportOptions } from './transports/offline'; | ||
| export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope'; | ||
| export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
| export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
| export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, registerExternalPropagationContext, getExternalPropagationContext, hasExternalPropagationContext, } from './currentScopes'; | ||
| export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes'; | ||
| export { setAsyncContextStrategy } from './asyncContext'; | ||
| export { setAsyncContextStrategy, getTracingChannelBinding as _INTERNAL_getTracingChannelBinding, _INTERNAL_createTracingChannelBinding, } from './asyncContext'; | ||
| export { getGlobalSingleton, getMainCarrier } from './carrier'; | ||
@@ -64,2 +64,4 @@ export { makeSession, closeSession, updateSession } from './session'; | ||
| export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants'; | ||
| export { SPAN_KIND } from './spanKind'; | ||
| export type { SpanKindValue } from './spanKind'; | ||
| export { addBreadcrumb } from './breadcrumbs'; | ||
@@ -66,0 +68,0 @@ export { functionToStringIntegration } from './integrations/functiontostring'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"shared-exports.d.ts","sourceRoot":"","sources":["../../src/shared-exports.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,OAAO,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,OAAO,E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oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5E,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,6BAA6B,EAC7B,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrH,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5F,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACrF,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,2CAA2C,CAAC;AACnD,YAAY,EAAE,uBAAuB,IAAI,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAC9G,OAAO,EACL,qBAAqB,IAAI,+BAA+B,EACxD,cAAc,IAAI,wBAAwB,EAC1C,WAAW,IAAI,qBAAqB,GACrC,MAAM,2BAA2B,CAAC"} |
@@ -35,3 +35,3 @@ import type { Span } from '../../types/span'; | ||
| * is not subject to the transaction payload-size limits that truncation works around, so the full | ||
| * message data can be retained. | ||
| * message data can be retained. `streamGenAiSpans` is opt-out (on unless explicitly set to `false`). | ||
| */ | ||
@@ -38,0 +38,0 @@ export declare function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean; |
@@ -513,3 +513,3 @@ import type { CaptureContext } from '../scope'; | ||
| /** | ||
| * If set to `true`, gen_ai spans will be extracted from transactions and sent as v2 span envelope items. | ||
| * Unless set to `false`, gen_ai spans will be extracted from transactions and sent as v2 span envelope items. | ||
| * | ||
@@ -519,7 +519,7 @@ * This enables streaming gen_ai spans, avoiding payload size limits of usual transactions. | ||
| * Because the v2 span format is not subject to the transaction payload-size limits that gen_ai message | ||
| * truncation exists to work around, enabling this option also disables gen_ai input truncation (and the | ||
| * inline-media redaction that rides along with it) by default. Set `enableTruncation: true` on the | ||
| * respective AI integration to opt back into truncation. | ||
| * truncation exists to work around, this also disables gen_ai input truncation by default. Set | ||
| * `enableTruncation: true` on the respective AI integration to opt back into truncation, or set this | ||
| * option to `false` to send gen_ai spans as part of the transaction (which re-enables truncation by default). | ||
| * | ||
| * @default false | ||
| * @default true | ||
| */ | ||
@@ -526,0 +526,0 @@ streamGenAiSpans?: boolean; |
| import type { Scope } from '../scope'; | ||
| import type { SpanKindValue } from '../spanKind'; | ||
| import type { SpanLink } from './link'; | ||
@@ -37,3 +38,3 @@ import type { Span, SpanAttributes, SpanTimeInput } from './span'; | ||
| */ | ||
| kind?: 0 | 1 | 2 | 3 | 4; | ||
| kind?: SpanKindValue; | ||
| /** | ||
@@ -40,0 +41,0 @@ * If provided, make the new span a child of this span. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"startSpanOptions.d.ts","sourceRoot":"","sources":["../../../src/types/startSpanOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B;;;;;;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AE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE;QACb;;;;;;;;;;WAUG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACH"} |
+1
-1
| { | ||
| "name": "@sentry/core", | ||
| "version": "10.60.0", | ||
| "version": "10.61.0", | ||
| "description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
6617937
0.73%1818
0.78%67649
0.71%