@sentry/node 9.16.0 → 9.16.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.
Files changed (24) hide show
  1. package/build/cjs/integrations/anr/index.js +1 -1
  2. package/build/cjs/integrations/http/index.js +0 -18
  3. package/build/cjs/integrations/http/index.js.map +1 -1
  4. package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  5. package/build/esm/integrations/anr/index.js +1 -1
  6. package/build/esm/integrations/anr/worker-script.js +2 -2
  7. package/build/esm/integrations/http/index.js +0 -18
  8. package/build/esm/integrations/http/index.js.map +1 -1
  9. package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  10. package/build/esm/integrations/local-variables/worker-script.js +2 -2
  11. package/build/esm/package.json +1 -1
  12. package/build/types/integrations/http/index.d.ts.map +1 -1
  13. package/package.json +3 -3
  14. package/build/cjs/integrations/http/SentryHttpInstrumentationBeforeOtel.js +0 -136
  15. package/build/cjs/integrations/http/SentryHttpInstrumentationBeforeOtel.js.map +0 -1
  16. package/build/cjs/integrations/http/utils.js +0 -44
  17. package/build/cjs/integrations/http/utils.js.map +0 -1
  18. package/build/esm/integrations/http/SentryHttpInstrumentationBeforeOtel.js +0 -134
  19. package/build/esm/integrations/http/SentryHttpInstrumentationBeforeOtel.js.map +0 -1
  20. package/build/esm/integrations/http/utils.js +0 -42
  21. package/build/esm/integrations/http/utils.js.map +0 -1
  22. package/build/types/integrations/http/SentryHttpInstrumentationBeforeOtel.d.ts +0 -17
  23. package/build/types/integrations/http/SentryHttpInstrumentationBeforeOtel.d.ts.map +0 -1
  24. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentationBeforeOtel.d.ts +0 -20
