@sentry/node 9.27.0 → 9.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/integrations/anr/index.js +1 -1
- package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/build/cjs/integrations/tracing/vercelai/{attributes.js → ai_sdk_attributes.js} +35 -1
- package/build/cjs/integrations/tracing/vercelai/ai_sdk_attributes.js.map +1 -0
- package/build/cjs/integrations/tracing/vercelai/index.js +110 -91
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/integrations/anr/index.js +1 -1
- package/build/esm/integrations/anr/worker-script.js +2 -2
- package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/build/esm/integrations/local-variables/worker-script.js +2 -2
- package/build/esm/integrations/tracing/vercelai/{attributes.js → ai_sdk_attributes.js} +33 -2
- package/build/esm/integrations/tracing/vercelai/ai_sdk_attributes.js.map +1 -0
- package/build/esm/integrations/tracing/vercelai/index.js +92 -73
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/integrations/tracing/vercelai/{attributes.d.ts → ai_sdk_attributes.d.ts} +1 -1
- package/build/types/integrations/tracing/vercelai/ai_sdk_attributes.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/{attributes.d.ts → ai_sdk_attributes.d.ts} +1 -1
- package/package.json +3 -3
- package/build/cjs/integrations/tracing/vercelai/attributes.js.map +0 -1
- package/build/esm/integrations/tracing/vercelai/attributes.js.map +0 -1
- package/build/types/integrations/tracing/vercelai/attributes.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @sentry/node 9.
|
|
2
|
-
import{Session as t}from"node:inspector";import{workerData as n,parentPort as e}from"node:worker_threads";import{posix as r,sep as o}from"node:path";import*as s from"node:http";import*as i from"node:https";import{Readable as c}from"node:stream";import{createGzip as u}from"node:zlib";import*as a from"node:net";import*as f from"node:tls";const h="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,p="9.27.0",l=globalThis;function d(){return m(l),l}function m(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||p,n[p]=n[p]||{}}function g(t,n,e=l){const r=e.__SENTRY__=e.__SENTRY__||{},o=r[p]=r[p]||{};return o[t]||(o[t]=n())}const y=Object.prototype.toString;function b(t,n){return y.call(t)===`[object ${n}]`}function _(t){return b(t,"String")}function v(t){return b(t,"Object")}function w(t){return Boolean(t?.then&&"function"==typeof t.then)}function S(t,n){try{return t instanceof n}catch(t){return!1}}const $=l,E=80;function x(t,n){const e=t,r=[];if(!e?.tagName)return"";if($.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}r.push(e.tagName.toLowerCase());const o=n?.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(o?.length)o.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{e.id&&r.push(`#${e.id}`);const t=e.className;if(t&&_(t)){const n=t.split(/\s+/);for(const t of n)r.push(`.${t}`)}}const s=["aria-label","type","name","title","alt"];for(const t of s){const n=e.getAttribute(t);n&&r.push(`[${t}="${n}"]`)}return r.join("")}const N=["debug","info","warn","error","log","assert","trace"],C={};function T(t){if(!("console"in l))return t();const n=l.console,e={},r=Object.keys(C);r.forEach((t=>{const r=C[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const k=g("logger",(function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return h?N.forEach((e=>{n[e]=(...n)=>{t&&T((()=>{l.console[e](`Sentry Logger [${e}]:`,...n)}))}})):N.forEach((t=>{n[t]=()=>{}})),n}));function j(t,n=0){return"string"!=typeof t||0===n||t.length<=n?t:`${t.slice(0,n)}...`}function R(t){if(function(t){switch(y.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return S(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...O(t)};if(n=t,"undefined"!=typeof Event&&S(n,Event)){const n={type:t.type,target:I(t.target),currentTarget:I(t.currentTarget),...O(t)};return"undefined"!=typeof CustomEvent&&S(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function I(t){try{return n=t,"undefined"!=typeof Element&&S(n,Element)?function(t,n={}){if(!t)return"<unknown>";try{let e=t;const r=5,o=[];let s=0,i=0;const c=" > ",u=c.length;let a;const f=Array.isArray(n)?n:n.keyAttrs,h=!Array.isArray(n)&&n.maxStringLength||E;for(;e&&s++<r&&(a=x(e,f),!("html"===a||s>1&&i+o.length*u+a.length>=h));)o.push(a),i+=a.length,e=e.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var n}function O(t){if("object"==typeof t&&null!==t){const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}function D(t=function(){const t=l;return t.crypto||t.msCrypto}()){let n=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(n=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}const A=1e3;function P(){return Date.now()/A}const U=function(){const{performance:t}=l;if(!t?.now)return P;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/A}();function M(t){const n=U(),e={sid:D(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(e)};return t&&L(e,t),e}function L(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||U(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:D()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function B(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=B(r[t],n[t],e-1));return r}const G="_sentrySpan";function J(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){h&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,G,n):delete t[G]}function z(t){return t[G]}function H(){return D()}function F(){return D().substring(16)}class W{constructor(){this.t=!1,this.o=[],this.i=[],this.u=[],this.h=[],this.p={},this.l={},this.m={},this._={},this.v={},this.S={traceId:H(),sampleRand:Math.random()}}clone(){const t=new W;return t.u=[...this.u],t.l={...this.l},t.m={...this.m},t._={...this._},this._.flags&&(t._.flags={values:[...this._.flags.values]}),t.p=this.p,t.N=this.N,t.C=this.C,t.T=this.T,t.k=this.k,t.i=[...this.i],t.h=[...this.h],t.v={...this.v},t.S={...this.S},t.j=this.j,t.R=this.R,J(t,z(this)),t}setClient(t){this.j=t}setLastEventId(t){this.R=t}getClient(){return this.j}lastEventId(){return this.R}addScopeListener(t){this.o.push(t)}addEventProcessor(t){return this.i.push(t),this}setUser(t){return this.p=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.C&&L(this.C,{user:t}),this.I(),this}getUser(){return this.p}setTags(t){return this.l={...this.l,...t},this.I(),this}setTag(t,n){return this.l={...this.l,[t]:n},this.I(),this}setExtras(t){return this.m={...this.m,...t},this.I(),this}setExtra(t,n){return this.m={...this.m,[t]:n},this.I(),this}setFingerprint(t){return this.k=t,this.I(),this}setLevel(t){return this.N=t,this.I(),this}setTransactionName(t){return this.T=t,this.I(),this}setContext(t,n){return null===n?delete this._[t]:this._[t]=n,this.I(),this}setSession(t){return t?this.C=t:delete this.C,this.I(),this}getSession(){return this.C}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,e=n instanceof W?n.getScopeData():v(n)?t:void 0,{tags:r,extra:o,user:s,contexts:i,level:c,fingerprint:u=[],propagationContext:a}=e||{};return this.l={...this.l,...r},this.m={...this.m,...o},this._={...this._,...i},s&&Object.keys(s).length&&(this.p=s),c&&(this.N=c),u.length&&(this.k=u),a&&(this.S=a),this}clear(){return this.u=[],this.l={},this.m={},this.p={},this._={},this.N=void 0,this.T=void 0,this.k=void 0,this.C=void 0,J(this,void 0),this.h=[],this.setPropagationContext({traceId:H(),sampleRand:Math.random()}),this.I(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:P(),...t,message:t.message?j(t.message,2048):t.message};return this.u.push(r),this.u.length>e&&(this.u=this.u.slice(-e),this.j?.recordDroppedEvent("buffer_overflow","log_item")),this.I(),this}getLastBreadcrumb(){return this.u[this.u.length-1]}clearBreadcrumbs(){return this.u=[],this.I(),this}addAttachment(t){return this.h.push(t),this}clearAttachments(){return this.h=[],this}getScopeData(){return{breadcrumbs:this.u,attachments:this.h,contexts:this._,tags:this.l,extra:this.m,user:this.p,level:this.N,fingerprint:this.k||[],eventProcessors:this.i,propagationContext:this.S,sdkProcessingMetadata:this.v,transactionName:this.T,span:z(this)}}setSDKProcessingMetadata(t){return this.v=B(this.v,t,2),this}setPropagationContext(t){return this.S=t,this}getPropagationContext(){return this.S}captureException(t,n){const e=n?.event_id||D();if(!this.j)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.j.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e?.event_id||D();if(!this.j)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.j.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n?.event_id||D();return this.j?(this.j.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}I(){this.t||(this.t=!0,this.o.forEach((t=>{t(this)})),this.t=!1)}}class Y{constructor(t,n){let e,r;e=t||new W,r=n||new W,this.O=[{scope:e}],this.D=r}withScope(t){const n=this.A();let e;try{e=t(n)}catch(t){throw this.P(),t}return w(e)?e.then((t=>(this.P(),t)),(t=>{throw this.P(),t})):(this.P(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.D}getStackTop(){return this.O[this.O.length-1]}A(){const t=this.getScope().clone();return this.O.push({client:this.getClient(),scope:t}),t}P(){return!(this.O.length<=1)&&!!this.O.pop()}}function K(){const t=m(d());return t.stack=t.stack||new Y(g("defaultCurrentScope",(()=>new W)),g("defaultIsolationScope",(()=>new W)))}function V(t){return K().withScope(t)}function Z(t,n){const e=K();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function q(t){return K().withScope((()=>t(K().getIsolationScope())))}function Q(t){const n=m(t);return n.acs?n.acs:{withIsolationScope:q,withScope:V,withSetScope:Z,withSetIsolationScope:(t,n)=>q(n),getCurrentScope:()=>K().getScope(),getIsolationScope:()=>K().getIsolationScope()}}function X(){return Q(d()).getCurrentScope().getClient()}const tt="sentry.source",nt="sentry.sample_rate",et="sentry.previous_trace_sample_rate",rt="sentry.op",ot="sentry.origin",st=0,it=1,ct="_sentryScope",ut="_sentryIsolationScope";function at(t){return{scope:t[ct],isolationScope:t[ut]}}const ft="sentry-",ht=/^sentry-/;function pt(t){const n=function(t){if(!t||!_(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=lt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return lt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(ht)){t[n.slice(ft.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function lt(t){return t.split(",").map((t=>t.split("=").map((t=>{try{return decodeURIComponent(t.trim())}catch{return}})))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}const dt=1;function mt(t){const{spanId:n,traceId:e,isRemote:r}=t.spanContext(),o=r?n:_t(t).parent_span_id,s=at(t).scope;return{parent_span_id:o,span_id:r?s?.getPropagationContext().propagationSpanId||F():n,trace_id:e}}function gt(t){return t&&t.length>0?t.map((({context:{spanId:t,traceId:n,traceFlags:e,...r},attributes:o})=>({span_id:t,trace_id:n,sampled:e===dt,attributes:o,...r}))):void 0}function yt(t){return"number"==typeof t?bt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?bt(t.getTime()):U()}function bt(t){return t>9999999999?t/1e3:t}function _t(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:n,traceId:e}=t.spanContext();if(function(t){const n=t;return!!(n.attributes&&n.startTime&&n.name&&n.endTime&&n.status)}(t)){const{attributes:r,startTime:o,name:s,endTime:i,status:c,links:u}=t;return{span_id:n,trace_id:e,data:r,description:s,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:yt(o),timestamp:yt(i)||void 0,status:vt(c),op:r[rt],origin:r[ot],links:gt(u)}}return{span_id:n,trace_id:e,start_timestamp:0,data:{}}}function vt(t){if(t&&t.code!==st)return t.code===it?"ok":t.message||"unknown_error"}const wt="_sentryRootSpan";function St(t){return t[wt]||t}const $t=50,Et="?",xt=/captureMessage|captureException/;function Nt(t){return t[t.length-1]||{}}const Ct="<anonymous>";const Tt="production",kt=/^o(\d+)\./;function jt(t,n=!1){const{host:e,path:r,pass:o,port:s,projectId:i,protocol:c,publicKey:u}=t;return`${c}://${u}${n&&o?`:${o}`:""}@${e}${s?`:${s}`:""}/${r?`${r}/`:r}${i}`}const Rt="_frozenDsc";function It(t,n){const e=n.getOptions(),{publicKey:r,host:o}=n.getDsn()||{};let s;e.orgId?s=String(e.orgId):o&&(s=function(t){const n=t.match(kt);return n?.[1]}(o));const i={environment:e.environment||Tt,release:e.release,public_key:r,trace_id:t,org_id:s};return n.emit("createDsc",i),i}function Ot(t){const n=X();if(!n)return{};const e=St(t),r=_t(e),o=r.data,s=e.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[nt]??o[et];function c(t){return"number"!=typeof i&&"string"!=typeof i||(t.sample_rate=`${i}`),t}const u=e[Rt];if(u)return c(u);const a=s?.get("sentry.dsc"),f=a&&pt(a);if(f)return c(f);const h=It(t.spanContext().traceId,n),p=o[tt],l=r.description;return"url"!==p&&l&&(h.transaction=l),function(t){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const n=t||X()?.getOptions();return!(!n||null==n.tracesSampleRate&&!n.tracesSampler)}()&&(h.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===dt}(e)),h.sample_rand=s?.get("sentry.sample_rand")??at(e).scope?.getPropagationContext().sampleRand.toString()),c(h),n.emit("createDsc",h,e),h}function Dt(t,n=100,e=1/0){try{return At("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function At(t,n,e=1/0,r=1/0,o=function(){const t=new WeakSet;function n(n){return!!t.has(n)||(t.add(n),!1)}function e(n){t.delete(n)}return[n,e]}()){const[s,i]=o;if(null==n||["boolean","string"].includes(typeof n)||"number"==typeof n&&Number.isFinite(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.U)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&n===global)return"[Global]";if("undefined"!=typeof window&&n===window)return"[Window]";if("undefined"!=typeof document&&n===document)return"[Document]";if("object"==typeof(e=n)&&null!==e&&(e.__isVue||e.M))return"[VueViewModel]";if(function(t){return v(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&!Number.isFinite(n))return`[${n}]`;if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||Ct}catch(t){return Ct}}(n)}]`;if("symbol"==typeof n)return`[${String(n)}]`;if("bigint"==typeof n)return`[BigInt: ${String(n)}]`;const r=function(t){const n=Object.getPrototypeOf(t);return n?.constructor?n.constructor.name:"null prototype"}(n);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var e}(t,n);if(!c.startsWith("[object "))return c;if(n.__sentry_skip_normalization__)return n;const u="number"==typeof n.__sentry_override_normalization_depth__?n.__sentry_override_normalization_depth__:e;if(0===u)return c.replace("object ","");if(s(n))return"[Circular ~]";const a=n;if(a&&"function"==typeof a.toJSON)try{return At("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=R(n);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const n=p[t];f[t]=At(t,n,u-1,r,o),h++}return i(n),f}function Pt(t,n){const e=n.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${e}/*`,"ig"),"app:///")}function Ut(t,n=[]){return[t,n]}function Mt(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function Lt(t){const n=m(l);return n.encodePolyfill?n.encodePolyfill(t):(new TextEncoder).encode(t)}function Bt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[Lt(r),t]:r.push("string"==typeof t?Lt(t):t)}for(const t of e){const[n,e]=t;if(o(`\n${JSON.stringify(n)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch(n){t=JSON.stringify(Dt(e))}o(t)}}return"string"==typeof r?r:function(t){const n=t.reduce(((t,n)=>t+n.length),0),e=new Uint8Array(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r)}const Gt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Jt(t){if(!t?.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function zt(t,n,e,r){const o=Jt(e),s=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,n){n&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||n.name,t.sdk.version=t.sdk.version||n.version,t.sdk.integrations=[...t.sdk.integrations||[],...n.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...n.packages||[]])}(t,e?.sdk);const i=function(t,n,e,r){const o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:jt(r)},...o&&{trace:o}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Ut(i,[[{type:s},t]])}const Ht="__SENTRY_SUPPRESS_TRACING__";function Ft(t){const n=Q(d());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=Q(d());if(2===t.length){const[e,r]=t;return e?n.withSetScope(e,r):n.withScope(r)}return n.withScope(t[0])}((n=>(n.setSDKProcessingMetadata({[Ht]:!0}),t())))}var Wt;function Yt(t){return new Kt((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(Wt||(Wt={}));class Kt{constructor(t){this.L=Wt.PENDING,this.B=[],this.G(t)}then(t,n){return new Kt(((e,r)=>{this.B.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.J()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Kt(((n,e)=>{let r,o;return this.then((n=>{o=!1,r=n,t&&t()}),(n=>{o=!0,r=n,t&&t()})).then((()=>{o?e(r):n(r)}))}))}J(){if(this.L===Wt.PENDING)return;const t=this.B.slice();this.B=[],t.forEach((t=>{t[0]||(this.L===Wt.RESOLVED&&t[1](this.H),this.L===Wt.REJECTED&&t[2](this.H),t[0]=!0)}))}G(t){const n=(t,n)=>{this.L===Wt.PENDING&&(w(n)?n.then(e,r):(this.L=t,this.H=n,this.J()))},e=t=>{n(Wt.RESOLVED,t)},r=t=>{n(Wt.REJECTED,t)};try{t(e,r)}catch(t){r(t)}}}function Vt(t,n){const{fingerprint:e,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=n;!function(t,n){const{extra:e,tags:r,user:o,contexts:s,level:i,transactionName:c}=n;Object.keys(e).length&&(t.extra={...e,...t.extra});Object.keys(r).length&&(t.tags={...r,...t.tags});Object.keys(o).length&&(t.user={...o,...t.user});Object.keys(s).length&&(t.contexts={...s,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:mt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ot(n),...t.sdkProcessingMetadata};const e=St(n),r=_t(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint.length||delete t.fingerprint}(t,e),function(t,n){const e=[...t.breadcrumbs||[],...n];t.breadcrumbs=e.length?e:void 0}(t,o),function(t,n){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...n}}(t,s)}const Zt="7";const qt=Symbol.for("SentryBufferFullError");function Qt(t){const n=[];function e(t){return n.splice(n.indexOf(t),1)[0]||Promise.resolve(void 0)}return{$:n,add:function(r){if(!(void 0===t||n.length<t))return o=qt,new Kt(((t,n)=>{n(o)}));var o;const s=r();return-1===n.indexOf(s)&&n.push(s),s.then((()=>e(s))).then(null,(()=>e(s).then(null,(()=>{})))),s},drain:function(t){return new Kt(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{Yt(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}const Xt=6e4;function tn(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},s=e?.["x-sentry-rate-limits"],i=e?.["retry-after"];if(s)for(const t of s.trim().split(",")){const[n,e,,,s]=t.split(":",5),i=parseInt(n,10),c=1e3*(isNaN(i)?60:i);if(e)for(const t of e.split(";"))"metric_bucket"===t&&s&&!s.split(";").includes("custom")||(o[t]=r+c);else o.all=r+c}else i?o.all=r+function(t,n=Date.now()){const e=parseInt(`${t}`,10);if(!isNaN(e))return 1e3*e;const r=Date.parse(`${t}`);return isNaN(r)?Xt:r-n}(i,r):429===n&&(o.all=r+6e4);return o}const nn=64;function en(t,n,e=Qt(t.bufferSize||nn)){let r={};return{send:function(t){const o=[];if(Mt(t,((t,n)=>{const e=function(t){return Gt[t]}(n);(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e})(r,e)||o.push(t)})),0===o.length)return Yt({});const s=Ut(t[0],o),i=t=>{Mt(s,((t,n)=>{}))};return e.add((()=>n({body:Bt(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&h&&k.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=tn(r,t),t)),(t=>{throw i(),h&&k.error("Encountered error running transport request:",t),t})))).then((t=>t),(t=>{if(t===qt)return h&&k.error("Skipped sending event because buffer is full."),i(),Yt({});throw t}))},flush:t=>e.drain(t)}}const rn=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function on(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=rn.exec(n);return e?e.slice(1):[]}(t),e=n[0]||"";let r=n[1];return e||r?(r&&(r=r.slice(0,r.length-1)),e+r):"."}function sn(t,n=!1){return!(n||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const cn=Symbol("AgentBaseInternalState");class un extends s.Agent{constructor(t){super(t),this[cn]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:n}=new Error;return"string"==typeof n&&n.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,n,e){const r={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof s.Agent)return o.addRequest(t,r);this[cn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[cn].currentSocket;if(this[cn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[cn].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[cn]&&(this[cn].defaultPort=t)}get protocol(){return this[cn].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[cn]&&(this[cn].protocol=t)}}function an(...t){k.log("[https-proxy-agent:parse-proxy-response]",...t)}function fn(t){return new Promise(((n,e)=>{let r=0;const o=[];function s(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return an("have not received end of HTTP headers yet..."),void s();const f=u.subarray(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),e(new Error("No header received from proxy CONNECT response"));const p=h.split(" "),l=+(p[1]||0),d=p.slice(2).join(" "),m={};for(const n of f){if(!n)continue;const r=n.indexOf(":");if(-1===r)return t.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${n}"`));const o=n.slice(0,r).toLowerCase(),s=n.slice(r+1).trimStart(),i=m[o];"string"==typeof i?m[o]=[i,s]:Array.isArray(i)?i.push(s):m[o]=s}an("got proxy server response: %o %o",h,m),i(),n({connect:{statusCode:l,statusText:d,headers:m},buffered:u})}(c):t.once("readable",s)}function i(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",s)}function c(){i(),an("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),an("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),s()}))}function hn(...t){k.log("[https-proxy-agent]",...t)}class pn extends un{static __initStatic(){this.protocols=["http","https"]}constructor(t,n){super(n),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=n?.headers??{},hn("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const e=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),r=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?dn(n,"headers"):null,host:e,port:r}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){hn("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else hn("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},s=a.isIPv6(n.host)?`[${n.host}]`:n.host;let i=`CONNECT ${s}:${n.port} HTTP/1.1\r\n`;if(e.username||e.password){const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${s}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))i+=`${t}: ${o[t]}\r\n`;const c=fn(r);r.write(`${i}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",ln),n.secureEndpoint){hn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...dn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{hn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function ln(t){t.resume()}function dn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}pn.__initStatic();const mn=32768;function gn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const yn=n;let bn,_n=0,vn={};function wn(t){yn.debug&&console.log(`[ANR Worker] ${t}`)}var Sn,$n,En;const xn=function(t){let n;try{n=new URL(t.url)}catch(n){return T((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),en(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env,r=e?.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)));return r?void 0:n}(n,t.proxy||(e?process.env.https_proxy:void 0)||process.env.http_proxy),o=e?i:s,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new pn(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3}),h=function(t,n,e){const{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(f){return new Promise(((h,p)=>{Ft((()=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>mn&&(d["content-encoding"]="gzip",l=l.pipe(u()));const m=n.request({method:"POST",agent:e,headers:d,hostname:r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const n=t.headers["retry-after"]??null,e=t.headers["x-sentry-rate-limits"]??null;h({statusCode:t.statusCode,headers:{"retry-after":n,"x-sentry-rate-limits":Array.isArray(e)?e[0]||null:e}})}));m.on("error",p),l.pipe(m)}))}))}}(t,t.httpModule??o,f);return en(t,h)}({url:(Sn=yn.dsn,$n=yn.tunnel,En=yn.sdkMetadata.sdk,$n||`${function(t){return`${function(t){const n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(Sn)}?${function(t,n){const e={sentry_version:Zt};return t.publicKey&&(e.sentry_key=t.publicKey),n&&(e.sentry_client=`${n.name}/${n.version}`),new URLSearchParams(e).toString()}(Sn,En)}`)});async function Nn(){if(bn){wn("Sending abnormal session"),L(bn,{status:"abnormal",abnormal_mechanism:"anr_foreground",release:yn.release,environment:yn.environment});const t=function(t,n,e,r){const o=Jt(e);return Ut({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:jt(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(bn,yn.dsn,yn.sdkMetadata,yn.tunnel);wn(JSON.stringify(t)),await xn.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function Cn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(Nt(n).function||"")&&n.pop(),n.reverse(),xt.test(Nt(n).function||"")&&(n.pop(),xt.test(Nt(n).function||"")&&n.pop()),n.slice(0,$t).map((t=>({...t,filename:t.filename||Nt(n).filename,function:t.function||Et})))}(t);if(yn.appRootPath)for(const t of n)t.filename&&(t.filename=Pt(t.filename,yn.appRootPath));return n}async function Tn(t,n){if(_n>=yn.maxAnrEvents)return;_n+=1,await Nn(),wn("Sending event");const e={event_id:D(),contexts:yn.contexts,release:yn.release,environment:yn.environment,dist:yn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${yn.anrThreshold} ms`,stacktrace:{frames:Cn(t)},mechanism:{type:"ANR"}}]},tags:yn.staticTags};n&&function(t,n){if(Vt(t,n),!t.contexts?.trace){const{traceId:e,parentSpanId:r,propagationSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:o||F(),parent_span_id:r},...t.contexts}}}(e,n),function(t){if(0===Object.keys(vn).length)return;const n=yn.appRootPath?{}:vn;if(yn.appRootPath)for(const[t,e]of Object.entries(vn))n[Pt(t,yn.appRootPath)]=e;const e=new Map;for(const r of t.exception?.values||[])for(const t of r.stacktrace?.frames||[]){const r=t.abs_path||t.filename;r&&n[r]&&e.set(r,n[r])}if(e.size>0){const n=[];for(const[t,r]of e.entries())n.push({type:"sourcemap",code_file:t,debug_id:r});t.debug_meta={images:n}}}(e);const r=zt(e,yn.dsn,yn.sdkMetadata,yn.tunnel);wn(JSON.stringify(r)),await xn.send(r),await xn.flush(2e3),_n>=yn.maxAnrEvents&&setTimeout((()=>{process.exit(0)}),5e3)}let kn;if(wn("Started"),yn.captureStackTrace){wn("Connecting to debugger");const n=new t;n.connectToMainThread(),wn("Connected to debugger");const e=new Map;n.on("Debugger.scriptParsed",(t=>{e.set(t.params.scriptId,t.params.url)})),n.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{wn("Debugger paused");const s=[...t.params.callFrames],i=yn.appRootPath?function(t=(process.argv[1]?on(process.argv[1]):process.cwd()),n="\\"===o){const e=n?gn(t):t;return t=>{if(!t)return;const o=n?gn(t):t;let{dir:s,base:i,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(i=i.slice(0,-1*c.length));const u=decodeURIComponent(i);s||(s=".");const a=s.lastIndexOf("/node_modules");if(a>-1)return`${s.slice(a+14).replace(/\//g,".")}:${u}`;if(s.startsWith(e)){const t=s.slice(e.length+1).replace(/\//g,".");return t?`${t}:${u}`:u}return u}}(yn.appRootPath):()=>{},c=s.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return{filename:r,module:e(r),function:t.functionName||Et,colno:o,lineno:s,in_app:r?sn(r):void 0}}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Tn(c).then(null,(()=>{wn("Sending ANR event failed.")}))}),5e3);n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&wn(`Error executing script: '${t.message}'`),clearTimeout(u);const r=e?.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Tn(c,r).then(null,(()=>{wn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),kn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:jn}=function(t,n,e,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>n+e&&(s=!0,i&&r()),t<n+e&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),yn.pollInterval,yn.anrThreshold,(function(){wn("Watchdog timeout"),kn?(wn("Pausing debugger to capture stack trace"),kn()):(wn("Capturing event without a stack trace"),Tn().then(null,(()=>{wn("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(bn=M(t.session)),t.debugImages&&(vn=t.debugImages),jn()}));
|
|
1
|
+
/*! @sentry/node 9.28.1 (111db4a) | https://github.com/getsentry/sentry-javascript */
|
|
2
|
+
import{Session as t}from"node:inspector";import{workerData as n,parentPort as e}from"node:worker_threads";import{posix as r,sep as o}from"node:path";import*as s from"node:http";import*as i from"node:https";import{Readable as c}from"node:stream";import{createGzip as u}from"node:zlib";import*as a from"node:net";import*as f from"node:tls";const h="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,p="9.28.1",l=globalThis;function d(){return m(l),l}function m(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||p,n[p]=n[p]||{}}function g(t,n,e=l){const r=e.__SENTRY__=e.__SENTRY__||{},o=r[p]=r[p]||{};return o[t]||(o[t]=n())}const y=Object.prototype.toString;function b(t,n){return y.call(t)===`[object ${n}]`}function _(t){return b(t,"String")}function v(t){return b(t,"Object")}function w(t){return Boolean(t?.then&&"function"==typeof t.then)}function S(t,n){try{return t instanceof n}catch(t){return!1}}const $=l,E=80;function x(t,n){const e=t,r=[];if(!e?.tagName)return"";if($.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}r.push(e.tagName.toLowerCase());const o=n?.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(o?.length)o.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{e.id&&r.push(`#${e.id}`);const t=e.className;if(t&&_(t)){const n=t.split(/\s+/);for(const t of n)r.push(`.${t}`)}}const s=["aria-label","type","name","title","alt"];for(const t of s){const n=e.getAttribute(t);n&&r.push(`[${t}="${n}"]`)}return r.join("")}const N=["debug","info","warn","error","log","assert","trace"],C={};function T(t){if(!("console"in l))return t();const n=l.console,e={},r=Object.keys(C);r.forEach((t=>{const r=C[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const k=g("logger",(function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return h?N.forEach((e=>{n[e]=(...n)=>{t&&T((()=>{l.console[e](`Sentry Logger [${e}]:`,...n)}))}})):N.forEach((t=>{n[t]=()=>{}})),n}));function j(t,n=0){return"string"!=typeof t||0===n||t.length<=n?t:`${t.slice(0,n)}...`}function R(t){if(function(t){switch(y.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return S(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...O(t)};if(n=t,"undefined"!=typeof Event&&S(n,Event)){const n={type:t.type,target:I(t.target),currentTarget:I(t.currentTarget),...O(t)};return"undefined"!=typeof CustomEvent&&S(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function I(t){try{return n=t,"undefined"!=typeof Element&&S(n,Element)?function(t,n={}){if(!t)return"<unknown>";try{let e=t;const r=5,o=[];let s=0,i=0;const c=" > ",u=c.length;let a;const f=Array.isArray(n)?n:n.keyAttrs,h=!Array.isArray(n)&&n.maxStringLength||E;for(;e&&s++<r&&(a=x(e,f),!("html"===a||s>1&&i+o.length*u+a.length>=h));)o.push(a),i+=a.length,e=e.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var n}function O(t){if("object"==typeof t&&null!==t){const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}function D(t=function(){const t=l;return t.crypto||t.msCrypto}()){let n=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(n=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}const A=1e3;function P(){return Date.now()/A}const U=function(){const{performance:t}=l;if(!t?.now)return P;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/A}();function M(t){const n=U(),e={sid:D(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(e)};return t&&L(e,t),e}function L(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||U(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:D()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function B(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=B(r[t],n[t],e-1));return r}const G="_sentrySpan";function J(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){h&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,G,n):delete t[G]}function z(t){return t[G]}function H(){return D()}function F(){return D().substring(16)}class W{constructor(){this.t=!1,this.o=[],this.i=[],this.u=[],this.h=[],this.p={},this.l={},this.m={},this._={},this.v={},this.S={traceId:H(),sampleRand:Math.random()}}clone(){const t=new W;return t.u=[...this.u],t.l={...this.l},t.m={...this.m},t._={...this._},this._.flags&&(t._.flags={values:[...this._.flags.values]}),t.p=this.p,t.N=this.N,t.C=this.C,t.T=this.T,t.k=this.k,t.i=[...this.i],t.h=[...this.h],t.v={...this.v},t.S={...this.S},t.j=this.j,t.R=this.R,J(t,z(this)),t}setClient(t){this.j=t}setLastEventId(t){this.R=t}getClient(){return this.j}lastEventId(){return this.R}addScopeListener(t){this.o.push(t)}addEventProcessor(t){return this.i.push(t),this}setUser(t){return this.p=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.C&&L(this.C,{user:t}),this.I(),this}getUser(){return this.p}setTags(t){return this.l={...this.l,...t},this.I(),this}setTag(t,n){return this.l={...this.l,[t]:n},this.I(),this}setExtras(t){return this.m={...this.m,...t},this.I(),this}setExtra(t,n){return this.m={...this.m,[t]:n},this.I(),this}setFingerprint(t){return this.k=t,this.I(),this}setLevel(t){return this.N=t,this.I(),this}setTransactionName(t){return this.T=t,this.I(),this}setContext(t,n){return null===n?delete this._[t]:this._[t]=n,this.I(),this}setSession(t){return t?this.C=t:delete this.C,this.I(),this}getSession(){return this.C}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,e=n instanceof W?n.getScopeData():v(n)?t:void 0,{tags:r,extra:o,user:s,contexts:i,level:c,fingerprint:u=[],propagationContext:a}=e||{};return this.l={...this.l,...r},this.m={...this.m,...o},this._={...this._,...i},s&&Object.keys(s).length&&(this.p=s),c&&(this.N=c),u.length&&(this.k=u),a&&(this.S=a),this}clear(){return this.u=[],this.l={},this.m={},this.p={},this._={},this.N=void 0,this.T=void 0,this.k=void 0,this.C=void 0,J(this,void 0),this.h=[],this.setPropagationContext({traceId:H(),sampleRand:Math.random()}),this.I(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:P(),...t,message:t.message?j(t.message,2048):t.message};return this.u.push(r),this.u.length>e&&(this.u=this.u.slice(-e),this.j?.recordDroppedEvent("buffer_overflow","log_item")),this.I(),this}getLastBreadcrumb(){return this.u[this.u.length-1]}clearBreadcrumbs(){return this.u=[],this.I(),this}addAttachment(t){return this.h.push(t),this}clearAttachments(){return this.h=[],this}getScopeData(){return{breadcrumbs:this.u,attachments:this.h,contexts:this._,tags:this.l,extra:this.m,user:this.p,level:this.N,fingerprint:this.k||[],eventProcessors:this.i,propagationContext:this.S,sdkProcessingMetadata:this.v,transactionName:this.T,span:z(this)}}setSDKProcessingMetadata(t){return this.v=B(this.v,t,2),this}setPropagationContext(t){return this.S=t,this}getPropagationContext(){return this.S}captureException(t,n){const e=n?.event_id||D();if(!this.j)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.j.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e?.event_id||D();if(!this.j)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.j.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n?.event_id||D();return this.j?(this.j.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}I(){this.t||(this.t=!0,this.o.forEach((t=>{t(this)})),this.t=!1)}}class Y{constructor(t,n){let e,r;e=t||new W,r=n||new W,this.O=[{scope:e}],this.D=r}withScope(t){const n=this.A();let e;try{e=t(n)}catch(t){throw this.P(),t}return w(e)?e.then((t=>(this.P(),t)),(t=>{throw this.P(),t})):(this.P(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.D}getStackTop(){return this.O[this.O.length-1]}A(){const t=this.getScope().clone();return this.O.push({client:this.getClient(),scope:t}),t}P(){return!(this.O.length<=1)&&!!this.O.pop()}}function K(){const t=m(d());return t.stack=t.stack||new Y(g("defaultCurrentScope",(()=>new W)),g("defaultIsolationScope",(()=>new W)))}function V(t){return K().withScope(t)}function Z(t,n){const e=K();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function q(t){return K().withScope((()=>t(K().getIsolationScope())))}function Q(t){const n=m(t);return n.acs?n.acs:{withIsolationScope:q,withScope:V,withSetScope:Z,withSetIsolationScope:(t,n)=>q(n),getCurrentScope:()=>K().getScope(),getIsolationScope:()=>K().getIsolationScope()}}function X(){return Q(d()).getCurrentScope().getClient()}const tt="sentry.source",nt="sentry.sample_rate",et="sentry.previous_trace_sample_rate",rt="sentry.op",ot="sentry.origin",st=0,it=1,ct="_sentryScope",ut="_sentryIsolationScope";function at(t){return{scope:t[ct],isolationScope:t[ut]}}const ft="sentry-",ht=/^sentry-/;function pt(t){const n=function(t){if(!t||!_(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=lt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return lt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(ht)){t[n.slice(ft.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function lt(t){return t.split(",").map((t=>t.split("=").map((t=>{try{return decodeURIComponent(t.trim())}catch{return}})))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}const dt=1;function mt(t){const{spanId:n,traceId:e,isRemote:r}=t.spanContext(),o=r?n:_t(t).parent_span_id,s=at(t).scope;return{parent_span_id:o,span_id:r?s?.getPropagationContext().propagationSpanId||F():n,trace_id:e}}function gt(t){return t&&t.length>0?t.map((({context:{spanId:t,traceId:n,traceFlags:e,...r},attributes:o})=>({span_id:t,trace_id:n,sampled:e===dt,attributes:o,...r}))):void 0}function yt(t){return"number"==typeof t?bt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?bt(t.getTime()):U()}function bt(t){return t>9999999999?t/1e3:t}function _t(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:n,traceId:e}=t.spanContext();if(function(t){const n=t;return!!(n.attributes&&n.startTime&&n.name&&n.endTime&&n.status)}(t)){const{attributes:r,startTime:o,name:s,endTime:i,status:c,links:u}=t;return{span_id:n,trace_id:e,data:r,description:s,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:yt(o),timestamp:yt(i)||void 0,status:vt(c),op:r[rt],origin:r[ot],links:gt(u)}}return{span_id:n,trace_id:e,start_timestamp:0,data:{}}}function vt(t){if(t&&t.code!==st)return t.code===it?"ok":t.message||"unknown_error"}const wt="_sentryRootSpan";function St(t){return t[wt]||t}const $t=50,Et="?",xt=/captureMessage|captureException/;function Nt(t){return t[t.length-1]||{}}const Ct="<anonymous>";const Tt="production",kt=/^o(\d+)\./;function jt(t,n=!1){const{host:e,path:r,pass:o,port:s,projectId:i,protocol:c,publicKey:u}=t;return`${c}://${u}${n&&o?`:${o}`:""}@${e}${s?`:${s}`:""}/${r?`${r}/`:r}${i}`}const Rt="_frozenDsc";function It(t,n){const e=n.getOptions(),{publicKey:r,host:o}=n.getDsn()||{};let s;e.orgId?s=String(e.orgId):o&&(s=function(t){const n=t.match(kt);return n?.[1]}(o));const i={environment:e.environment||Tt,release:e.release,public_key:r,trace_id:t,org_id:s};return n.emit("createDsc",i),i}function Ot(t){const n=X();if(!n)return{};const e=St(t),r=_t(e),o=r.data,s=e.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[nt]??o[et];function c(t){return"number"!=typeof i&&"string"!=typeof i||(t.sample_rate=`${i}`),t}const u=e[Rt];if(u)return c(u);const a=s?.get("sentry.dsc"),f=a&&pt(a);if(f)return c(f);const h=It(t.spanContext().traceId,n),p=o[tt],l=r.description;return"url"!==p&&l&&(h.transaction=l),function(t){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const n=t||X()?.getOptions();return!(!n||null==n.tracesSampleRate&&!n.tracesSampler)}()&&(h.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===dt}(e)),h.sample_rand=s?.get("sentry.sample_rand")??at(e).scope?.getPropagationContext().sampleRand.toString()),c(h),n.emit("createDsc",h,e),h}function Dt(t,n=100,e=1/0){try{return At("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function At(t,n,e=1/0,r=1/0,o=function(){const t=new WeakSet;function n(n){return!!t.has(n)||(t.add(n),!1)}function e(n){t.delete(n)}return[n,e]}()){const[s,i]=o;if(null==n||["boolean","string"].includes(typeof n)||"number"==typeof n&&Number.isFinite(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.U)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&n===global)return"[Global]";if("undefined"!=typeof window&&n===window)return"[Window]";if("undefined"!=typeof document&&n===document)return"[Document]";if("object"==typeof(e=n)&&null!==e&&(e.__isVue||e.M))return"[VueViewModel]";if(function(t){return v(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&!Number.isFinite(n))return`[${n}]`;if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||Ct}catch(t){return Ct}}(n)}]`;if("symbol"==typeof n)return`[${String(n)}]`;if("bigint"==typeof n)return`[BigInt: ${String(n)}]`;const r=function(t){const n=Object.getPrototypeOf(t);return n?.constructor?n.constructor.name:"null prototype"}(n);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var e}(t,n);if(!c.startsWith("[object "))return c;if(n.__sentry_skip_normalization__)return n;const u="number"==typeof n.__sentry_override_normalization_depth__?n.__sentry_override_normalization_depth__:e;if(0===u)return c.replace("object ","");if(s(n))return"[Circular ~]";const a=n;if(a&&"function"==typeof a.toJSON)try{return At("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=R(n);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const n=p[t];f[t]=At(t,n,u-1,r,o),h++}return i(n),f}function Pt(t,n){const e=n.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${e}/*`,"ig"),"app:///")}function Ut(t,n=[]){return[t,n]}function Mt(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function Lt(t){const n=m(l);return n.encodePolyfill?n.encodePolyfill(t):(new TextEncoder).encode(t)}function Bt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[Lt(r),t]:r.push("string"==typeof t?Lt(t):t)}for(const t of e){const[n,e]=t;if(o(`\n${JSON.stringify(n)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch(n){t=JSON.stringify(Dt(e))}o(t)}}return"string"==typeof r?r:function(t){const n=t.reduce(((t,n)=>t+n.length),0),e=new Uint8Array(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r)}const Gt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Jt(t){if(!t?.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function zt(t,n,e,r){const o=Jt(e),s=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,n){n&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||n.name,t.sdk.version=t.sdk.version||n.version,t.sdk.integrations=[...t.sdk.integrations||[],...n.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...n.packages||[]])}(t,e?.sdk);const i=function(t,n,e,r){const o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:jt(r)},...o&&{trace:o}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Ut(i,[[{type:s},t]])}const Ht="__SENTRY_SUPPRESS_TRACING__";function Ft(t){const n=Q(d());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=Q(d());if(2===t.length){const[e,r]=t;return e?n.withSetScope(e,r):n.withScope(r)}return n.withScope(t[0])}((n=>(n.setSDKProcessingMetadata({[Ht]:!0}),t())))}var Wt;function Yt(t){return new Kt((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(Wt||(Wt={}));class Kt{constructor(t){this.L=Wt.PENDING,this.B=[],this.G(t)}then(t,n){return new Kt(((e,r)=>{this.B.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.J()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Kt(((n,e)=>{let r,o;return this.then((n=>{o=!1,r=n,t&&t()}),(n=>{o=!0,r=n,t&&t()})).then((()=>{o?e(r):n(r)}))}))}J(){if(this.L===Wt.PENDING)return;const t=this.B.slice();this.B=[],t.forEach((t=>{t[0]||(this.L===Wt.RESOLVED&&t[1](this.H),this.L===Wt.REJECTED&&t[2](this.H),t[0]=!0)}))}G(t){const n=(t,n)=>{this.L===Wt.PENDING&&(w(n)?n.then(e,r):(this.L=t,this.H=n,this.J()))},e=t=>{n(Wt.RESOLVED,t)},r=t=>{n(Wt.REJECTED,t)};try{t(e,r)}catch(t){r(t)}}}function Vt(t,n){const{fingerprint:e,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=n;!function(t,n){const{extra:e,tags:r,user:o,contexts:s,level:i,transactionName:c}=n;Object.keys(e).length&&(t.extra={...e,...t.extra});Object.keys(r).length&&(t.tags={...r,...t.tags});Object.keys(o).length&&(t.user={...o,...t.user});Object.keys(s).length&&(t.contexts={...s,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:mt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ot(n),...t.sdkProcessingMetadata};const e=St(n),r=_t(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint.length||delete t.fingerprint}(t,e),function(t,n){const e=[...t.breadcrumbs||[],...n];t.breadcrumbs=e.length?e:void 0}(t,o),function(t,n){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...n}}(t,s)}const Zt="7";const qt=Symbol.for("SentryBufferFullError");function Qt(t){const n=[];function e(t){return n.splice(n.indexOf(t),1)[0]||Promise.resolve(void 0)}return{$:n,add:function(r){if(!(void 0===t||n.length<t))return o=qt,new Kt(((t,n)=>{n(o)}));var o;const s=r();return-1===n.indexOf(s)&&n.push(s),s.then((()=>e(s))).then(null,(()=>e(s).then(null,(()=>{})))),s},drain:function(t){return new Kt(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{Yt(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}const Xt=6e4;function tn(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},s=e?.["x-sentry-rate-limits"],i=e?.["retry-after"];if(s)for(const t of s.trim().split(",")){const[n,e,,,s]=t.split(":",5),i=parseInt(n,10),c=1e3*(isNaN(i)?60:i);if(e)for(const t of e.split(";"))"metric_bucket"===t&&s&&!s.split(";").includes("custom")||(o[t]=r+c);else o.all=r+c}else i?o.all=r+function(t,n=Date.now()){const e=parseInt(`${t}`,10);if(!isNaN(e))return 1e3*e;const r=Date.parse(`${t}`);return isNaN(r)?Xt:r-n}(i,r):429===n&&(o.all=r+6e4);return o}const nn=64;function en(t,n,e=Qt(t.bufferSize||nn)){let r={};return{send:function(t){const o=[];if(Mt(t,((t,n)=>{const e=function(t){return Gt[t]}(n);(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e})(r,e)||o.push(t)})),0===o.length)return Yt({});const s=Ut(t[0],o),i=t=>{Mt(s,((t,n)=>{}))};return e.add((()=>n({body:Bt(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&h&&k.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=tn(r,t),t)),(t=>{throw i(),h&&k.error("Encountered error running transport request:",t),t})))).then((t=>t),(t=>{if(t===qt)return h&&k.error("Skipped sending event because buffer is full."),i(),Yt({});throw t}))},flush:t=>e.drain(t)}}const rn=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function on(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=rn.exec(n);return e?e.slice(1):[]}(t),e=n[0]||"";let r=n[1];return e||r?(r&&(r=r.slice(0,r.length-1)),e+r):"."}function sn(t,n=!1){return!(n||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const cn=Symbol("AgentBaseInternalState");class un extends s.Agent{constructor(t){super(t),this[cn]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:n}=new Error;return"string"==typeof n&&n.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,n,e){const r={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof s.Agent)return o.addRequest(t,r);this[cn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[cn].currentSocket;if(this[cn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[cn].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[cn]&&(this[cn].defaultPort=t)}get protocol(){return this[cn].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[cn]&&(this[cn].protocol=t)}}function an(...t){k.log("[https-proxy-agent:parse-proxy-response]",...t)}function fn(t){return new Promise(((n,e)=>{let r=0;const o=[];function s(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return an("have not received end of HTTP headers yet..."),void s();const f=u.subarray(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),e(new Error("No header received from proxy CONNECT response"));const p=h.split(" "),l=+(p[1]||0),d=p.slice(2).join(" "),m={};for(const n of f){if(!n)continue;const r=n.indexOf(":");if(-1===r)return t.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${n}"`));const o=n.slice(0,r).toLowerCase(),s=n.slice(r+1).trimStart(),i=m[o];"string"==typeof i?m[o]=[i,s]:Array.isArray(i)?i.push(s):m[o]=s}an("got proxy server response: %o %o",h,m),i(),n({connect:{statusCode:l,statusText:d,headers:m},buffered:u})}(c):t.once("readable",s)}function i(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",s)}function c(){i(),an("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),an("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),s()}))}function hn(...t){k.log("[https-proxy-agent]",...t)}class pn extends un{static __initStatic(){this.protocols=["http","https"]}constructor(t,n){super(n),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=n?.headers??{},hn("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const e=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),r=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?dn(n,"headers"):null,host:e,port:r}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){hn("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else hn("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},s=a.isIPv6(n.host)?`[${n.host}]`:n.host;let i=`CONNECT ${s}:${n.port} HTTP/1.1\r\n`;if(e.username||e.password){const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${s}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))i+=`${t}: ${o[t]}\r\n`;const c=fn(r);r.write(`${i}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",ln),n.secureEndpoint){hn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...dn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{hn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function ln(t){t.resume()}function dn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}pn.__initStatic();const mn=32768;function gn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const yn=n;let bn,_n=0,vn={};function wn(t){yn.debug&&console.log(`[ANR Worker] ${t}`)}var Sn,$n,En;const xn=function(t){let n;try{n=new URL(t.url)}catch(n){return T((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),en(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env,r=e?.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)));return r?void 0:n}(n,t.proxy||(e?process.env.https_proxy:void 0)||process.env.http_proxy),o=e?i:s,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new pn(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3}),h=function(t,n,e){const{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(f){return new Promise(((h,p)=>{Ft((()=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>mn&&(d["content-encoding"]="gzip",l=l.pipe(u()));const m=n.request({method:"POST",agent:e,headers:d,hostname:r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const n=t.headers["retry-after"]??null,e=t.headers["x-sentry-rate-limits"]??null;h({statusCode:t.statusCode,headers:{"retry-after":n,"x-sentry-rate-limits":Array.isArray(e)?e[0]||null:e}})}));m.on("error",p),l.pipe(m)}))}))}}(t,t.httpModule??o,f);return en(t,h)}({url:(Sn=yn.dsn,$n=yn.tunnel,En=yn.sdkMetadata.sdk,$n||`${function(t){return`${function(t){const n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(Sn)}?${function(t,n){const e={sentry_version:Zt};return t.publicKey&&(e.sentry_key=t.publicKey),n&&(e.sentry_client=`${n.name}/${n.version}`),new URLSearchParams(e).toString()}(Sn,En)}`)});async function Nn(){if(bn){wn("Sending abnormal session"),L(bn,{status:"abnormal",abnormal_mechanism:"anr_foreground",release:yn.release,environment:yn.environment});const t=function(t,n,e,r){const o=Jt(e);return Ut({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:jt(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(bn,yn.dsn,yn.sdkMetadata,yn.tunnel);wn(JSON.stringify(t)),await xn.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function Cn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(Nt(n).function||"")&&n.pop(),n.reverse(),xt.test(Nt(n).function||"")&&(n.pop(),xt.test(Nt(n).function||"")&&n.pop()),n.slice(0,$t).map((t=>({...t,filename:t.filename||Nt(n).filename,function:t.function||Et})))}(t);if(yn.appRootPath)for(const t of n)t.filename&&(t.filename=Pt(t.filename,yn.appRootPath));return n}async function Tn(t,n){if(_n>=yn.maxAnrEvents)return;_n+=1,await Nn(),wn("Sending event");const e={event_id:D(),contexts:yn.contexts,release:yn.release,environment:yn.environment,dist:yn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${yn.anrThreshold} ms`,stacktrace:{frames:Cn(t)},mechanism:{type:"ANR"}}]},tags:yn.staticTags};n&&function(t,n){if(Vt(t,n),!t.contexts?.trace){const{traceId:e,parentSpanId:r,propagationSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:o||F(),parent_span_id:r},...t.contexts}}}(e,n),function(t){if(0===Object.keys(vn).length)return;const n=yn.appRootPath?{}:vn;if(yn.appRootPath)for(const[t,e]of Object.entries(vn))n[Pt(t,yn.appRootPath)]=e;const e=new Map;for(const r of t.exception?.values||[])for(const t of r.stacktrace?.frames||[]){const r=t.abs_path||t.filename;r&&n[r]&&e.set(r,n[r])}if(e.size>0){const n=[];for(const[t,r]of e.entries())n.push({type:"sourcemap",code_file:t,debug_id:r});t.debug_meta={images:n}}}(e);const r=zt(e,yn.dsn,yn.sdkMetadata,yn.tunnel);wn(JSON.stringify(r)),await xn.send(r),await xn.flush(2e3),_n>=yn.maxAnrEvents&&setTimeout((()=>{process.exit(0)}),5e3)}let kn;if(wn("Started"),yn.captureStackTrace){wn("Connecting to debugger");const n=new t;n.connectToMainThread(),wn("Connected to debugger");const e=new Map;n.on("Debugger.scriptParsed",(t=>{e.set(t.params.scriptId,t.params.url)})),n.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{wn("Debugger paused");const s=[...t.params.callFrames],i=yn.appRootPath?function(t=(process.argv[1]?on(process.argv[1]):process.cwd()),n="\\"===o){const e=n?gn(t):t;return t=>{if(!t)return;const o=n?gn(t):t;let{dir:s,base:i,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(i=i.slice(0,-1*c.length));const u=decodeURIComponent(i);s||(s=".");const a=s.lastIndexOf("/node_modules");if(a>-1)return`${s.slice(a+14).replace(/\//g,".")}:${u}`;if(s.startsWith(e)){const t=s.slice(e.length+1).replace(/\//g,".");return t?`${t}:${u}`:u}return u}}(yn.appRootPath):()=>{},c=s.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return{filename:r,module:e(r),function:t.functionName||Et,colno:o,lineno:s,in_app:r?sn(r):void 0}}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Tn(c).then(null,(()=>{wn("Sending ANR event failed.")}))}),5e3);n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&wn(`Error executing script: '${t.message}'`),clearTimeout(u);const r=e?.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Tn(c,r).then(null,(()=>{wn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),kn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:jn}=function(t,n,e,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>n+e&&(s=!0,i&&r()),t<n+e&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),yn.pollInterval,yn.anrThreshold,(function(){wn("Watchdog timeout"),kn?(wn("Pausing debugger to capture stack trace"),kn()):(wn("Capturing event without a stack trace"),Tn().then(null,(()=>{wn("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(bn=M(t.session)),t.debugImages&&(vn=t.debugImages),jn()}));
|
|
@@ -4,7 +4,7 @@ import { isDebuggerEnabled } from '../../utils/debug.js';
|
|
|
4
4
|
import { LOCAL_VARIABLES_KEY, functionNamesMatch } from './common.js';
|
|
5
5
|
|
|
6
6
|
// This string is a placeholder that gets overwritten with the worker code.
|
|
7
|
-
const base64WorkerScript = '
|
|
7
|
+
const base64WorkerScript = 'LyohIEBzZW50cnkvbm9kZSA5LjI4LjEgKDExMWRiNGEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPSJ1bmRlZmluZWQiPT10eXBlb2YgX19TRU5UUllfREVCVUdfX3x8X19TRU5UUllfREVCVUdfXyxvPSI5LjI4LjEiLGk9Z2xvYmFsVGhpcztjb25zdCBhPVsiZGVidWciLCJpbmZvIiwid2FybiIsImVycm9yIiwibG9nIiwiYXNzZXJ0IiwidHJhY2UiXSxzPXt9O2Z1bmN0aW9uIGMoZSl7aWYoISgiY29uc29sZSJpbiBpKSlyZXR1cm4gZSgpO2NvbnN0IHQ9aS5jb25zb2xlLG49e30sbz1PYmplY3Qua2V5cyhzKTtvLmZvckVhY2goKGU9Pntjb25zdCBvPXNbZV07bltlXT10W2VdLHRbZV09b30pKTt0cnl7cmV0dXJuIGUoKX1maW5hbGx5e28uZm9yRWFjaCgoZT0+e3RbZV09bltlXX0pKX19IWZ1bmN0aW9uKGUsdCxuPWkpe2NvbnN0IGE9bi5fX1NFTlRSWV9fPW4uX19TRU5UUllfX3x8e30scz1hW29dPWFbb118fHt9O3NbZV18fChzW2VdPXQoKSl9KCJsb2dnZXIiLChmdW5jdGlvbigpe2xldCBlPSExO2NvbnN0IHQ9e2VuYWJsZTooKT0+e2U9ITB9LGRpc2FibGU6KCk9PntlPSExfSxpc0VuYWJsZWQ6KCk9PmV9O3JldHVybiBuP2EuZm9yRWFjaCgobj0+e3Rbbl09KC4uLnQpPT57ZSYmYygoKCk9PntpLmNvbnNvbGVbbl0oYFNlbnRyeSBMb2dnZXIgWyR7bn1dOmAsLi4udCl9KSl9fSkpOmEuZm9yRWFjaCgoZT0+e3RbZV09KCk9Pnt9fSkpLHR9KSk7Y29uc3Qgcj0iX19TRU5UUllfRVJST1JfTE9DQUxfVkFSSUFCTEVTX18iO2NvbnN0IHU9dDtmdW5jdGlvbiBsKC4uLmUpe3UuZGVidWcmJmMoKCgpPT5jb25zb2xlLmxvZygiW0xvY2FsVmFyaWFibGVzIFdvcmtlcl0iLC4uLmUpKSl9YXN5bmMgZnVuY3Rpb24gZihlLHQsbixvKXtjb25zdCBpPWF3YWl0IGUucG9zdCgiUnVudGltZS5nZXRQcm9wZXJ0aWVzIix7b2JqZWN0SWQ6dCxvd25Qcm9wZXJ0aWVzOiEwfSk7b1tuXT1pLnJlc3VsdC5maWx0ZXIoKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpKS5zb3J0KCgoZSx0KT0+cGFyc2VJbnQoZS5uYW1lLDEwKS1wYXJzZUludCh0Lm5hbWUsMTApKSkubWFwKChlPT5lLnZhbHVlPy52YWx1ZSkpfWFzeW5jIGZ1bmN0aW9uIGcoZSx0LG4sbyl7Y29uc3QgaT1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO29bbl09aS5yZXN1bHQubWFwKChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkpLnJlZHVjZSgoKGUsW3Qsbl0pPT4oZVt0XT1uLGUpKSx7fSl9ZnVuY3Rpb24gZChlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBiKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLG89e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGYoZSxuLHQubmFtZSxvKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgZyhlLG4sdC5uYW1lLG8pfWVsc2UgdC52YWx1ZSYmZCh0LG8pO3JldHVybiBvfWxldCBwOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCksbCgiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCgpPT57bj0hMX0pKSx0Lm9uKCJEZWJ1Z2dlci5wYXVzZWQiLChlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOm99KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKHA/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGk9W107Zm9yKGxldCB0PTA7dDxvLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6YSx0aGlzOnN9PW9bdF0sYz1uLmZpbmQoKGU9PiJsb2NhbCI9PT1lLnR5cGUpKSxyPSJnbG9iYWwiIT09cy5jbGFzc05hbWUmJnMuY2xhc3NOYW1lP2Ake3MuY2xhc3NOYW1lfS4ke2F9YDphO2lmKHZvaWQgMD09PWM/Lm9iamVjdC5vYmplY3RJZClpW3RdPXtmdW5jdGlvbjpyfTtlbHNle2NvbnN0IG49YXdhaXQgYihlLGMub2JqZWN0Lm9iamVjdElkKTtpW3RdPXtmdW5jdGlvbjpyLHZhcnM6bn19fWF3YWl0IGUucG9zdCgiUnVudGltZS5jYWxsRnVuY3Rpb25PbiIse2Z1bmN0aW9uRGVjbGFyYXRpb246YGZ1bmN0aW9uKCkgeyB0aGlzLiR7cn0gPSB0aGlzLiR7cn0gfHwgJHtKU09OLnN0cmluZ2lmeShpKX07IH1gLHNpbGVudDohMCxvYmplY3RJZDpufSksYXdhaXQgZS5wb3N0KCJSdW50aW1lLnJlbGVhc2VPYmplY3QiLHtvYmplY3RJZDpufSl9KHQsZS5wYXJhbXMpLnRoZW4oKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSksKGFzeW5jIGU9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSkpfSkpLGF3YWl0IHQucG9zdCgiRGVidWdnZXIuZW5hYmxlIik7Y29uc3Qgbz0hMSE9PXUuY2FwdHVyZUFsbEV4Y2VwdGlvbnM7aWYoYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOm8/ImFsbCI6InVuY2F1Z2h0In0pLG8pe2NvbnN0IGU9dS5tYXhFeGNlcHRpb25zUGVyU2Vjb25kfHw1MDtwPWZ1bmN0aW9uKGUsdCxuKXtsZXQgbz0wLGk9NSxhPTA7cmV0dXJuIHNldEludGVydmFsKCgoKT0+ezA9PT1hP28+ZSYmKGkqPTIsbihpKSxpPjg2NDAwJiYoaT04NjQwMCksYT1pKTooYS09MSwwPT09YSYmdCgpKSxvPTB9KSwxZTMpLnVucmVmKCksKCk9PntvKz0xfX0oZSwoYXN5bmMoKT0+e2woIlJhdGUtbGltaXQgbGlmdGVkLiIpLGF3YWl0IHQucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZToiYWxsIn0pfSksKGFzeW5jIGU9PntsKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pKX19KSgpLmNhdGNoKChlPT57bCgiRmFpbGVkIHRvIHN0YXJ0IGRlYnVnZ2VyIixlKX0pKSxzZXRJbnRlcnZhbCgoKCk9Pnt9KSwxZTQpOw==';
|
|
8
8
|
|
|
9
9
|
function log(...args) {
|
|
10
10
|
logger.log('[LocalVariables]', ...args);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @sentry/node 9.
|
|
2
|
-
import{Session as e}from"node:inspector/promises";import{workerData as t}from"node:worker_threads";const n="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,o="9.
|
|
1
|
+
/*! @sentry/node 9.28.1 (111db4a) | https://github.com/getsentry/sentry-javascript */
|
|
2
|
+
import{Session as e}from"node:inspector/promises";import{workerData as t}from"node:worker_threads";const n="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,o="9.28.1",i=globalThis;const a=["debug","info","warn","error","log","assert","trace"],s={};function c(e){if(!("console"in i))return e();const t=i.console,n={},o=Object.keys(s);o.forEach((e=>{const o=s[e];n[e]=t[e],t[e]=o}));try{return e()}finally{o.forEach((e=>{t[e]=n[e]}))}}!function(e,t,n=i){const a=n.__SENTRY__=n.__SENTRY__||{},s=a[o]=a[o]||{};s[e]||(s[e]=t())}("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return n?a.forEach((n=>{t[n]=(...t)=>{e&&c((()=>{i.console[n](`Sentry Logger [${n}]:`,...t)}))}})):a.forEach((e=>{t[e]=()=>{}})),t}));const r="__SENTRY_ERROR_LOCAL_VARIABLES__";const u=t;function l(...e){u.debug&&c((()=>console.log("[LocalVariables Worker]",...e)))}async function f(e,t,n,o){const i=await e.post("Runtime.getProperties",{objectId:t,ownProperties:!0});o[n]=i.result.filter((e=>"length"!==e.name&&!isNaN(parseInt(e.name,10)))).sort(((e,t)=>parseInt(e.name,10)-parseInt(t.name,10))).map((e=>e.value?.value))}async function g(e,t,n,o){const i=await e.post("Runtime.getProperties",{objectId:t,ownProperties:!0});o[n]=i.result.map((e=>[e.name,e.value?.value])).reduce(((e,[t,n])=>(e[t]=n,e)),{})}function d(e,t){e.value&&("value"in e.value?void 0===e.value.value||null===e.value.value?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:"description"in e.value&&"function"!==e.value.type?t[e.name]=`<${e.value.description}>`:"undefined"===e.value.type&&(t[e.name]="<undefined>"))}async function b(e,t){const n=await e.post("Runtime.getProperties",{objectId:t,ownProperties:!0}),o={};for(const t of n.result)if(t.value?.objectId&&"Array"===t.value.className){const n=t.value.objectId;await f(e,n,t.name,o)}else if(t.value?.objectId&&"Object"===t.value.className){const n=t.value.objectId;await g(e,n,t.name,o)}else t.value&&d(t,o);return o}let p;(async function(){const t=new e;t.connectToMainThread(),l("Connected to main thread");let n=!1;t.on("Debugger.resumed",(()=>{n=!1})),t.on("Debugger.paused",(e=>{n=!0,async function(e,{reason:t,data:{objectId:n},callFrames:o}){if("exception"!==t&&"promiseRejection"!==t)return;if(p?.(),null==n)return;const i=[];for(let t=0;t<o.length;t++){const{scopeChain:n,functionName:a,this:s}=o[t],c=n.find((e=>"local"===e.type)),r="global"!==s.className&&s.className?`${s.className}.${a}`:a;if(void 0===c?.object.objectId)i[t]={function:r};else{const n=await b(e,c.object.objectId);i[t]={function:r,vars:n}}}await e.post("Runtime.callFunctionOn",{functionDeclaration:`function() { this.${r} = this.${r} || ${JSON.stringify(i)}; }`,silent:!0,objectId:n}),await e.post("Runtime.releaseObject",{objectId:n})}(t,e.params).then((async()=>{n&&await t.post("Debugger.resume")}),(async e=>{n&&await t.post("Debugger.resume")}))})),await t.post("Debugger.enable");const o=!1!==u.captureAllExceptions;if(await t.post("Debugger.setPauseOnExceptions",{state:o?"all":"uncaught"}),o){const e=u.maxExceptionsPerSecond||50;p=function(e,t,n){let o=0,i=5,a=0;return setInterval((()=>{0===a?o>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(a-=1,0===a&&t()),o=0}),1e3).unref(),()=>{o+=1}}(e,(async()=>{l("Rate-limit lifted."),await t.post("Debugger.setPauseOnExceptions",{state:"all"})}),(async e=>{l(`Rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),await t.post("Debugger.setPauseOnExceptions",{state:"uncaught"})}))}})().catch((e=>{l("Failed to start debugger",e)})),setInterval((()=>{}),1e4);
|
|
@@ -36,6 +36,15 @@ const AI_MODEL_ID_ATTRIBUTE = 'ai.model.id';
|
|
|
36
36
|
*/
|
|
37
37
|
const AI_MODEL_PROVIDER_ATTRIBUTE = 'ai.model.provider';
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Basic LLM span information
|
|
41
|
+
* Multiple spans
|
|
42
|
+
*
|
|
43
|
+
* The functionId that was set through `telemetry.functionId`
|
|
44
|
+
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
|
|
45
|
+
*/
|
|
46
|
+
const AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE = 'ai.telemetry.functionId';
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* Basic LLM span information
|
|
41
50
|
* Multiple spans
|
|
@@ -81,5 +90,27 @@ const GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.input_tokens';
|
|
|
81
90
|
*/
|
|
82
91
|
const GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.output_tokens';
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
// =============================================================================
|
|
94
|
+
// TOOL CALL SPANS
|
|
95
|
+
// =============================================================================
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Tool call spans
|
|
99
|
+
* `ai.toolCall` span
|
|
100
|
+
*
|
|
101
|
+
* The name of the tool
|
|
102
|
+
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
|
|
103
|
+
*/
|
|
104
|
+
const AI_TOOL_CALL_NAME_ATTRIBUTE = 'ai.toolCall.name';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Tool call spans
|
|
108
|
+
* `ai.toolCall` span
|
|
109
|
+
*
|
|
110
|
+
* The id of the tool call
|
|
111
|
+
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
|
|
112
|
+
*/
|
|
113
|
+
const AI_TOOL_CALL_ID_ATTRIBUTE = 'ai.toolCall.id';
|
|
114
|
+
|
|
115
|
+
export { AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE, AI_TOOL_CALL_ID_ATTRIBUTE, AI_TOOL_CALL_NAME_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE };
|
|
116
|
+
//# sourceMappingURL=ai_sdk_attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai_sdk_attributes.js","sources":["../../../../../src/integrations/tracing/vercelai/ai_sdk_attributes.ts"],"sourcesContent":["/**\n * AI SDK Telemetry Attributes\n * Based on https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\n\n// =============================================================================\n// COMMON ATTRIBUTES\n// =============================================================================\n\n/**\n * Common attribute for operation name across all functions and spans\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\nexport const OPERATION_NAME_ATTRIBUTE = 'operation.name';\n\n/**\n * Common attribute for AI operation ID across all functions and spans\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\nexport const AI_OPERATION_ID_ATTRIBUTE = 'ai.operationId';\n\n// =============================================================================\n// SHARED ATTRIBUTES\n// =============================================================================\n\n/**\n * `generateText` function - `ai.generateText` span\n * `streamText` function - `ai.streamText` span\n *\n * The prompt that was used when calling the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_PROMPT_ATTRIBUTE = 'ai.prompt';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The JSON schema version of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_ATTRIBUTE = 'ai.schema';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The name of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_NAME_ATTRIBUTE = 'ai.schema.name';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The description of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_DESCRIPTION_ATTRIBUTE = 'ai.schema.description';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The object that was generated (stringified JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_RESPONSE_OBJECT_ATTRIBUTE = 'ai.response.object';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The object generation mode, e.g. `json`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SETTINGS_MODE_ATTRIBUTE = 'ai.settings.mode';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The output type that was used, e.g. `object` or `no-schema`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SETTINGS_OUTPUT_ATTRIBUTE = 'ai.settings.output';\n\n/**\n * `embed` function - `ai.embed.doEmbed` span\n * `embedMany` function - `ai.embedMany` span\n *\n * The values that were passed into the function (array)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_VALUES_ATTRIBUTE = 'ai.values';\n\n/**\n * `embed` function - `ai.embed.doEmbed` span\n * `embedMany` function - `ai.embedMany` span\n *\n * An array of JSON-stringified embeddings\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_EMBEDDINGS_ATTRIBUTE = 'ai.embeddings';\n\n// =============================================================================\n// GENERATETEXT FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The text that was generated\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_TEXT_ATTRIBUTE = 'ai.response.text';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The tool calls that were made as part of the generation (stringified JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = 'ai.response.toolCalls';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The reason why the generation finished\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_FINISH_REASON_ATTRIBUTE = 'ai.response.finishReason';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The maximum number of steps that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_SETTINGS_MAX_STEPS_ATTRIBUTE = 'ai.settings.maxSteps';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The format of the prompt\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_FORMAT_ATTRIBUTE = 'ai.prompt.format';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The messages that were passed into the provider\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_MESSAGES_ATTRIBUTE = 'ai.prompt.messages';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * Array of stringified tool definitions\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_TOOLS_ATTRIBUTE = 'ai.prompt.tools';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The stringified tool choice setting (JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_TOOL_CHOICE_ATTRIBUTE = 'ai.prompt.toolChoice';\n\n// =============================================================================\n// STREAMTEXT FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The time it took to receive the first chunk in milliseconds\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_MS_TO_FIRST_CHUNK_ATTRIBUTE = 'ai.response.msToFirstChunk';\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The time it took to receive the finish part of the LLM stream in milliseconds\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_MS_TO_FINISH_ATTRIBUTE = 'ai.response.msToFinish';\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The average completion tokens per second\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND_ATTRIBUTE = 'ai.response.avgCompletionTokensPerSecond';\n\n// =============================================================================\n// EMBED FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `embed` function - `ai.embed` span\n *\n * The value that was passed into the `embed` function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_VALUE_ATTRIBUTE = 'ai.value';\n\n/**\n * `embed` function - `ai.embed` span\n *\n * A JSON-stringified embedding\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBEDDING_ATTRIBUTE = 'ai.embedding';\n\n// =============================================================================\n// BASIC LLM SPAN INFORMATION\n// =============================================================================\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The functionId that was set through `telemetry.functionId`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const RESOURCE_NAME_ATTRIBUTE = 'resource.name';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The id of the model\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_MODEL_ID_ATTRIBUTE = 'ai.model.id';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The provider of the model\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_MODEL_PROVIDER_ATTRIBUTE = 'ai.model.provider';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The request headers that were passed in through `headers`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_REQUEST_HEADERS_ATTRIBUTE = 'ai.request.headers';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The maximum number of retries that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = 'ai.settings.maxRetries';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The functionId that was set through `telemetry.functionId`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE = 'ai.telemetry.functionId';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The metadata that was passed in through `telemetry.metadata`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_TELEMETRY_METADATA_ATTRIBUTE = 'ai.telemetry.metadata';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The number of completion tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = 'ai.usage.completionTokens';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The number of prompt tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_USAGE_PROMPT_TOKENS_ATTRIBUTE = 'ai.usage.promptTokens';\n\n// =============================================================================\n// CALL LLM SPAN INFORMATION\n// =============================================================================\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The model that was used to generate the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_MODEL_ATTRIBUTE = 'ai.response.model';\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The id of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_ID_ATTRIBUTE = 'ai.response.id';\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The timestamp of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_TIMESTAMP_ATTRIBUTE = 'ai.response.timestamp';\n\n// =============================================================================\n// SEMANTIC CONVENTIONS FOR GENAI OPERATIONS\n// =============================================================================\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The provider that was used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_SYSTEM_ATTRIBUTE = 'gen_ai.system';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The model that was requested\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_MODEL_ATTRIBUTE = 'gen_ai.request.model';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The temperature that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE = 'gen_ai.request.temperature';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The maximum number of tokens that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE = 'gen_ai.request.max_tokens';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The frequency penalty that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE = 'gen_ai.request.frequency_penalty';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The presence penalty that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE = 'gen_ai.request.presence_penalty';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The topK parameter value that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TOP_K_ATTRIBUTE = 'gen_ai.request.top_k';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The topP parameter value that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TOP_P_ATTRIBUTE = 'gen_ai.request.top_p';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The stop sequences\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE = 'gen_ai.request.stop_sequences';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The finish reasons that were returned by the provider\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE = 'gen_ai.response.finish_reasons';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The model that was used to generate the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_MODEL_ATTRIBUTE = 'gen_ai.response.model';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The id of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_ID_ATTRIBUTE = 'gen_ai.response.id';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The number of prompt tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.input_tokens';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The number of completion tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.output_tokens';\n\n// =============================================================================\n// BASIC EMBEDDING SPAN INFORMATION\n// =============================================================================\n\n/**\n * Basic embedding span information\n * Embedding spans\n *\n * The number of tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-embedding-span-information\n */\nexport const AI_USAGE_TOKENS_ATTRIBUTE = 'ai.usage.tokens';\n\n// =============================================================================\n// TOOL CALL SPANS\n// =============================================================================\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The name of the tool\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_NAME_ATTRIBUTE = 'ai.toolCall.name';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The id of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_ID_ATTRIBUTE = 'ai.toolCall.id';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The parameters of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_ARGS_ATTRIBUTE = 'ai.toolCall.args';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The result of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_RESULT_ATTRIBUTE = 'ai.toolCall.result';\n\n// =============================================================================\n// SPAN ATTRIBUTE OBJECTS\n// =============================================================================\n\n/**\n * Attributes collected for `ai.generateText` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_GENERATE_TEXT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT: AI_PROMPT_ATTRIBUTE,\n AI_RESPONSE_TEXT: AI_RESPONSE_TEXT_ATTRIBUTE,\n AI_RESPONSE_TOOL_CALLS: AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n AI_RESPONSE_FINISH_REASON: AI_RESPONSE_FINISH_REASON_ATTRIBUTE,\n AI_SETTINGS_MAX_STEPS: AI_SETTINGS_MAX_STEPS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.generateText.doGenerate` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_GENERATE_TEXT_DO_GENERATE_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT_FORMAT: AI_PROMPT_FORMAT_ATTRIBUTE,\n AI_PROMPT_MESSAGES: AI_PROMPT_MESSAGES_ATTRIBUTE,\n AI_PROMPT_TOOLS: AI_PROMPT_TOOLS_ATTRIBUTE,\n AI_PROMPT_TOOL_CHOICE: AI_PROMPT_TOOL_CHOICE_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n // Call LLM span information\n AI_RESPONSE_MODEL: AI_RESPONSE_MODEL_ATTRIBUTE,\n AI_RESPONSE_ID: AI_RESPONSE_ID_ATTRIBUTE,\n AI_RESPONSE_TIMESTAMP: AI_RESPONSE_TIMESTAMP_ATTRIBUTE,\n // Semantic Conventions for GenAI operations\n GEN_AI_SYSTEM: GEN_AI_SYSTEM_ATTRIBUTE,\n GEN_AI_REQUEST_MODEL: GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n GEN_AI_REQUEST_TEMPERATURE: GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,\n GEN_AI_REQUEST_MAX_TOKENS: GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,\n GEN_AI_REQUEST_FREQUENCY_PENALTY: GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_PRESENCE_PENALTY: GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_K: GEN_AI_REQUEST_TOP_K_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_P: GEN_AI_REQUEST_TOP_P_ATTRIBUTE,\n GEN_AI_REQUEST_STOP_SEQUENCES: GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE,\n GEN_AI_RESPONSE_FINISH_REASONS: GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL: GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_ID: GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS: GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS: GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamText` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_STREAM_TEXT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT: AI_PROMPT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamText.doStream` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_STREAM_TEXT_DO_STREAM_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_RESPONSE_MS_TO_FIRST_CHUNK: AI_RESPONSE_MS_TO_FIRST_CHUNK_ATTRIBUTE,\n AI_RESPONSE_MS_TO_FINISH: AI_RESPONSE_MS_TO_FINISH_ATTRIBUTE,\n AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND: AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n // Call LLM span information\n AI_RESPONSE_MODEL: AI_RESPONSE_MODEL_ATTRIBUTE,\n AI_RESPONSE_ID: AI_RESPONSE_ID_ATTRIBUTE,\n AI_RESPONSE_TIMESTAMP: AI_RESPONSE_TIMESTAMP_ATTRIBUTE,\n // Semantic Conventions for GenAI operations\n GEN_AI_SYSTEM: GEN_AI_SYSTEM_ATTRIBUTE,\n GEN_AI_REQUEST_MODEL: GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n GEN_AI_REQUEST_TEMPERATURE: GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,\n GEN_AI_REQUEST_MAX_TOKENS: GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,\n GEN_AI_REQUEST_FREQUENCY_PENALTY: GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_PRESENCE_PENALTY: GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_K: GEN_AI_REQUEST_TOP_K_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_P: GEN_AI_REQUEST_TOP_P_ATTRIBUTE,\n GEN_AI_REQUEST_STOP_SEQUENCES: GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE,\n GEN_AI_RESPONSE_FINISH_REASONS: GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL: GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_ID: GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS: GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS: GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.generateObject` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n */\nexport const AI_GENERATE_OBJECT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_SCHEMA: AI_SCHEMA_ATTRIBUTE,\n AI_SCHEMA_NAME: AI_SCHEMA_NAME_ATTRIBUTE,\n AI_SCHEMA_DESCRIPTION: AI_SCHEMA_DESCRIPTION_ATTRIBUTE,\n AI_RESPONSE_OBJECT: AI_RESPONSE_OBJECT_ATTRIBUTE,\n AI_SETTINGS_MODE: AI_SETTINGS_MODE_ATTRIBUTE,\n AI_SETTINGS_OUTPUT: AI_SETTINGS_OUTPUT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamObject` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_STREAM_OBJECT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_SCHEMA: AI_SCHEMA_ATTRIBUTE,\n AI_SCHEMA_NAME: AI_SCHEMA_NAME_ATTRIBUTE,\n AI_SCHEMA_DESCRIPTION: AI_SCHEMA_DESCRIPTION_ATTRIBUTE,\n AI_RESPONSE_OBJECT: AI_RESPONSE_OBJECT_ATTRIBUTE,\n AI_SETTINGS_MODE: AI_SETTINGS_MODE_ATTRIBUTE,\n AI_SETTINGS_OUTPUT: AI_SETTINGS_OUTPUT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embed` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBED_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUE: AI_VALUE_ATTRIBUTE,\n AI_EMBEDDING: AI_EMBEDDING_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embed.doEmbed` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBED_DO_EMBED_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUES: AI_VALUES_ATTRIBUTE,\n AI_EMBEDDINGS: AI_EMBEDDINGS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embedMany` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_EMBED_MANY_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUES: AI_VALUES_ATTRIBUTE,\n AI_EMBEDDINGS: AI_EMBEDDINGS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.toolCall` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_TOOL_CALL_NAME: AI_TOOL_CALL_NAME_ATTRIBUTE,\n AI_TOOL_CALL_ID: AI_TOOL_CALL_ID_ATTRIBUTE,\n AI_TOOL_CALL_ARGS: AI_TOOL_CALL_ARGS_ATTRIBUTE,\n AI_TOOL_CALL_RESULT: AI_TOOL_CALL_RESULT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n} as const;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;;;AAkBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAoB,GAAE;;AAmNnC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,qBAAsB,GAAE;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,2BAA4B,GAAE;;AAoB3C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kCAAmC,GAAE;;AAWlD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oCAAqC,GAAE;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAiC,GAAE;;AA+HhD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,+BAAgC,GAAE;;AAW/C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mCAAoC,GAAE;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oCAAqC,GAAE;;AAepD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,2BAA4B,GAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,yBAA0B,GAAE;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
|
|
2
2
|
import { generateInstrumentOnce } from '../../../otel/instrument.js';
|
|
3
3
|
import { addOriginToSpan } from '../../../utils/addOriginToSpan.js';
|
|
4
|
-
import { AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE } from './
|
|
4
|
+
import { AI_TOOL_CALL_NAME_ATTRIBUTE, AI_TOOL_CALL_ID_ATTRIBUTE, AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE } from './ai_sdk_attributes.js';
|
|
5
5
|
import { INTEGRATION_NAME } from './constants.js';
|
|
6
6
|
import { SentryVercelAiInstrumentation } from './instrumentation.js';
|
|
7
7
|
|
|
@@ -25,81 +25,30 @@ const _vercelAIIntegration = ((options = {}) => {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// Tool call spans
|
|
29
|
+
// https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
|
|
30
|
+
if (
|
|
31
|
+
attributes[AI_TOOL_CALL_NAME_ATTRIBUTE] &&
|
|
32
|
+
attributes[AI_TOOL_CALL_ID_ATTRIBUTE] &&
|
|
33
|
+
name === 'ai.toolCall'
|
|
34
|
+
) {
|
|
35
|
+
addOriginToSpan(span, 'auto.vercelai.otel');
|
|
36
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool');
|
|
37
|
+
span.setAttribute('gen_ai.tool.call.id', attributes[AI_TOOL_CALL_ID_ATTRIBUTE]);
|
|
38
|
+
span.setAttribute('gen_ai.tool.name', attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]);
|
|
39
|
+
span.updateName(`execute_tool ${attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The AI and Provider must be defined for generate, stream, and embed spans.
|
|
28
44
|
// The id of the model
|
|
29
45
|
const aiModelId = attributes[AI_MODEL_ID_ATTRIBUTE];
|
|
30
|
-
|
|
31
46
|
// the provider of the model
|
|
32
47
|
const aiModelProvider = attributes[AI_MODEL_PROVIDER_ATTRIBUTE];
|
|
33
|
-
|
|
34
|
-
// both of these must be defined for the integration to work
|
|
35
48
|
if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {
|
|
36
49
|
return;
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
let isPipelineSpan = false;
|
|
40
|
-
|
|
41
|
-
switch (name) {
|
|
42
|
-
case 'ai.generateText': {
|
|
43
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');
|
|
44
|
-
isPipelineSpan = true;
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case 'ai.generateText.doGenerate': {
|
|
48
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
case 'ai.streamText': {
|
|
52
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');
|
|
53
|
-
isPipelineSpan = true;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
case 'ai.streamText.doStream': {
|
|
57
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
case 'ai.generateObject': {
|
|
61
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');
|
|
62
|
-
isPipelineSpan = true;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case 'ai.generateObject.doGenerate': {
|
|
66
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case 'ai.streamObject': {
|
|
70
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');
|
|
71
|
-
isPipelineSpan = true;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case 'ai.streamObject.doStream': {
|
|
75
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case 'ai.embed': {
|
|
79
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');
|
|
80
|
-
isPipelineSpan = true;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case 'ai.embed.doEmbed': {
|
|
84
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case 'ai.embedMany': {
|
|
88
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');
|
|
89
|
-
isPipelineSpan = true;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
case 'ai.embedMany.doEmbed': {
|
|
93
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case 'ai.toolCall':
|
|
97
|
-
case 'ai.stream.firstChunk':
|
|
98
|
-
case 'ai.stream.finish':
|
|
99
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
52
|
addOriginToSpan(span, 'auto.vercelai.otel');
|
|
104
53
|
|
|
105
54
|
const nameWthoutAi = name.replace('ai.', '');
|
|
@@ -107,9 +56,9 @@ const _vercelAIIntegration = ((options = {}) => {
|
|
|
107
56
|
span.updateName(nameWthoutAi);
|
|
108
57
|
|
|
109
58
|
// If a Telemetry name is set and it is a pipeline span, use that as the operation name
|
|
110
|
-
const functionId = attributes[
|
|
111
|
-
if (functionId && typeof functionId === 'string' &&
|
|
112
|
-
span.updateName(functionId);
|
|
59
|
+
const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];
|
|
60
|
+
if (functionId && typeof functionId === 'string' && name.split('.').length - 1 === 1) {
|
|
61
|
+
span.updateName(`${nameWthoutAi} ${functionId}`);
|
|
113
62
|
span.setAttribute('ai.pipeline.name', functionId);
|
|
114
63
|
}
|
|
115
64
|
|
|
@@ -120,6 +69,78 @@ const _vercelAIIntegration = ((options = {}) => {
|
|
|
120
69
|
span.setAttribute(GEN_AI_RESPONSE_MODEL_ATTRIBUTE, attributes[AI_MODEL_ID_ATTRIBUTE]);
|
|
121
70
|
}
|
|
122
71
|
span.setAttribute('ai.streaming', name.includes('stream'));
|
|
72
|
+
|
|
73
|
+
// Generate Spans
|
|
74
|
+
if (name === 'ai.generateText') {
|
|
75
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_text');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (name === 'ai.generateText.doGenerate') {
|
|
80
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_text');
|
|
81
|
+
span.updateName(`generate_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (name === 'ai.streamText') {
|
|
86
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_text');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (name === 'ai.streamText.doStream') {
|
|
91
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_text');
|
|
92
|
+
span.updateName(`stream_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (name === 'ai.generateObject') {
|
|
97
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_object');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (name === 'ai.generateObject.doGenerate') {
|
|
102
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_object');
|
|
103
|
+
span.updateName(`generate_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (name === 'ai.streamObject') {
|
|
108
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_object');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (name === 'ai.streamObject.doStream') {
|
|
113
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_object');
|
|
114
|
+
span.updateName(`stream_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (name === 'ai.embed') {
|
|
119
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (name === 'ai.embed.doEmbed') {
|
|
124
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed');
|
|
125
|
+
span.updateName(`embed ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (name === 'ai.embedMany') {
|
|
130
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed_many');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (name === 'ai.embedMany.doEmbed') {
|
|
135
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed_many');
|
|
136
|
+
span.updateName(`embed_many ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (name.startsWith('ai.stream')) {
|
|
141
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
123
144
|
});
|
|
124
145
|
|
|
125
146
|
client.addEventProcessor(event => {
|
|
@@ -133,12 +154,10 @@ const _vercelAIIntegration = ((options = {}) => {
|
|
|
133
154
|
|
|
134
155
|
if (attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE] != undefined) {
|
|
135
156
|
attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
137
157
|
delete attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];
|
|
138
158
|
}
|
|
139
159
|
if (attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE] != undefined) {
|
|
140
160
|
attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
142
161
|
delete attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];
|
|
143
162
|
}
|
|
144
163
|
if (
|