@@ -1,2 +1,2 @@
1
- /*! @sentry/node 9.16.0 (aaaa9ab) | 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.16.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="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,T=["debug","info","warn","error","log","assert","trace"],C={};function R(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 N?T.forEach((e=>{n[e]=(...n)=>{t&&R((()=>{l.console[e](`Sentry Logger [${e}]:`,...n)}))}})):T.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 D(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 A(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 P=1e3;function U(){return Date.now()/P}const M=function(){const{performance:t}=l;if(!t?.now)return U;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/P}();function L(t){const n=M(),e={sid:A(),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&&B(e,t),e}function B(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||M(),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:A()),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 G(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]=G(r[t],n[t],e-1));return r}const J="_sentrySpan";function Y(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){N&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,J,n):delete t[J]}function z(t){return t[J]}function H(){return A()}function F(){return A().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.T=this.T,t.C=this.C,t.R=this.R,t.i=[...this.i],t.h=[...this.h],t.v={...this.v},t.S={...this.S},t.k=this.k,t.j=this.j,Y(t,z(this)),t}setClient(t){this.k=t}setLastEventId(t){this.j=t}getClient(){return this.k}lastEventId(){return this.j}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.T&&B(this.T,{user:t}),this.D(),this}getUser(){return this.p}setTags(t){return this.l={...this.l,...t},this.D(),this}setTag(t,n){return this.l={...this.l,[t]:n},this.D(),this}setExtras(t){return this.m={...this.m,...t},this.D(),this}setExtra(t,n){return this.m={...this.m,[t]:n},this.D(),this}setFingerprint(t){return this.R=t,this.D(),this}setLevel(t){return this.N=t,this.D(),this}setTransactionName(t){return this.C=t,this.D(),this}setContext(t,n){return null===n?delete this._[t]:this._[t]=n,this.D(),this}setSession(t){return t?this.T=t:delete this.T,this.D(),this}getSession(){return this.T}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.R=u),a&&(this.S=a),this}clear(){return this.u=[],this.l={},this.m={},this.p={},this._={},this.N=void 0,this.C=void 0,this.R=void 0,this.T=void 0,Y(this,void 0),this.h=[],this.setPropagationContext({traceId:H(),sampleRand:Math.random()}),this.D(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:U(),...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.k?.recordDroppedEvent("buffer_overflow","log_item")),this.D(),this}getLastBreadcrumb(){return this.u[this.u.length-1]}clearBreadcrumbs(){return this.u=[],this.D(),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.R||[],eventProcessors:this.i,propagationContext:this.S,sdkProcessingMetadata:this.v,transactionName:this.C,span:z(this)}}setSDKProcessingMetadata(t){return this.v=G(this.v,t,2),this}setPropagationContext(t){return this.S=t,this}getPropagationContext(){return this.S}captureException(t,n){const e=n?.event_id||A();if(!this.k)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.k.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e?.event_id||A();if(!this.k)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.k.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n?.event_id||A();return this.k?(this.k.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}D(){this.t||(this.t=!0,this.o.forEach((t=>{t(this)})),this.t=!1)}}class K{constructor(t,n){let e,r;e=t||new W,r=n||new W,this.I=[{scope:e}],this.O=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.O}getStackTop(){return this.I[this.I.length-1]}A(){const t=this.getScope().clone();return this.I.push({client:this.getClient(),scope:t}),t}P(){return!(this.I.length<=1)&&!!this.I.pop()}}function V(){const t=m(d());return t.stack=t.stack||new K(g("defaultCurrentScope",(()=>new W)),g("defaultIsolationScope",(()=>new W)))}function Z(t){return V().withScope(t)}function q(t,n){const e=V();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Q(t){return V().withScope((()=>t(V().getIsolationScope())))}function X(t){const n=m(t);return n.acs?n.acs:{withIsolationScope:Q,withScope:Z,withSetScope:q,withSetIsolationScope:(t,n)=>Q(n),getCurrentScope:()=>V().getScope(),getIsolationScope:()=>V().getIsolationScope()}}function tt(){return X(d()).getCurrentScope().getClient()}const nt="sentry.source",et="sentry.sample_rate",rt="sentry.previous_trace_sample_rate",ot="sentry.op",st="sentry.origin",it=0,ct=1,ut="_sentryScope",at="_sentryIsolationScope";function ft(t){return{scope:t[ut],isolationScope:t[at]}}const ht="sentry-",pt=/^sentry-/;function lt(t){const n=function(t){if(!t||!_(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=dt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return dt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(pt)){t[n.slice(ht.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function dt(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}const mt=1;function gt(t){const{spanId:n,traceId:e,isRemote:r}=t.spanContext(),o=r?n:vt(t).parent_span_id,s=ft(t).scope;return{parent_span_id:o,span_id:r?s?.getPropagationContext().propagationSpanId||F():n,trace_id:e}}function yt(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===mt,attributes:o,...r}))):void 0}function bt(t){return"number"==typeof t?_t(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?_t(t.getTime()):M()}function _t(t){return t>9999999999?t/1e3:t}function vt(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,parentSpanId:c,status:u,links:a}=t;return{span_id:n,trace_id:e,data:r,description:s,parent_span_id:c,start_timestamp:bt(o),timestamp:bt(i)||void 0,status:wt(u),op:r[ot],origin:r[st],links:yt(a)}}return{span_id:n,trace_id:e,start_timestamp:0,data:{}}}function wt(t){if(t&&t.code!==it)return t.code===ct?"ok":t.message||"unknown_error"}const St="_sentryRootSpan";function $t(t){return t[St]||t}const Et=50,xt="?",Nt=/captureMessage|captureException/;function Tt(t){return t[t.length-1]||{}}const Ct="<anonymous>";const Rt="production",kt="_frozenDsc";function jt(t){const n=tt();if(!n)return{};const e=$t(t),r=vt(e),o=r.data,s=e.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[et]??o[rt];function c(t){return"number"!=typeof i&&"string"!=typeof i||(t.sample_rate=`${i}`),t}const u=e[kt];if(u)return c(u);const a=s?.get("sentry.dsc"),f=a&&lt(a);if(f)return c(f);const h=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o={environment:e.environment||Rt,release:e.release,public_key:r,trace_id:t};return n.emit("createDsc",o),o}(t.spanContext().traceId,n),p=o[nt],l=r.description;return"url"!==p&&l&&(h.transaction=l),function(t){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const n=t||tt()?.getOptions();return!(!n||null==n.tracesSampleRate&&!n.tracesSampler)}()&&(h.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===mt}(e)),h.sample_rand=s?.get("sentry.sample_rand")??ft(e).scope?.getPropagationContext().sampleRand.toString()),c(h),n.emit("createDsc",h,e),h}function Dt(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}`}function It(t,n=100,e=1/0){try{return Ot("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Ot(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 Ot("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=D(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]=Ot(t,n,u-1,r,o),h++}return i(n),f}function At(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 Pt(t,n=[]){return[t,n]}function Ut(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function Mt(t){const n=m(l);return n.encodePolyfill?n.encodePolyfill(t):(new TextEncoder).encode(t)}function Lt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[Mt(r),t]:r.push("string"==typeof t?Mt(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(It(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 Bt={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 Gt(t){if(!t?.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function Jt(t,n,e,r){const o=Gt(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:Dt(r)},...o&&{trace:o}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Pt(i,[[{type:s},t]])}const Yt="__SENTRY_SUPPRESS_TRACING__";function zt(t){const n=X(d());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=X(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({[Yt]:!0}),t())))}var Ht;function Ft(t){return new Wt((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(Ht||(Ht={}));class Wt{constructor(t){this.L=Ht.PENDING,this.B=[],this.G(t)}then(t,n){return new Wt(((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 Wt(((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===Ht.PENDING)return;const t=this.B.slice();this.B=[],t.forEach((t=>{t[0]||(this.L===Ht.RESOLVED&&t[1](this.Y),this.L===Ht.REJECTED&&t[2](this.Y),t[0]=!0)}))}G(t){const n=(t,n)=>{this.L===Ht.PENDING&&(w(n)?n.then(e,r):(this.L=t,this.Y=n,this.J()))},e=t=>{n(Ht.RESOLVED,t)},r=t=>{n(Ht.REJECTED,t)};try{t(e,r)}catch(t){r(t)}}}function Kt(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:gt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:jt(n),...t.sdkProcessingMetadata};const e=$t(n),r=vt(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 Vt="7";const Zt=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=Zt,new Wt(((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 Wt(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{Ft(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}const Qt=6e4;function Xt(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)?Qt:r-n}(i,r):429===n&&(o.all=r+6e4);return o}const tn=64;function nn(t,n,e=qt(t.bufferSize||tn)){let r={};return{send:function(t){const o=[];if(Ut(t,((t,n)=>{const e=function(t){return Bt[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 Ft({});const s=Pt(t[0],o),i=t=>{Ut(s,((t,n)=>{}))};return e.add((()=>n({body:Lt(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=Xt(r,t),t)),(t=>{throw i(),h&&k.error("Encountered error running transport request:",t),t})))).then((t=>t),(t=>{if(t===Zt)return h&&k.error("Skipped sending event because buffer is full."),i(),Ft({});throw t}))},flush:t=>e.drain(t)}}const en=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function rn(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=en.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 on(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 sn=Symbol("AgentBaseInternalState");class cn extends s.Agent{constructor(t){super(t),this[sn]={}}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[sn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[sn].currentSocket;if(this[sn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[sn].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[sn]&&(this[sn].defaultPort=t)}get protocol(){return this[sn].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[sn]&&(this[sn].protocol=t)}}function un(...t){k.log("[https-proxy-agent:parse-proxy-response]",...t)}function an(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 un("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}un("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(),un("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),un("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),s()}))}function fn(...t){k.log("[https-proxy-agent]",...t)}class hn extends cn{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??{},fn("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?ln(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){fn("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 fn("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=an(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",pn),n.secureEndpoint){fn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...ln(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=>{fn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function pn(t){t.resume()}function ln(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}hn.__initStatic();const dn=32768;function mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const gn=n;let yn,bn=0,_n={};function vn(t){gn.debug&&console.log(`[ANR Worker] ${t}`)}var wn,Sn,$n;const En=function(t){let n;try{n=new URL(t.url)}catch(n){return R((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),nn(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 hn(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)=>{zt((()=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>dn&&(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 nn(t,h)}({url:(wn=gn.dsn,Sn=gn.tunnel,$n=gn.sdkMetadata.sdk,Sn||`${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/`}(wn)}?${function(t,n){const e={sentry_version:Vt};return t.publicKey&&(e.sentry_key=t.publicKey),n&&(e.sentry_client=`${n.name}/${n.version}`),new URLSearchParams(e).toString()}(wn,$n)}`)});async function xn(){if(yn){vn("Sending abnormal session"),B(yn,{status:"abnormal",abnormal_mechanism:"anr_foreground",release:gn.release,environment:gn.environment});const t=function(t,n,e,r){const o=Gt(e);return Pt({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:Dt(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(yn,gn.dsn,gn.sdkMetadata,gn.tunnel);vn(JSON.stringify(t)),await En.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function Nn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(Tt(n).function||"")&&n.pop(),n.reverse(),Nt.test(Tt(n).function||"")&&(n.pop(),Nt.test(Tt(n).function||"")&&n.pop()),n.slice(0,Et).map((t=>({...t,filename:t.filename||Tt(n).filename,function:t.function||xt})))}(t);if(gn.appRootPath)for(const t of n)t.filename&&(t.filename=At(t.filename,gn.appRootPath));return n}async function Tn(t,n){if(bn>=gn.maxAnrEvents)return;bn+=1,await xn(),vn("Sending event");const e={event_id:A(),contexts:gn.contexts,release:gn.release,environment:gn.environment,dist:gn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${gn.anrThreshold} ms`,stacktrace:{frames:Nn(t)},mechanism:{type:"ANR"}}]},tags:gn.staticTags};n&&function(t,n){if(Kt(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(_n).length)return;const n=gn.appRootPath?{}:_n;if(gn.appRootPath)for(const[t,e]of Object.entries(_n))n[At(t,gn.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=Jt(e,gn.dsn,gn.sdkMetadata,gn.tunnel);vn(JSON.stringify(r)),await En.send(r),await En.flush(2e3),bn>=gn.maxAnrEvents&&setTimeout((()=>{process.exit(0)}),5e3)}let Cn;if(vn("Started"),gn.captureStackTrace){vn("Connecting to debugger");const n=new t;n.connectToMainThread(),vn("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{vn("Debugger paused");const s=[...t.params.callFrames],i=gn.appRootPath?function(t=(process.argv[1]?rn(process.argv[1]):process.cwd()),n="\\"===o){const e=n?mn(t):t;return t=>{if(!t)return;const o=n?mn(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}}(gn.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||xt,colno:o,lineno:s,in_app:r?on(r):void 0}}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Tn(c).then(null,(()=>{vn("Sending ANR event failed.")}))}),5e3);n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&vn(`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,(()=>{vn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),Cn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Rn}=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()}}}),gn.pollInterval,gn.anrThreshold,(function(){vn("Watchdog timeout"),Cn?(vn("Pausing debugger to capture stack trace"),Cn()):(vn("Capturing event without a stack trace"),Tn().then(null,(()=>{vn("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(yn=L(t.session)),t.debugImages&&(_n=t.debugImages),Rn()}));
1
+ /*! @sentry/node 9.16.1 (1603866) | 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.16.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="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,T=["debug","info","warn","error","log","assert","trace"],C={};function R(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 N?T.forEach((e=>{n[e]=(...n)=>{t&&R((()=>{l.console[e](`Sentry Logger [${e}]:`,...n)}))}})):T.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 D(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 A(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 P=1e3;function U(){return Date.now()/P}const M=function(){const{performance:t}=l;if(!t?.now)return U;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/P}();function L(t){const n=M(),e={sid:A(),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&&B(e,t),e}function B(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||M(),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:A()),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 G(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]=G(r[t],n[t],e-1));return r}const J="_sentrySpan";function Y(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){N&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,J,n):delete t[J]}function z(t){return t[J]}function H(){return A()}function F(){return A().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.T=this.T,t.C=this.C,t.R=this.R,t.i=[...this.i],t.h=[...this.h],t.v={...this.v},t.S={...this.S},t.k=this.k,t.j=this.j,Y(t,z(this)),t}setClient(t){this.k=t}setLastEventId(t){this.j=t}getClient(){return this.k}lastEventId(){return this.j}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.T&&B(this.T,{user:t}),this.D(),this}getUser(){return this.p}setTags(t){return this.l={...this.l,...t},this.D(),this}setTag(t,n){return this.l={...this.l,[t]:n},this.D(),this}setExtras(t){return this.m={...this.m,...t},this.D(),this}setExtra(t,n){return this.m={...this.m,[t]:n},this.D(),this}setFingerprint(t){return this.R=t,this.D(),this}setLevel(t){return this.N=t,this.D(),this}setTransactionName(t){return this.C=t,this.D(),this}setContext(t,n){return null===n?delete this._[t]:this._[t]=n,this.D(),this}setSession(t){return t?this.T=t:delete this.T,this.D(),this}getSession(){return this.T}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.R=u),a&&(this.S=a),this}clear(){return this.u=[],this.l={},this.m={},this.p={},this._={},this.N=void 0,this.C=void 0,this.R=void 0,this.T=void 0,Y(this,void 0),this.h=[],this.setPropagationContext({traceId:H(),sampleRand:Math.random()}),this.D(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:U(),...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.k?.recordDroppedEvent("buffer_overflow","log_item")),this.D(),this}getLastBreadcrumb(){return this.u[this.u.length-1]}clearBreadcrumbs(){return this.u=[],this.D(),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.R||[],eventProcessors:this.i,propagationContext:this.S,sdkProcessingMetadata:this.v,transactionName:this.C,span:z(this)}}setSDKProcessingMetadata(t){return this.v=G(this.v,t,2),this}setPropagationContext(t){return this.S=t,this}getPropagationContext(){return this.S}captureException(t,n){const e=n?.event_id||A();if(!this.k)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.k.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e?.event_id||A();if(!this.k)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.k.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n?.event_id||A();return this.k?(this.k.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}D(){this.t||(this.t=!0,this.o.forEach((t=>{t(this)})),this.t=!1)}}class K{constructor(t,n){let e,r;e=t||new W,r=n||new W,this.I=[{scope:e}],this.O=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.O}getStackTop(){return this.I[this.I.length-1]}A(){const t=this.getScope().clone();return this.I.push({client:this.getClient(),scope:t}),t}P(){return!(this.I.length<=1)&&!!this.I.pop()}}function V(){const t=m(d());return t.stack=t.stack||new K(g("defaultCurrentScope",(()=>new W)),g("defaultIsolationScope",(()=>new W)))}function Z(t){return V().withScope(t)}function q(t,n){const e=V();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Q(t){return V().withScope((()=>t(V().getIsolationScope())))}function X(t){const n=m(t);return n.acs?n.acs:{withIsolationScope:Q,withScope:Z,withSetScope:q,withSetIsolationScope:(t,n)=>Q(n),getCurrentScope:()=>V().getScope(),getIsolationScope:()=>V().getIsolationScope()}}function tt(){return X(d()).getCurrentScope().getClient()}const nt="sentry.source",et="sentry.sample_rate",rt="sentry.previous_trace_sample_rate",ot="sentry.op",st="sentry.origin",it=0,ct=1,ut="_sentryScope",at="_sentryIsolationScope";function ft(t){return{scope:t[ut],isolationScope:t[at]}}const ht="sentry-",pt=/^sentry-/;function lt(t){const n=function(t){if(!t||!_(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=dt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return dt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(pt)){t[n.slice(ht.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function dt(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}const mt=1;function gt(t){const{spanId:n,traceId:e,isRemote:r}=t.spanContext(),o=r?n:vt(t).parent_span_id,s=ft(t).scope;return{parent_span_id:o,span_id:r?s?.getPropagationContext().propagationSpanId||F():n,trace_id:e}}function yt(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===mt,attributes:o,...r}))):void 0}function bt(t){return"number"==typeof t?_t(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?_t(t.getTime()):M()}function _t(t){return t>9999999999?t/1e3:t}function vt(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,parentSpanId:c,status:u,links:a}=t;return{span_id:n,trace_id:e,data:r,description:s,parent_span_id:c,start_timestamp:bt(o),timestamp:bt(i)||void 0,status:wt(u),op:r[ot],origin:r[st],links:yt(a)}}return{span_id:n,trace_id:e,start_timestamp:0,data:{}}}function wt(t){if(t&&t.code!==it)return t.code===ct?"ok":t.message||"unknown_error"}const St="_sentryRootSpan";function $t(t){return t[St]||t}const Et=50,xt="?",Nt=/captureMessage|captureException/;function Tt(t){return t[t.length-1]||{}}const Ct="<anonymous>";const Rt="production",kt="_frozenDsc";function jt(t){const n=tt();if(!n)return{};const e=$t(t),r=vt(e),o=r.data,s=e.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[et]??o[rt];function c(t){return"number"!=typeof i&&"string"!=typeof i||(t.sample_rate=`${i}`),t}const u=e[kt];if(u)return c(u);const a=s?.get("sentry.dsc"),f=a&&lt(a);if(f)return c(f);const h=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o={environment:e.environment||Rt,release:e.release,public_key:r,trace_id:t};return n.emit("createDsc",o),o}(t.spanContext().traceId,n),p=o[nt],l=r.description;return"url"!==p&&l&&(h.transaction=l),function(t){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const n=t||tt()?.getOptions();return!(!n||null==n.tracesSampleRate&&!n.tracesSampler)}()&&(h.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===mt}(e)),h.sample_rand=s?.get("sentry.sample_rand")??ft(e).scope?.getPropagationContext().sampleRand.toString()),c(h),n.emit("createDsc",h,e),h}function Dt(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}`}function It(t,n=100,e=1/0){try{return Ot("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Ot(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 Ot("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=D(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]=Ot(t,n,u-1,r,o),h++}return i(n),f}function At(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 Pt(t,n=[]){return[t,n]}function Ut(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function Mt(t){const n=m(l);return n.encodePolyfill?n.encodePolyfill(t):(new TextEncoder).encode(t)}function Lt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[Mt(r),t]:r.push("string"==typeof t?Mt(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(It(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 Bt={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 Gt(t){if(!t?.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function Jt(t,n,e,r){const o=Gt(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:Dt(r)},...o&&{trace:o}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Pt(i,[[{type:s},t]])}const Yt="__SENTRY_SUPPRESS_TRACING__";function zt(t){const n=X(d());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=X(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({[Yt]:!0}),t())))}var Ht;function Ft(t){return new Wt((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(Ht||(Ht={}));class Wt{constructor(t){this.L=Ht.PENDING,this.B=[],this.G(t)}then(t,n){return new Wt(((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 Wt(((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===Ht.PENDING)return;const t=this.B.slice();this.B=[],t.forEach((t=>{t[0]||(this.L===Ht.RESOLVED&&t[1](this.Y),this.L===Ht.REJECTED&&t[2](this.Y),t[0]=!0)}))}G(t){const n=(t,n)=>{this.L===Ht.PENDING&&(w(n)?n.then(e,r):(this.L=t,this.Y=n,this.J()))},e=t=>{n(Ht.RESOLVED,t)},r=t=>{n(Ht.REJECTED,t)};try{t(e,r)}catch(t){r(t)}}}function Kt(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:gt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:jt(n),...t.sdkProcessingMetadata};const e=$t(n),r=vt(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 Vt="7";const Zt=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=Zt,new Wt(((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 Wt(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{Ft(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}const Qt=6e4;function Xt(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)?Qt:r-n}(i,r):429===n&&(o.all=r+6e4);return o}const tn=64;function nn(t,n,e=qt(t.bufferSize||tn)){let r={};return{send:function(t){const o=[];if(Ut(t,((t,n)=>{const e=function(t){return Bt[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 Ft({});const s=Pt(t[0],o),i=t=>{Ut(s,((t,n)=>{}))};return e.add((()=>n({body:Lt(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=Xt(r,t),t)),(t=>{throw i(),h&&k.error("Encountered error running transport request:",t),t})))).then((t=>t),(t=>{if(t===Zt)return h&&k.error("Skipped sending event because buffer is full."),i(),Ft({});throw t}))},flush:t=>e.drain(t)}}const en=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function rn(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=en.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 on(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 sn=Symbol("AgentBaseInternalState");class cn extends s.Agent{constructor(t){super(t),this[sn]={}}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[sn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[sn].currentSocket;if(this[sn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[sn].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[sn]&&(this[sn].defaultPort=t)}get protocol(){return this[sn].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[sn]&&(this[sn].protocol=t)}}function un(...t){k.log("[https-proxy-agent:parse-proxy-response]",...t)}function an(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 un("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}un("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(),un("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),un("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),s()}))}function fn(...t){k.log("[https-proxy-agent]",...t)}class hn extends cn{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??{},fn("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?ln(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){fn("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 fn("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=an(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",pn),n.secureEndpoint){fn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...ln(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=>{fn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function pn(t){t.resume()}function ln(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}hn.__initStatic();const dn=32768;function mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const gn=n;let yn,bn=0,_n={};function vn(t){gn.debug&&console.log(`[ANR Worker] ${t}`)}var wn,Sn,$n;const En=function(t){let n;try{n=new URL(t.url)}catch(n){return R((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),nn(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 hn(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)=>{zt((()=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>dn&&(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 nn(t,h)}({url:(wn=gn.dsn,Sn=gn.tunnel,$n=gn.sdkMetadata.sdk,Sn||`${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/`}(wn)}?${function(t,n){const e={sentry_version:Vt};return t.publicKey&&(e.sentry_key=t.publicKey),n&&(e.sentry_client=`${n.name}/${n.version}`),new URLSearchParams(e).toString()}(wn,$n)}`)});async function xn(){if(yn){vn("Sending abnormal session"),B(yn,{status:"abnormal",abnormal_mechanism:"anr_foreground",release:gn.release,environment:gn.environment});const t=function(t,n,e,r){const o=Gt(e);return Pt({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:Dt(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(yn,gn.dsn,gn.sdkMetadata,gn.tunnel);vn(JSON.stringify(t)),await En.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function Nn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(Tt(n).function||"")&&n.pop(),n.reverse(),Nt.test(Tt(n).function||"")&&(n.pop(),Nt.test(Tt(n).function||"")&&n.pop()),n.slice(0,Et).map((t=>({...t,filename:t.filename||Tt(n).filename,function:t.function||xt})))}(t);if(gn.appRootPath)for(const t of n)t.filename&&(t.filename=At(t.filename,gn.appRootPath));return n}async function Tn(t,n){if(bn>=gn.maxAnrEvents)return;bn+=1,await xn(),vn("Sending event");const e={event_id:A(),contexts:gn.contexts,release:gn.release,environment:gn.environment,dist:gn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${gn.anrThreshold} ms`,stacktrace:{frames:Nn(t)},mechanism:{type:"ANR"}}]},tags:gn.staticTags};n&&function(t,n){if(Kt(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(_n).length)return;const n=gn.appRootPath?{}:_n;if(gn.appRootPath)for(const[t,e]of Object.entries(_n))n[At(t,gn.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=Jt(e,gn.dsn,gn.sdkMetadata,gn.tunnel);vn(JSON.stringify(r)),await En.send(r),await En.flush(2e3),bn>=gn.maxAnrEvents&&setTimeout((()=>{process.exit(0)}),5e3)}let Cn;if(vn("Started"),gn.captureStackTrace){vn("Connecting to debugger");const n=new t;n.connectToMainThread(),vn("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{vn("Debugger paused");const s=[...t.params.callFrames],i=gn.appRootPath?function(t=(process.argv[1]?rn(process.argv[1]):process.cwd()),n="\\"===o){const e=n?mn(t):t;return t=>{if(!t)return;const o=n?mn(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}}(gn.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||xt,colno:o,lineno:s,in_app:r?on(r):void 0}}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Tn(c).then(null,(()=>{vn("Sending ANR event failed.")}))}),5e3);n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&vn(`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,(()=>{vn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),Cn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Rn}=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()}}}),gn.pollInterval,gn.anrThreshold,(function(){vn("Watchdog timeout"),Cn?(vn("Pausing debugger to capture stack trace"),Cn()):(vn("Capturing event without a stack trace"),Tn().then(null,(()=>{vn("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(yn=L(t.session)),t.debugImages&&(_n=t.debugImages),Rn()}));
@@ -5,16 +5,11 @@ import { generateInstrumentOnce } from '../../otel/instrument.js';
5
5
  import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
6
6
  import { getRequestUrl } from '../../utils/getRequestUrl.js';
7
7
  import { SentryHttpInstrumentation } from './SentryHttpInstrumentation.js';
8
- import { SentryHttpInstrumentationBeforeOtel } from './SentryHttpInstrumentationBeforeOtel.js';
9
8
 
10
9
  const INTEGRATION_NAME = 'Http';
11
10
 
12
11
  const INSTRUMENTATION_NAME = '@opentelemetry_sentry-patched/instrumentation-http';
13
12
 
14
- const instrumentSentryHttpBeforeOtel = generateInstrumentOnce(`${INTEGRATION_NAME}.sentry-before-otel`, () => {
15
- return new SentryHttpInstrumentationBeforeOtel();
16
- });
17
-
18
13
  const instrumentSentryHttp = generateInstrumentOnce(
19
14
  `${INTEGRATION_NAME}.sentry`,
20
15
  options => {
@@ -56,19 +51,6 @@ const httpIntegration = defineIntegration((options = {}) => {
56
51
  return {
57
52
  name: INTEGRATION_NAME,
58
53
  setupOnce() {
59
- // TODO: get rid of this too
60
- // Below, we instrument the Node.js HTTP API three times. 2 times Sentry-specific, 1 time OTEL specific.
61
- // Due to timing reasons, we sometimes need to apply Sentry instrumentation _before_ we apply the OTEL
62
- // instrumentation (e.g. to flush on serverless platforms), and sometimes we need to apply Sentry instrumentation
63
- // _after_ we apply OTEL instrumentation (e.g. for isolation scope handling and breadcrumbs).
64
-
65
- // This is Sentry-specific instrumentation that is applied _before_ any OTEL instrumentation.
66
- if (process.env.VERCEL) {
67
- // Currently this instrumentation only does something when deployed on Vercel, so to save some overhead, we short circuit adding it here only for Vercel.
68
- // If it's functionality is extended in the future, feel free to remove the if statement and this comment.
69
- instrumentSentryHttpBeforeOtel();
70
- }
71
-
72
54
  const instrumentSpans = _shouldInstrumentSpans(options, getClient()?.getOptions());
73
55
 
74
56
  // This is Sentry-specific instrumentation for request isolation and breadcrumbs
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/integrations/http/index.ts"],"sourcesContent":["import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';\nimport { diag } from '@opentelemetry/api';\nimport type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http';\nimport type { Span } from '@sentry/core';\nimport { defineIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport type { NodeClient } from '../../sdk/client';\nimport type { HTTPModuleRequestIncomingMessage } from '../../transports/http-module';\nimport type { NodeClientOptions } from '../../types';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\nimport { getRequestUrl } from '../../utils/getRequestUrl';\nimport type { SentryHttpInstrumentationOptions } from './SentryHttpInstrumentation';\nimport { SentryHttpInstrumentation } from './SentryHttpInstrumentation';\nimport { SentryHttpInstrumentationBeforeOtel } from './SentryHttpInstrumentationBeforeOtel';\n\nconst INTEGRATION_NAME = 'Http';\n\nconst INSTRUMENTATION_NAME = '@opentelemetry_sentry-patched/instrumentation-http';\n\ninterface HttpOptions {\n /**\n * Whether breadcrumbs should be recorded for outgoing requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default HttpInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for request isolation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether the integration should create [Sessions](https://docs.sentry.io/product/releases/health/#sessions) for incoming requests to track the health and crash-free rate of your releases in Sentry.\n * Read more about Release Health: https://docs.sentry.io/product/releases/health/\n *\n * Defaults to `true`.\n */\n trackIncomingRequestsAsSessions?: boolean;\n\n /**\n * Number of milliseconds until sessions tracked with `trackIncomingRequestsAsSessions` will be flushed as a session aggregate.\n *\n * Defaults to `60000` (60s).\n */\n sessionFlushingDelayMS?: number;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n *\n * The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.\n * For example: `'https://someService.com/users/details?id=123'`\n *\n * The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.\n * You can use it to filter on additional properties like method, headers, etc.\n */\n ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;\n\n /**\n * Do not capture spans for incoming HTTP requests to URLs where the given callback returns `true`.\n * Spans will be non recording if tracing is disabled.\n *\n * The `urlPath` param consists of the URL path and query string (if any) of the incoming request.\n * For example: `'/users/details?id=123'`\n *\n * The `request` param contains the original {@type IncomingMessage} object of the incoming request.\n * You can use it to filter on additional properties like method, headers, etc.\n */\n ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;\n\n /**\n * Do not capture spans for incoming HTTP requests with the given status codes.\n * By default, spans with 404 status code are ignored.\n * Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes.\n *\n * @default `[404]`\n */\n dropSpansForIncomingRequestStatusCodes?: (number | [number, number])[];\n\n /**\n * Do not capture the request body for incoming HTTP requests to URLs where the given callback returns `true`.\n * This can be useful for long running requests where the body is not needed and we want to avoid capturing it.\n *\n * @param url Contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.\n * @param request Contains the {@type RequestOptions} object used to make the outgoing request.\n */\n ignoreIncomingRequestBody?: (url: string, request: RequestOptions) => boolean;\n\n /**\n * If true, do not generate spans for incoming requests at all.\n * This is used by Remix to avoid generating spans for incoming requests, as it generates its own spans.\n */\n disableIncomingRequestSpans?: boolean;\n\n /**\n * Additional instrumentation options that are passed to the underlying HttpInstrumentation.\n */\n instrumentation?: {\n requestHook?: (span: Span, req: ClientRequest | HTTPModuleRequestIncomingMessage) => void;\n responseHook?: (span: Span, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;\n applyCustomAttributesOnSpan?: (\n span: Span,\n request: ClientRequest | HTTPModuleRequestIncomingMessage,\n response: HTTPModuleRequestIncomingMessage | ServerResponse,\n ) => void;\n\n /**\n * You can pass any configuration through to the underlying instrumentation.\n * Note that there are no semver guarantees for this!\n */\n _experimentalConfig?: ConstructorParameters<typeof HttpInstrumentation>[0];\n };\n}\n\nconst instrumentSentryHttpBeforeOtel = generateInstrumentOnce(`${INTEGRATION_NAME}.sentry-before-otel`, () => {\n return new SentryHttpInstrumentationBeforeOtel();\n});\n\nconst instrumentSentryHttp = generateInstrumentOnce<SentryHttpInstrumentationOptions>(\n `${INTEGRATION_NAME}.sentry`,\n options => {\n return new SentryHttpInstrumentation(options);\n },\n);\n\nexport const instrumentOtelHttp = generateInstrumentOnce<HttpInstrumentationConfig>(INTEGRATION_NAME, config => {\n const instrumentation = new HttpInstrumentation(config);\n\n // We want to update the logger namespace so we can better identify what is happening here\n try {\n instrumentation['_diag'] = diag.createComponentLogger({\n namespace: INSTRUMENTATION_NAME,\n });\n // @ts-expect-error We are writing a read-only property here...\n instrumentation.instrumentationName = INSTRUMENTATION_NAME;\n } catch {\n // ignore errors here...\n }\n\n return instrumentation;\n});\n\n/** Exported only for tests. */\nexport function _shouldInstrumentSpans(options: HttpOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean {\n // If `spans` is passed in, it takes precedence\n // Else, we by default emit spans, unless `skipOpenTelemetrySetup` is set to `true`\n return typeof options.spans === 'boolean' ? options.spans : !clientOptions.skipOpenTelemetrySetup;\n}\n\n/**\n * The http integration instruments Node's internal http and https modules.\n * It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span.\n */\nexport const httpIntegration = defineIntegration((options: HttpOptions = {}) => {\n const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [404];\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // TODO: get rid of this too\n // Below, we instrument the Node.js HTTP API three times. 2 times Sentry-specific, 1 time OTEL specific.\n // Due to timing reasons, we sometimes need to apply Sentry instrumentation _before_ we apply the OTEL\n // instrumentation (e.g. to flush on serverless platforms), and sometimes we need to apply Sentry instrumentation\n // _after_ we apply OTEL instrumentation (e.g. for isolation scope handling and breadcrumbs).\n\n // This is Sentry-specific instrumentation that is applied _before_ any OTEL instrumentation.\n if (process.env.VERCEL) {\n // Currently this instrumentation only does something when deployed on Vercel, so to save some overhead, we short circuit adding it here only for Vercel.\n // If it's functionality is extended in the future, feel free to remove the if statement and this comment.\n instrumentSentryHttpBeforeOtel();\n }\n\n const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());\n\n // This is Sentry-specific instrumentation for request isolation and breadcrumbs\n instrumentSentryHttp({\n ...options,\n // If spans are not instrumented, it means the HttpInstrumentation has not been added\n // In that case, we want to handle incoming trace extraction ourselves\n extractIncomingTraceFromHeader: !instrumentSpans,\n });\n\n // This is the \"regular\" OTEL instrumentation that emits spans\n if (instrumentSpans) {\n const instrumentationConfig = getConfigWithDefaults(options);\n instrumentOtelHttp(instrumentationConfig);\n }\n },\n processEvent(event) {\n // Drop transaction if it has a status code that should be ignored\n if (event.type === 'transaction') {\n const statusCode = event.contexts?.trace?.data?.['http.response.status_code'];\n if (\n typeof statusCode === 'number' &&\n dropSpansForIncomingRequestStatusCodes.some(code => {\n if (typeof code === 'number') {\n return code === statusCode;\n }\n\n const [min, max] = code;\n return statusCode >= min && statusCode <= max;\n })\n ) {\n return null;\n }\n }\n\n return event;\n },\n };\n});\n\n/**\n * Determines if @param req is a ClientRequest, meaning the request was created within the express app\n * and it's an outgoing request.\n * Checking for properties instead of using `instanceOf` to avoid importing the request classes.\n */\nfunction _isClientRequest(req: ClientRequest | HTTPModuleRequestIncomingMessage): req is ClientRequest {\n return 'outputData' in req && 'outputSize' in req && !('client' in req) && !('statusCode' in req);\n}\n\n/**\n * Detects if an incoming request is a prefetch request.\n */\nfunction isKnownPrefetchRequest(req: HTTPModuleRequestIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getConfigWithDefaults(options: Partial<HttpOptions> = {}): HttpInstrumentationConfig {\n const instrumentationConfig = {\n ...options.instrumentation?._experimentalConfig,\n\n disableIncomingRequestInstrumentation: options.disableIncomingRequestSpans,\n\n ignoreOutgoingRequestHook: request => {\n const url = getRequestUrl(request);\n\n if (!url) {\n return false;\n }\n\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n if (_ignoreOutgoingRequests?.(url, request)) {\n return true;\n }\n\n return false;\n },\n\n ignoreIncomingRequestHook: request => {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as transactions\n if (method === 'OPTIONS' || method === 'HEAD') {\n return true;\n }\n\n const _ignoreIncomingRequests = options.ignoreIncomingRequests;\n if (urlPath && _ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n },\n\n requireParentforOutgoingSpans: false,\n requireParentforIncomingSpans: false,\n requestHook: (span, req) => {\n addOriginToSpan(span, 'auto.http.otel.http');\n if (!_isClientRequest(req) && isKnownPrefetchRequest(req)) {\n span.setAttribute('sentry.http.prefetch', true);\n }\n\n options.instrumentation?.requestHook?.(span, req);\n },\n responseHook: (span, res) => {\n options.instrumentation?.responseHook?.(span, res);\n },\n applyCustomAttributesOnSpan: (\n span: Span,\n request: ClientRequest | HTTPModuleRequestIncomingMessage,\n response: HTTPModuleRequestIncomingMessage | ServerResponse,\n ) => {\n options.instrumentation?.applyCustomAttributesOnSpan?.(span, request, response);\n },\n } satisfies HttpInstrumentationConfig;\n\n return instrumentationConfig;\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,gBAAA,GAAmB,MAAM;;AAE/B,MAAM,oBAAA,GAAuB,oDAAoD;;AAqGjF,MAAM,8BAA+B,GAAE,sBAAsB,CAAC,CAAC,EAAA,gBAAA,CAAA,mBAAA,CAAA,EAAA,MAAA;AACA,EAAA,OAAA,IAAA,mCAAA,EAAA;AACA,CAAA,CAAA;;AAEA,MAAA,oBAAA,GAAA,sBAAA;AACA,EAAA,CAAA,EAAA,gBAAA,CAAA,OAAA,CAAA;AACA,EAAA,OAAA,IAAA;AACA,IAAA,OAAA,IAAA,yBAAA,CAAA,OAAA,CAAA;AACA,GAAA;AACA,CAAA;;AAEA,MAAA,kBAAA,GAAA,sBAAA,CAAA,gBAAA,EAAA,MAAA,IAAA;AACA,EAAA,MAAA,eAAA,GAAA,IAAA,mBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,EAAA,IAAA;AACA,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,IAAA,CAAA,qBAAA,CAAA;AACA,MAAA,SAAA,EAAA,oBAAA;AACA,KAAA,CAAA;AACA;AACA,IAAA,eAAA,CAAA,mBAAA,GAAA,oBAAA;AACA,GAAA,CAAA,MAAA;AACA;AACA;;AAEA,EAAA,OAAA,eAAA;AACA,CAAA;;AAEA;AACA,SAAA,sBAAA,CAAA,OAAA,EAAA,aAAA,GAAA,EAAA,EAAA;AACA;AACA;AACA,EAAA,OAAA,OAAA,OAAA,C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,OAAA,IAAA;AACA;;AAEA,MAAA,MAAA,uBAAA,GAAA,OAAA,CAAA,sBAAA;AACA,MAAA,IAAA,OAAA,IAAA,uBAAA,GAAA,OAAA,EAAA,OAAA,CAAA,EAAA;AACA,QAAA,OAAA,IAAA;AACA;;AAEA,MAAA,OAAA,KAAA;AACA,KAAA;;AAEA,IAAA,6BAAA,EAAA,KAAA;AACA,IAAA,6BAAA,EAAA,KAAA;AACA,IAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,KAAA;AACA,MAAA,eAAA,CAAA,IAAA,EAAA,qBAAA,CAAA;AACA,MAAA,IAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,IAAA,sBAAA,CAAA,GAAA,CAAA,EAAA;AACA,QAAA,IAAA,CAAA,YAAA,CAAA,sBAAA,EAAA,IAAA,CAAA;AACA;;AAEA,MAAA,OAAA,CAAA,eAAA,EAAA,WAAA,GAAA,IAAA,EAAA,GAAA,CAAA;AACA,KAAA;AACA,IAAA,YAAA,EAAA,CAAA,IAAA,EAAA,GAAA,KAAA;AACA,MAAA,OAAA,CAAA,eAAA,EAAA,YAAA,GAAA,IAAA,EAAA,GAAA,CAAA;AACA,KAAA;AACA,IAAA,2BAAA,EAAA;AACA,MAAA,IAAA;AACA,MAAA,OAAA;AACA,MAAA,QAAA;AACA,SAAA;AACA,MAAA,OAAA,CAAA,eAAA,EAAA,2BAAA,GAAA,IAAA,EAAA,OAAA,EAAA,QAAA,CAAA;AACA,KAAA;AACA,GAAA;;AAEA,EAAA,OAAA,qBAAA;AACA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/integrations/http/index.ts"],"sourcesContent":["import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';\nimport { diag } from '@opentelemetry/api';\nimport type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http';\nimport type { Span } from '@sentry/core';\nimport { defineIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport type { NodeClient } from '../../sdk/client';\nimport type { HTTPModuleRequestIncomingMessage } from '../../transports/http-module';\nimport type { NodeClientOptions } from '../../types';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\nimport { getRequestUrl } from '../../utils/getRequestUrl';\nimport type { SentryHttpInstrumentationOptions } from './SentryHttpInstrumentation';\nimport { SentryHttpInstrumentation } from './SentryHttpInstrumentation';\n\nconst INTEGRATION_NAME = 'Http';\n\nconst INSTRUMENTATION_NAME = '@opentelemetry_sentry-patched/instrumentation-http';\n\ninterface HttpOptions {\n /**\n * Whether breadcrumbs should be recorded for outgoing requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default HttpInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for request isolation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether the integration should create [Sessions](https://docs.sentry.io/product/releases/health/#sessions) for incoming requests to track the health and crash-free rate of your releases in Sentry.\n * Read more about Release Health: https://docs.sentry.io/product/releases/health/\n *\n * Defaults to `true`.\n */\n trackIncomingRequestsAsSessions?: boolean;\n\n /**\n * Number of milliseconds until sessions tracked with `trackIncomingRequestsAsSessions` will be flushed as a session aggregate.\n *\n * Defaults to `60000` (60s).\n */\n sessionFlushingDelayMS?: number;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n *\n * The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.\n * For example: `'https://someService.com/users/details?id=123'`\n *\n * The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.\n * You can use it to filter on additional properties like method, headers, etc.\n */\n ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;\n\n /**\n * Do not capture spans for incoming HTTP requests to URLs where the given callback returns `true`.\n * Spans will be non recording if tracing is disabled.\n *\n * The `urlPath` param consists of the URL path and query string (if any) of the incoming request.\n * For example: `'/users/details?id=123'`\n *\n * The `request` param contains the original {@type IncomingMessage} object of the incoming request.\n * You can use it to filter on additional properties like method, headers, etc.\n */\n ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;\n\n /**\n * Do not capture spans for incoming HTTP requests with the given status codes.\n * By default, spans with 404 status code are ignored.\n * Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes.\n *\n * @default `[404]`\n */\n dropSpansForIncomingRequestStatusCodes?: (number | [number, number])[];\n\n /**\n * Do not capture the request body for incoming HTTP requests to URLs where the given callback returns `true`.\n * This can be useful for long running requests where the body is not needed and we want to avoid capturing it.\n *\n * @param url Contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.\n * @param request Contains the {@type RequestOptions} object used to make the outgoing request.\n */\n ignoreIncomingRequestBody?: (url: string, request: RequestOptions) => boolean;\n\n /**\n * If true, do not generate spans for incoming requests at all.\n * This is used by Remix to avoid generating spans for incoming requests, as it generates its own spans.\n */\n disableIncomingRequestSpans?: boolean;\n\n /**\n * Additional instrumentation options that are passed to the underlying HttpInstrumentation.\n */\n instrumentation?: {\n requestHook?: (span: Span, req: ClientRequest | HTTPModuleRequestIncomingMessage) => void;\n responseHook?: (span: Span, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;\n applyCustomAttributesOnSpan?: (\n span: Span,\n request: ClientRequest | HTTPModuleRequestIncomingMessage,\n response: HTTPModuleRequestIncomingMessage | ServerResponse,\n ) => void;\n\n /**\n * You can pass any configuration through to the underlying instrumentation.\n * Note that there are no semver guarantees for this!\n */\n _experimentalConfig?: ConstructorParameters<typeof HttpInstrumentation>[0];\n };\n}\n\nconst instrumentSentryHttp = generateInstrumentOnce<SentryHttpInstrumentationOptions>(\n `${INTEGRATION_NAME}.sentry`,\n options => {\n return new SentryHttpInstrumentation(options);\n },\n);\n\nexport const instrumentOtelHttp = generateInstrumentOnce<HttpInstrumentationConfig>(INTEGRATION_NAME, config => {\n const instrumentation = new HttpInstrumentation(config);\n\n // We want to update the logger namespace so we can better identify what is happening here\n try {\n instrumentation['_diag'] = diag.createComponentLogger({\n namespace: INSTRUMENTATION_NAME,\n });\n // @ts-expect-error We are writing a read-only property here...\n instrumentation.instrumentationName = INSTRUMENTATION_NAME;\n } catch {\n // ignore errors here...\n }\n\n return instrumentation;\n});\n\n/** Exported only for tests. */\nexport function _shouldInstrumentSpans(options: HttpOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean {\n // If `spans` is passed in, it takes precedence\n // Else, we by default emit spans, unless `skipOpenTelemetrySetup` is set to `true`\n return typeof options.spans === 'boolean' ? options.spans : !clientOptions.skipOpenTelemetrySetup;\n}\n\n/**\n * The http integration instruments Node's internal http and https modules.\n * It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span.\n */\nexport const httpIntegration = defineIntegration((options: HttpOptions = {}) => {\n const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [404];\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());\n\n // This is Sentry-specific instrumentation for request isolation and breadcrumbs\n instrumentSentryHttp({\n ...options,\n // If spans are not instrumented, it means the HttpInstrumentation has not been added\n // In that case, we want to handle incoming trace extraction ourselves\n extractIncomingTraceFromHeader: !instrumentSpans,\n });\n\n // This is the \"regular\" OTEL instrumentation that emits spans\n if (instrumentSpans) {\n const instrumentationConfig = getConfigWithDefaults(options);\n instrumentOtelHttp(instrumentationConfig);\n }\n },\n processEvent(event) {\n // Drop transaction if it has a status code that should be ignored\n if (event.type === 'transaction') {\n const statusCode = event.contexts?.trace?.data?.['http.response.status_code'];\n if (\n typeof statusCode === 'number' &&\n dropSpansForIncomingRequestStatusCodes.some(code => {\n if (typeof code === 'number') {\n return code === statusCode;\n }\n\n const [min, max] = code;\n return statusCode >= min && statusCode <= max;\n })\n ) {\n return null;\n }\n }\n\n return event;\n },\n };\n});\n\n/**\n * Determines if @param req is a ClientRequest, meaning the request was created within the express app\n * and it's an outgoing request.\n * Checking for properties instead of using `instanceOf` to avoid importing the request classes.\n */\nfunction _isClientRequest(req: ClientRequest | HTTPModuleRequestIncomingMessage): req is ClientRequest {\n return 'outputData' in req && 'outputSize' in req && !('client' in req) && !('statusCode' in req);\n}\n\n/**\n * Detects if an incoming request is a prefetch request.\n */\nfunction isKnownPrefetchRequest(req: HTTPModuleRequestIncomingMessage): boolean {\n // Currently only handles Next.js prefetch requests but may check other frameworks in the future.\n return req.headers['next-router-prefetch'] === '1';\n}\n\nfunction getConfigWithDefaults(options: Partial<HttpOptions> = {}): HttpInstrumentationConfig {\n const instrumentationConfig = {\n ...options.instrumentation?._experimentalConfig,\n\n disableIncomingRequestInstrumentation: options.disableIncomingRequestSpans,\n\n ignoreOutgoingRequestHook: request => {\n const url = getRequestUrl(request);\n\n if (!url) {\n return false;\n }\n\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n if (_ignoreOutgoingRequests?.(url, request)) {\n return true;\n }\n\n return false;\n },\n\n ignoreIncomingRequestHook: request => {\n // request.url is the only property that holds any information about the url\n // it only consists of the URL path and query string (if any)\n const urlPath = request.url;\n\n const method = request.method?.toUpperCase();\n // We do not capture OPTIONS/HEAD requests as transactions\n if (method === 'OPTIONS' || method === 'HEAD') {\n return true;\n }\n\n const _ignoreIncomingRequests = options.ignoreIncomingRequests;\n if (urlPath && _ignoreIncomingRequests?.(urlPath, request)) {\n return true;\n }\n\n return false;\n },\n\n requireParentforOutgoingSpans: false,\n requireParentforIncomingSpans: false,\n requestHook: (span, req) => {\n addOriginToSpan(span, 'auto.http.otel.http');\n if (!_isClientRequest(req) && isKnownPrefetchRequest(req)) {\n span.setAttribute('sentry.http.prefetch', true);\n }\n\n options.instrumentation?.requestHook?.(span, req);\n },\n responseHook: (span, res) => {\n options.instrumentation?.responseHook?.(span, res);\n },\n applyCustomAttributesOnSpan: (\n span: Span,\n request: ClientRequest | HTTPModuleRequestIncomingMessage,\n response: HTTPModuleRequestIncomingMessage | ServerResponse,\n ) => {\n options.instrumentation?.applyCustomAttributesOnSpan?.(span, request, response);\n },\n } satisfies HttpInstrumentationConfig;\n\n return instrumentationConfig;\n}\n"],"names":[],"mappings":";;;;;;;;AAeA,MAAM,gBAAA,GAAmB,MAAM;;AAE/B,MAAM,oBAAA,GAAuB,oDAAoD;;AAqGjF,MAAM,oBAAA,GAAuB,sBAAsB;AACnD,EAAE,CAAC,EAAA,gBAAA,CAAA,OAAA,CAAA;AACA,EAAA,OAAA,IAAA;AACA,IAAA,OAAA,IAAA,yBAAA,CAAA,OAAA,CAAA;AACA,GAAA;AACA,CAAA;;AAEA,MAAA,kBAAA,GAAA,sBAAA,CAAA,gBAAA,EAAA,MAAA,IAAA;AACA,EAAA,MAAA,eAAA,GAAA,IAAA,mBAAA,CAAA,MAAA,CAAA;;AAEA;AACA,EAAA,IAAA;AACA,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,IAAA,CAAA,qBAAA,CAAA;AACA,MAAA,SAAA,EAAA,oBAAA;AACA,KAAA,CAAA;AACA;AACA,IAAA,eAAA,CAAA,mBAAA,GAAA,oBAAA;AACA,GAAA,CAAA,MAAA;AACA;AACA;;AAEA,EAAA,OAAA,eAAA;AACA,CAAA;;AAEA;AACA,SAAA,sBAAA,CAAA,OAAA,EAAA,aAAA,GAAA,EAAA,EAAA;AACA;AACA;AACA,EAAA,OAAA,OAAA,OAAA,CAAA,KAAA,KAAA,SAAA,GAAA,OAAA,CAAA,KAAA,GAAA,CAAA,aAAA,CAAA,sBAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAA,eAAA,GAAA,iBAAA,CAAA,CAAA,OAAA,GAAA,EAAA,KAAA;AACA,EAAA,MAAA,sCAAA,GAAA,OAAA,CAAA,sCAAA,IAAA,CA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A,qBAAA,CAAA;AACA,MAAA,IAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,IAAA,sBAAA,CAAA,GAAA,CAAA,EAAA;AACA,QAAA,IAAA,CAAA,YAAA,CAAA,sBAAA,EAAA,IAAA,CAAA;AACA;;AAEA,MAAA,OAAA,CAAA,eAAA,EAAA,WAAA,GAAA,IAAA,EAAA,GAAA,CAAA;AACA,KAAA;AACA,IAAA,YAAA,EAAA,CAAA,IAAA,EAAA,GAAA,KAAA;AACA,MAAA,OAAA,CAAA,eAAA,EAAA,YAAA,GAAA,IAAA,EAAA,GAAA,CAAA;AACA,KAAA;AACA,IAAA,2BAAA,EAAA;AACA,MAAA,IAAA;AACA,MAAA,OAAA;AACA,MAAA,QAAA;AACA,SAAA;AACA,MAAA,OAAA,CAAA,eAAA,EAAA,2BAAA,GAAA,IAAA,EAAA,OAAA,EAAA,QAAA,CAAA;AACA,KAAA;AACA,GAAA;;AAEA,EAAA,OAAA,qBAAA;AACA;;;;"}
@@ -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 = 'LyohIEBzZW50cnkvbm9kZSA5LjE2LjAgKGFhYWE5YWIpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPSI5LjE2LjAiLG89Z2xvYmFsVGhpcztjb25zdCBpPSJ1bmRlZmluZWQiPT10eXBlb2YgX19TRU5UUllfREVCVUdfX3x8X19TRU5UUllfREVCVUdfXyxhPVsiZGVidWciLCJpbmZvIiwid2FybiIsImVycm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JEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOm8/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.16.0 (aaaa9ab) | 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="9.16.0",o=globalThis;const i="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,a=["debug","info","warn","error","log","assert","trace"],s={};function c(e){if(!("console"in o))return e();const t=o.console,n={},i=Object.keys(s);i.forEach((e=>{const o=s[e];n[e]=t[e],t[e]=o}));try{return e()}finally{i.forEach((e=>{t[e]=n[e]}))}}!function(e,t,i=o){const a=i.__SENTRY__=i.__SENTRY__||{},s=a[n]=a[n]||{};s[e]||(s[e]=t())}("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return i?a.forEach((n=>{t[n]=(...t)=>{e&&c((()=>{o.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);
1
+ /*! @sentry/node 9.16.1 (1603866) | 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="9.16.1",o=globalThis;const i="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,a=["debug","info","warn","error","log","assert","trace"],s={};function c(e){if(!("console"in o))return e();const t=o.console,n={},i=Object.keys(s);i.forEach((e=>{const o=s[e];n[e]=t[e],t[e]=o}));try{return e()}finally{i.forEach((e=>{t[e]=n[e]}))}}!function(e,t,i=o){const a=i.__SENTRY__=i.__SENTRY__||{},s=a[n]=a[n]||{};s[e]||(s[e]=t())}("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return i?a.forEach((n=>{t[n]=(...t)=>{e&&c((()=>{o.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);
@@ -1 +1 @@
1
- {"type":"module","version":"9.16.0","sideEffects":false}
1
+ {"type":"module","version":"9.16.1","sideEffects":false}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/http/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAWr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CAAC,EAAE,CAAC;IAEvE;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAE9E;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,GAAG,gCAAgC,KAAK,IAAI,CAAC;QAC1F,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,gCAAgC,GAAG,cAAc,KAAK,IAAI,CAAC;QACjG,2BAA2B,CAAC,EAAE,CAC5B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,GAAG,gCAAgC,EACzD,QAAQ,EAAE,gCAAgC,GAAG,cAAc,KACxD,IAAI,CAAC;QAEV;;;WAGG;QACH,mBAAmB,CAAC,EAAE,qBAAqB,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5E,CAAC;CACH;AASD,eAAO,MAAM,kBAAkB;;CAe7B,CAAC;AAEH,+BAA+B;AAC/B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAAG,OAAO,CAIpH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,2EA4C1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "9.16.0",
3
+ "version": "9.16.1",
4
4
  "description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
@@ -96,8 +96,8 @@
96
96
  "@opentelemetry/sdk-trace-base": "^1.30.1",
97
97
  "@opentelemetry/semantic-conventions": "^1.30.0",
98
98
  "@prisma/instrumentation": "6.7.0",
99
- "@sentry/core": "9.16.0",
100
- "@sentry/opentelemetry": "9.16.0",
99
+ "@sentry/core": "9.16.1",
100
+ "@sentry/opentelemetry": "9.16.1",
101
101
  "import-in-the-middle": "^1.13.0"
102
102
  },
103
103
  "devDependencies": {
@@ -1,136 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@opentelemetry/core');
4
- const instrumentation = require('@opentelemetry/instrumentation');
5
- const core$1 = require('@sentry/core');
6
- const debugBuild = require('../../debug-build.js');
7
- const utils = require('./utils.js');
8
-
9
- // The reason this "before OTEL" integration even exists is due to timing reasons. We need to be able to register a
10
- // `res.on('close')` handler **after** OTEL registers its own handler (which it uses to end spans), so that we can do
11
- // something (ie. flush) after OTEL has ended a span for a request. If you think about it like an onion:
12
- //
13
- // (Sentry after OTEL instrumentation
14
- // (OTEL instrumentation
15
- // (Sentry before OTEL instrumentation
16
- // (orig HTTP request handler))))
17
- //
18
- // registering an instrumentation before OTEL allows us to do this for incoming requests.
19
-
20
- /**
21
- * A Sentry specific http instrumentation that is applied before the otel instrumentation.
22
- */
23
- class SentryHttpInstrumentationBeforeOtel extends instrumentation.InstrumentationBase {
24
- constructor() {
25
- super('@sentry/instrumentation-http-before-otel', core.VERSION, {});
26
- }
27
-
28
- // eslint-disable-next-line jsdoc/require-jsdoc
29
- init() {
30
- return [this._getHttpsInstrumentation(), this._getHttpInstrumentation()];
31
- }
32
-
33
- /** Get the instrumentation for the http module. */
34
- _getHttpInstrumentation() {
35
- return new instrumentation.InstrumentationNodeModuleDefinition('http', ['*'], (moduleExports) => {
36
- // Patch incoming requests
37
- utils.stealthWrap(moduleExports.Server.prototype, 'emit', this._getPatchIncomingRequestFunction());
38
-
39
- return moduleExports;
40
- });
41
- }
42
-
43
- /** Get the instrumentation for the https module. */
44
- _getHttpsInstrumentation() {
45
- return new instrumentation.InstrumentationNodeModuleDefinition('https', ['*'], (moduleExports) => {
46
- // Patch incoming requests
47
- utils.stealthWrap(moduleExports.Server.prototype, 'emit', this._getPatchIncomingRequestFunction());
48
-
49
- return moduleExports;
50
- });
51
- }
52
-
53
- /**
54
- * Patch the incoming request function for request isolation.
55
- */
56
- _getPatchIncomingRequestFunction()
57
-
58
- {
59
- return (
60
- original,
61
- ) => {
62
- return function incomingRequest( ...args) {
63
- // Only traces request events
64
- if (args[0] !== 'request') {
65
- return original.apply(this, args);
66
- }
67
-
68
- const response = args[2] ;
69
- patchResponseToFlushOnServerlessPlatforms(response);
70
-
71
- return original.apply(this, args);
72
- };
73
- };
74
- }
75
- }
76
-
77
- function patchResponseToFlushOnServerlessPlatforms(res) {
78
- // Freely extend this function with other platforms if necessary
79
- if (process.env.VERCEL) {
80
- debugBuild.DEBUG_BUILD && core$1.logger.log('Patching response to flush on Vercel');
81
-
82
- // In some cases res.end does not seem to be defined leading to errors if passed to Proxy
83
- // https://github.com/getsentry/sentry-javascript/issues/15759
84
- if (typeof res.end !== 'function') {
85
- debugBuild.DEBUG_BUILD && core$1.logger.warn('res.end is not a function, skipping patch...');
86
- return;
87
- }
88
-
89
- let markOnEndDone = () => undefined;
90
- const onEndDonePromise = new Promise(res => {
91
- markOnEndDone = res;
92
- });
93
-
94
- res.on('close', () => {
95
- markOnEndDone();
96
- });
97
-
98
- core$1.logger.log('Patching res.end()');
99
-
100
- // eslint-disable-next-line @typescript-eslint/unbound-method
101
- res.end = new Proxy(res.end, {
102
- apply(target, thisArg, argArray) {
103
- core$1.vercelWaitUntil(
104
- new Promise(finishWaitUntil => {
105
- // Define a timeout that unblocks the lambda just to be safe so we're not indefinitely keeping it alive, exploding server bills
106
- const timeout = setTimeout(() => {
107
- finishWaitUntil();
108
- }, 2000);
109
-
110
- onEndDonePromise
111
- .then(() => {
112
- debugBuild.DEBUG_BUILD && core$1.logger.log('Flushing events before Vercel Lambda freeze');
113
- return core$1.flush(2000);
114
- })
115
- .then(
116
- () => {
117
- clearTimeout(timeout);
118
- finishWaitUntil();
119
- },
120
- e => {
121
- clearTimeout(timeout);
122
- debugBuild.DEBUG_BUILD && core$1.logger.log('Error while flushing events for Vercel:\n', e);
123
- finishWaitUntil();
124
- },
125
- );
126
- }),
127
- );
128
-
129
- return target.apply(thisArg, argArray);
130
- },
131
- });
132
- }
133
- }
134
-
135
- exports.SentryHttpInstrumentationBeforeOtel = SentryHttpInstrumentationBeforeOtel;
136
- //# sourceMappingURL=SentryHttpInstrumentationBeforeOtel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SentryHttpInstrumentationBeforeOtel.js","sources":["../../../../src/integrations/http/SentryHttpInstrumentationBeforeOtel.ts"],"sourcesContent":["import type * as http from 'node:http';\nimport type * as https from 'node:https';\nimport { VERSION } from '@opentelemetry/core';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { flush, logger, vercelWaitUntil } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { stealthWrap } from './utils';\n\ntype Http = typeof http;\ntype Https = typeof https;\n\n// The reason this \"before OTEL\" integration even exists is due to timing reasons. We need to be able to register a\n// `res.on('close')` handler **after** OTEL registers its own handler (which it uses to end spans), so that we can do\n// something (ie. flush) after OTEL has ended a span for a request. If you think about it like an onion:\n//\n// (Sentry after OTEL instrumentation\n// (OTEL instrumentation\n// (Sentry before OTEL instrumentation\n// (orig HTTP request handler))))\n//\n// registering an instrumentation before OTEL allows us to do this for incoming requests.\n\n/**\n * A Sentry specific http instrumentation that is applied before the otel instrumentation.\n */\nexport class SentryHttpInstrumentationBeforeOtel extends InstrumentationBase {\n public constructor() {\n super('@sentry/instrumentation-http-before-otel', VERSION, {});\n }\n\n // eslint-disable-next-line jsdoc/require-jsdoc\n public init(): [InstrumentationNodeModuleDefinition, InstrumentationNodeModuleDefinition] {\n return [this._getHttpsInstrumentation(), this._getHttpInstrumentation()];\n }\n\n /** Get the instrumentation for the http module. */\n private _getHttpInstrumentation(): InstrumentationNodeModuleDefinition {\n return new InstrumentationNodeModuleDefinition('http', ['*'], (moduleExports: Http): Http => {\n // Patch incoming requests\n stealthWrap(moduleExports.Server.prototype, 'emit', this._getPatchIncomingRequestFunction());\n\n return moduleExports;\n });\n }\n\n /** Get the instrumentation for the https module. */\n private _getHttpsInstrumentation(): InstrumentationNodeModuleDefinition {\n return new InstrumentationNodeModuleDefinition('https', ['*'], (moduleExports: Https): Https => {\n // Patch incoming requests\n stealthWrap(moduleExports.Server.prototype, 'emit', this._getPatchIncomingRequestFunction());\n\n return moduleExports;\n });\n }\n\n /**\n * Patch the incoming request function for request isolation.\n */\n private _getPatchIncomingRequestFunction(): (\n original: (event: string, ...args: unknown[]) => boolean,\n ) => (this: unknown, event: string, ...args: unknown[]) => boolean {\n return (\n original: (event: string, ...args: unknown[]) => boolean,\n ): ((this: unknown, event: string, ...args: unknown[]) => boolean) => {\n return function incomingRequest(this: unknown, ...args: [event: string, ...args: unknown[]]): boolean {\n // Only traces request events\n if (args[0] !== 'request') {\n return original.apply(this, args);\n }\n\n const response = args[2] as http.OutgoingMessage;\n patchResponseToFlushOnServerlessPlatforms(response);\n\n return original.apply(this, args);\n };\n };\n }\n}\n\nfunction patchResponseToFlushOnServerlessPlatforms(res: http.OutgoingMessage): void {\n // Freely extend this function with other platforms if necessary\n if (process.env.VERCEL) {\n DEBUG_BUILD && logger.log('Patching response to flush on Vercel');\n\n // In some cases res.end does not seem to be defined leading to errors if passed to Proxy\n // https://github.com/getsentry/sentry-javascript/issues/15759\n if (typeof res.end !== 'function') {\n DEBUG_BUILD && logger.warn('res.end is not a function, skipping patch...');\n return;\n }\n\n let markOnEndDone = (): void => undefined;\n const onEndDonePromise = new Promise<void>(res => {\n markOnEndDone = res;\n });\n\n res.on('close', () => {\n markOnEndDone();\n });\n\n logger.log('Patching res.end()');\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n res.end = new Proxy(res.end, {\n apply(target, thisArg, argArray) {\n vercelWaitUntil(\n new Promise<void>(finishWaitUntil => {\n // Define a timeout that unblocks the lambda just to be safe so we're not indefinitely keeping it alive, exploding server bills\n const timeout = setTimeout(() => {\n finishWaitUntil();\n }, 2000);\n\n onEndDonePromise\n .then(() => {\n DEBUG_BUILD && logger.log('Flushing events before Vercel Lambda freeze');\n return flush(2000);\n })\n .then(\n () => {\n clearTimeout(timeout);\n finishWaitUntil();\n },\n e => {\n clearTimeout(timeout);\n DEBUG_BUILD && logger.log('Error while flushing events for Vercel:\\n', e);\n finishWaitUntil();\n },\n );\n }),\n );\n\n return target.apply(thisArg, argArray);\n },\n });\n }\n}\n"],"names":["InstrumentationBase","VERSION","InstrumentationNodeModuleDefinition","stealthWrap","DEBUG_BUILD","logger","vercelWaitUntil","flush"],"mappings":";;;;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,mCAAoC,SAAQA,mCAAoB,CAAA;AAC7E,GAAS,WAAW,GAAG;AACvB,IAAI,KAAK,CAAC,0CAA0C,EAAEC,YAAO,EAAE,EAAE,CAAC;AAClE;;AAEA;AACA,GAAS,IAAI,GAA+E;AAC5F,IAAI,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,IAAI,CAAC,uBAAuB,EAAE,CAAC;AAC5E;;AAEA;AACA,GAAU,uBAAuB,GAAwC;AACzE,IAAI,OAAO,IAAIC,mDAAmC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,KAAiB;AACjG;AACA,MAAMC,iBAAW,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,gCAAgC,EAAE,CAAC;;AAElG,MAAM,OAAO,aAAa;AAC1B,KAAK,CAAC;AACN;;AAEA;AACA,GAAU,wBAAwB,GAAwC;AAC1E,IAAI,OAAO,IAAID,mDAAmC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,KAAmB;AACpG;AACA,MA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,GAAG,CAAC,oBAAoB,CAAC;;AAEpC;AACA,IAAI,GAAG,CAAC,GAAA,GAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;AACjC,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;AACvC,QAAQC,sBAAe;AACvB,UAAU,IAAI,OAAO,CAAO,eAAA,IAAmB;AAC/C;AACA,YAAY,MAAM,OAAQ,GAAE,UAAU,CAAC,MAAM;AAC7C,cAAc,eAAe,EAAE;AAC/B,aAAa,EAAE,IAAI,CAAC;;AAEpB,YAAY;AACZ,eAAe,IAAI,CAAC,MAAM;AAC1B,gBAAgBF,0BAAeC,aAAM,CAAC,GAAG,CAAC,6CAA6C,CAAC;AACxF,gBAAgB,OAAOE,YAAK,CAAC,IAAI,CAAC;AAClC,eAAe;AACf,eAAe,IAAI;AACnB,gBAAgB,MAAM;AACtB,kBAAkB,YAAY,CAAC,OAAO,CAAC;AACvC,kBAAkB,eAAe,EAAE;AACnC,iBAAiB;AACjB,gBAAgB,KAAK;AACrB,kBAAkB,YAAY,CAAC,OAAO,CAAC;AACvC,kBAAkBH,sBAAA,IAAeC,aAAM,CAAC,GAAG,CAAC,2CAA2C,EAAE,CAAC,CAAC;AAC3F,kBAAkB,eAAe,EAAE;AACnC,iBAAiB;AACjB,eAAe;AACf,WAAW,CAAC;AACZ,SAAS;;AAET,QAAQ,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC9C,OAAO;AACP,KAAK,CAAC;AACN;AACA;;;;"}
@@ -1,44 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- /**
4
- * This is a minimal version of `wrap` from shimmer:
5
- * https://github.com/othiym23/shimmer/blob/master/index.js
6
- *
7
- * In contrast to the original implementation, this version does not allow to unwrap,
8
- * and does not make it clear that the method is wrapped.
9
- * This is necessary because we want to wrap the http module with our own code,
10
- * while still allowing to use the HttpInstrumentation from OTEL.
11
- *
12
- * Without this, if we'd just use `wrap` from shimmer, the OTEL instrumentation would remove our wrapping,
13
- * because it only allows any module to be wrapped a single time.
14
- */
15
- function stealthWrap(
16
- nodule,
17
- name,
18
- wrapper,
19
- ) {
20
- const original = nodule[name];
21
- const wrapped = wrapper(original);
22
-
23
- defineProperty(nodule, name, wrapped);
24
- return wrapped;
25
- }
26
-
27
- // Sets a property on an object, preserving its enumerability.
28
- function defineProperty(
29
- obj,
30
- name,
31
- value,
32
- ) {
33
- const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name);
34
-
35
- Object.defineProperty(obj, name, {
36
- configurable: true,
37
- enumerable: enumerable,
38
- writable: true,
39
- value: value,
40
- });
41
- }
42
-
43
- exports.stealthWrap = stealthWrap;
44
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/integrations/http/utils.ts"],"sourcesContent":["/**\n * This is a minimal version of `wrap` from shimmer:\n * https://github.com/othiym23/shimmer/blob/master/index.js\n *\n * In contrast to the original implementation, this version does not allow to unwrap,\n * and does not make it clear that the method is wrapped.\n * This is necessary because we want to wrap the http module with our own code,\n * while still allowing to use the HttpInstrumentation from OTEL.\n *\n * Without this, if we'd just use `wrap` from shimmer, the OTEL instrumentation would remove our wrapping,\n * because it only allows any module to be wrapped a single time.\n */\nexport function stealthWrap<Nodule extends object, FieldName extends keyof Nodule>(\n nodule: Nodule,\n name: FieldName,\n wrapper: (original: Nodule[FieldName]) => Nodule[FieldName],\n): Nodule[FieldName] {\n const original = nodule[name];\n const wrapped = wrapper(original);\n\n defineProperty(nodule, name, wrapped);\n return wrapped;\n}\n\n// Sets a property on an object, preserving its enumerability.\nfunction defineProperty<Nodule extends object, FieldName extends keyof Nodule>(\n obj: Nodule,\n name: FieldName,\n value: Nodule[FieldName],\n): void {\n const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name);\n\n Object.defineProperty(obj, name, {\n configurable: true,\n enumerable: enumerable,\n writable: true,\n value: value,\n });\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW;AAC3B,EAAE,MAAM;AACR,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAqB;AACrB,EAAE,MAAM,QAAS,GAAE,MAAM,CAAC,IAAI,CAAC;AAC/B,EAAE,MAAM,OAAQ,GAAE,OAAO,CAAC,QAAQ,CAAC;;AAEnC,EAAE,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC;AACvC,EAAE,OAAO,OAAO;AAChB;;AAEA;AACA,SAAS,cAAc;AACvB,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAQ;AACR,EAAE,MAAM,aAAa,CAAC,CAAC,GAAG,CAAC,IAAI,CAAE,IAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC;;AAEzF,EAAE,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE;AACnC,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,UAAU,EAAE,UAAU;AAC1B,IAAI,QAAQ,EAAE,IAAI;AAClB,IAAI,KAAK,EAAE,KAAK;AAChB,GAAG,CAAC;AACJ;;;;"}