@sentry/node 8.24.0 → 8.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +3 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/anr/index.js +1 -1
- package/build/cjs/integrations/fs.js +142 -0
- package/build/cjs/integrations/fs.js.map +1 -0
- package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/build/cjs/integrations/spotlight.js +5 -0
- package/build/cjs/integrations/spotlight.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql.js +31 -0
- package/build/cjs/integrations/tracing/graphql.js.map +1 -1
- package/build/cjs/integrations/tracing/nest/helpers.js.map +1 -1
- package/build/cjs/integrations/tracing/nest/sentry-nest-instrumentation.js +53 -3
- package/build/cjs/integrations/tracing/nest/sentry-nest-instrumentation.js.map +1 -1
- package/build/cjs/sdk/index.js +9 -21
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/anr/index.js +1 -1
- package/build/esm/integrations/anr/worker-script.js +2 -2
- package/build/esm/integrations/fs.js +140 -0
- package/build/esm/integrations/fs.js.map +1 -0
- package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/build/esm/integrations/local-variables/worker-script.js +1 -1
- package/build/esm/integrations/spotlight.js +5 -1
- package/build/esm/integrations/spotlight.js.map +1 -1
- package/build/esm/integrations/tracing/graphql.js +32 -1
- package/build/esm/integrations/tracing/graphql.js.map +1 -1
- package/build/esm/integrations/tracing/nest/helpers.js.map +1 -1
- package/build/esm/integrations/tracing/nest/sentry-nest-instrumentation.js +53 -3
- package/build/esm/integrations/tracing/nest/sentry-nest-instrumentation.js.map +1 -1
- package/build/esm/sdk/index.js +10 -22
- package/build/esm/sdk/index.js.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/fs.d.ts +24 -0
- package/build/types/integrations/fs.d.ts.map +1 -0
- package/build/types/integrations/spotlight.d.ts +1 -0
- package/build/types/integrations/spotlight.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql.d.ts +15 -2
- package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
- package/build/types/integrations/tracing/nest/helpers.d.ts +3 -3
- package/build/types/integrations/tracing/nest/helpers.d.ts.map +1 -1
- package/build/types/integrations/tracing/nest/sentry-nest-instrumentation.d.ts +8 -2
- package/build/types/integrations/tracing/nest/sentry-nest-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/nest/types.d.ts +11 -0
- package/build/types/integrations/tracing/nest/types.d.ts.map +1 -1
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -1
- package/build/types-ts3.8/integrations/fs.d.ts +24 -0
- package/build/types-ts3.8/integrations/spotlight.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/graphql.d.ts +15 -2
- package/build/types-ts3.8/integrations/tracing/nest/helpers.d.ts +3 -3
- package/build/types-ts3.8/integrations/tracing/nest/sentry-nest-instrumentation.d.ts +8 -2
- package/build/types-ts3.8/integrations/tracing/nest/types.d.ts +11 -0
- package/package.json +6 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @sentry/node 8.
|
|
2
|
-
import{Session as t}from"node:inspector";import{parentPort as n,workerData 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=Object.prototype.toString;function p(t,n){return h.call(t)===`[object ${n}]`}function d(t){return p(t,"String")}function l(t){return p(t,"Object")}function m(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function y(t,n){try{return t instanceof n}catch(t){return!1}}const g="8.24.0",b=globalThis;function v(t,n,e){const r=e||b,o=r.__SENTRY__=r.__SENTRY__||{},s=o[g]=o[g]||{};return s[t]||(s[t]=n())}const _=b,w=80;function S(t,n){const e=t,r=[];if(!e||!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&&n.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(o&&o.length)o.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{e.id&&r.push(`#${e.id}`);const t=e.className;if(t&&d(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 $="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,E=["debug","info","warn","error","log","assert","trace"],x={};function N(t){if(!("console"in b))return t();const n=b.console,e={},r=Object.keys(x);r.forEach((t=>{const r=x[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const k=function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return $?E.forEach((e=>{n[e]=(...n)=>{t&&N((()=>{b.console[e](`Sentry Logger [${e}]:`,...n)}))}})):E.forEach((t=>{n[t]=()=>{}})),n}();function C(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}`}class D extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}function T(t){if(function(t){switch(h.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return y(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...j(t)};if(n=t,"undefined"!=typeof Event&&y(n,Event)){const n={type:t.type,target:O(t.target),currentTarget:O(t.currentTarget),...j(t)};return"undefined"!=typeof CustomEvent&&y(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function O(t){try{return n=t,"undefined"!=typeof Element&&y(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||w;for(;e&&s++<r&&(a=S(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 j(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 R(t){return A(t,new Map)}function A(t,n){if(function(t){if(!l(t))return!1;try{const n=Object.getPrototypeOf(t).constructor.name;return!n||"Object"===n}catch(t){return!0}}(t)){const e=n.get(t);if(void 0!==e)return e;const r={};n.set(t,r);for(const e of Object.keys(t))void 0!==t[e]&&(r[e]=A(t[e],n));return r}if(Array.isArray(t)){const e=n.get(t);if(void 0!==e)return e;const r=[];return n.set(t,r),t.forEach((t=>{r.push(A(t,n))})),r}return t}const I=50,P="?",U=/captureMessage|captureException/;function M(t){return t[t.length-1]||{}}const L="<anonymous>";const B=1e3;function G(){return Date.now()/B}const J=function(){const{performance:t}=b;if(!t||!t.now)return G;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/B}();function z(){const t=b,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function H(t,n=100,e=1/0){try{return W("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function W(t,n,e=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,n=t?new WeakSet:[];return[function(e){if(t)return!!n.has(e)||(n.add(e),!1);for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1},function(e){if(t)n.delete(e);else for(let t=0;t<n.length;t++)if(n[t]===e){n.splice(t,1);break}}]}()){const[s,i]=o;if(null==n||["number","boolean","string"].includes(typeof n)&&!Number.isNaN(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.t)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.o))return"[VueViewModel]";if(function(t){return l(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&n!=n)return"[NaN]";if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||L}catch(t){return L}}(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?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 W("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=T(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]=W(t,n,u-1,r,o),h++}return i(n),f}function Y(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:///")}(()=>{const{performance:t}=b;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,s=o<n,i=t.timing&&t.timing.navigationStart,c="number"==typeof i?Math.abs(i+e-r):n;(s||c<n)&&(o<=c&&t.timeOrigin)})();const q=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function F(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=q.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):"."}var K;function V(t){return new Z((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(K||(K={}));class Z{constructor(t){Z.prototype.__init.call(this),Z.prototype.__init2.call(this),Z.prototype.__init3.call(this),Z.prototype.__init4.call(this),this.i=K.PENDING,this.u=[];try{t(this.h,this.p)}catch(t){this.p(t)}}then(t,n){return new Z(((e,r)=>{this.u.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.l()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Z(((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)}))}))}__init(){this.h=t=>{this.m(K.RESOLVED,t)}}__init2(){this.p=t=>{this.m(K.REJECTED,t)}}__init3(){this.m=(t,n)=>{this.i===K.PENDING&&(m(n)?n.then(this.h,this.p):(this.i=t,this.v=n,this.l()))}}__init4(){this.l=()=>{if(this.i===K.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===K.RESOLVED&&t[1](this.v),this.i===K.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function Q(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=new D("Not adding Promise because buffer limit was reached."),new Z(((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 Z(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{V(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}function X(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 tt="sentry-",nt=/^sentry-/;function et(t){const n=function(t){if(!t||!d(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=rt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return rt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(nt)){t[n.slice(tt.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function rt(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}function ot(t,n=[]){return[t,n]}function st(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function it(t){return b.__SENTRY__&&b.__SENTRY__.encodePolyfill?b.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function ct(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[it(r),t]:r.push("string"==typeof t?it(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(H(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 ut={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",statsd:"metric_bucket"};function at(t){return ut[t]}function ft(t){if(!t||!t.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}const ht=6e4;function pt(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},s=e&&e["x-sentry-rate-limits"],i=e&&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)?ht:r-n}(i,r):429===n&&(o.all=r+6e4);return o}function dt(){return{traceId:z(),spanId:z().substring(16)}}const lt="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function mt(){return yt(b),b}function yt(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||g,n[g]=n[g]||{}}function gt(t){const n=J(),e={sid:z(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return R({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&&bt(e,t),e}function bt(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||J(),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:z()),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)}const vt="_sentrySpan";function _t(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){$&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,vt,n):delete t[vt]}function wt(t){return t[vt]}class St{constructor(){this._=!1,this.S=[],this.N=[],this.k=[],this.C=[],this.D={},this.T={},this.O={},this.j={},this.R={},this.A=dt()}clone(){const t=new St;return t.k=[...this.k],t.T={...this.T},t.O={...this.O},t.j={...this.j},t.D=this.D,t.I=this.I,t.P=this.P,t.U=this.U,t.M=this.M,t.N=[...this.N],t.L=this.L,t.C=[...this.C],t.R={...this.R},t.A={...this.A},t.B=this.B,t.G=this.G,_t(t,wt(this)),t}setClient(t){this.B=t}setLastEventId(t){this.G=t}getClient(){return this.B}lastEventId(){return this.G}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.N.push(t),this}setUser(t){return this.D=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&bt(this.P,{user:t}),this.J(),this}getUser(){return this.D}getRequestSession(){return this.L}setRequestSession(t){return this.L=t,this}setTags(t){return this.T={...this.T,...t},this.J(),this}setTag(t,n){return this.T={...this.T,[t]:n},this.J(),this}setExtras(t){return this.O={...this.O,...t},this.J(),this}setExtra(t,n){return this.O={...this.O,[t]:n},this.J(),this}setFingerprint(t){return this.M=t,this.J(),this}setLevel(t){return this.I=t,this.J(),this}setTransactionName(t){return this.U=t,this.J(),this}setContext(t,n){return null===n?delete this.j[t]:this.j[t]=n,this.J(),this}setSession(t){return t?this.P=t:delete this.P,this.J(),this}getSession(){return this.P}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof $t?[n.getScopeData(),n.getRequestSession()]:l(n)?[t,t.requestSession]:[],{tags:o,extra:s,user:i,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=e||{};return this.T={...this.T,...o},this.O={...this.O,...s},this.j={...this.j,...c},i&&Object.keys(i).length&&(this.D=i),u&&(this.I=u),a.length&&(this.M=a),f&&(this.A=f),r&&(this.L=r),this}clear(){return this.k=[],this.T={},this.O={},this.D={},this.j={},this.I=void 0,this.U=void 0,this.M=void 0,this.L=void 0,this.P=void 0,_t(this,void 0),this.C=[],this.A=dt(),this.J(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:G(),...t},o=this.k;return o.push(r),this.k=o.length>e?o.slice(-e):o,this.J(),this}getLastBreadcrumb(){return this.k[this.k.length-1]}clearBreadcrumbs(){return this.k=[],this.J(),this}addAttachment(t){return this.C.push(t),this}clearAttachments(){return this.C=[],this}getScopeData(){return{breadcrumbs:this.k,attachments:this.C,contexts:this.j,tags:this.T,extra:this.O,user:this.D,level:this.I,fingerprint:this.M||[],eventProcessors:this.N,propagationContext:this.A,sdkProcessingMetadata:this.R,transactionName:this.U,span:wt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.A=t,this}getPropagationContext(){return this.A}captureException(t,n){const e=n&&n.event_id?n.event_id:z();if(!this.B)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:z();if(!this.B)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:z();return this.B?(this.B.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}J(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}const $t=St;class Et{constructor(t,n){let e,r;e=t||new $t,r=n||new $t,this.H=[{scope:e}],this.W=r}withScope(t){const n=this.Y();let e;try{e=t(n)}catch(t){throw this.q(),t}return m(e)?e.then((t=>(this.q(),t)),(t=>{throw this.q(),t})):(this.q(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.W}getStackTop(){return this.H[this.H.length-1]}Y(){const t=this.getScope().clone();return this.H.push({client:this.getClient(),scope:t}),t}q(){return!(this.H.length<=1)&&!!this.H.pop()}}function xt(){const t=yt(mt());return t.stack=t.stack||new Et(v("defaultCurrentScope",(()=>new $t)),v("defaultIsolationScope",(()=>new $t)))}function Nt(t){return xt().withScope(t)}function kt(t,n){const e=xt();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Ct(t){return xt().withScope((()=>t(xt().getIsolationScope())))}function Dt(t){const n=yt(t);return n.acs?n.acs:{withIsolationScope:Ct,withScope:Nt,withSetScope:kt,withSetIsolationScope:(t,n)=>Ct(n),getCurrentScope:()=>xt().getScope(),getIsolationScope:()=>xt().getIsolationScope()}}function Tt(){return Dt(mt()).getCurrentScope().getClient()}const Ot="_sentryMetrics";function jt(t){const n=t[Ot];if(!n)return;const e={};for(const[,[t,r]]of n){(e[t]||(e[t]=[])).push(R(r))}return e}const Rt="sentry.source",At="sentry.sample_rate",It="sentry.op",Pt="sentry.origin",Ut=0,Mt=1,Lt=1;function Bt(t){const{spanId:n,traceId:e}=t.spanContext(),{parent_span_id:r}=zt(t);return R({parent_span_id:r,span_id:n,trace_id:e})}function Gt(t){return"number"==typeof t?Jt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Jt(t.getTime()):J()}function Jt(t){return t>9999999999?t/1e3:t}function zt(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{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}=t;return R({span_id:n,trace_id:e,data:r,description:s,parent_span_id:c,start_timestamp:Gt(o),timestamp:Gt(i)||void 0,status:Ht(u),op:r[It],origin:r[Pt],_metrics_summary:jt(t)})}return{span_id:n,trace_id:e}}catch(t){return{}}}function Ht(t){if(t&&t.code!==Ut)return t.code===Mt?"ok":t.message||"unknown_error"}const Wt="_sentryRootSpan";function Yt(t){return t[Wt]||t}const qt="production",Ft="_frozenDsc";function Kt(t){const n=Tt();if(!n)return{};const e=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o=R({environment:e.environment||qt,release:e.release,public_key:r,trace_id:t});return n.emit("createDsc",o),o}(zt(t).trace_id||"",n),r=Yt(t),o=r[Ft];if(o)return o;const s=r.spanContext().traceState,i=s&&s.get("sentry.dsc"),c=i&&et(i);if(c)return c;const u=zt(r),a=u.data||{},f=a[At];null!=f&&(e.sample_rate=`${f}`);const h=a[Rt],p=u.description;return"url"!==h&&p&&(e.transaction=p),e.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===Lt}(r)),n.emit("createDsc",e,r),e}function Vt(t,n,e,r){const o=ft(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&&e.sdk);const i=function(t,n,e,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:C(r)},...o&&{trace:R({...o})}}}(t,o,r,n);delete t.sdkProcessingMetadata;return ot(i,[[{type:s},t]])}const Zt="__SENTRY_SUPPRESS_TRACING__";function Qt(t){const n=Dt(mt());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=Dt(mt());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({[Zt]:!0}),t())))}function Xt(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,u=R(e);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=R(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=R(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=R(s);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:Bt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Kt(n),...t.sdkProcessingMetadata};const e=Yt(n),r=zt(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint&&!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 tn="7";function nn(t,n){return e={sentry_key:t.publicKey,sentry_version:tn,...n&&{sentry_client:`${n.name}/${n.version}`}},Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&");var e}const en=64;function rn(t,n,e=Q(t.bufferSize||en)){let r={};return{send:function(o){const s=[];if(st(o,((n,e)=>{const o=at(e);if(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e}(r,o)){const r=on(n,e);t.recordDroppedEvent("ratelimit_backoff",o,r)}else s.push(n)})),0===s.length)return V({});const i=ot(o[0],s),c=n=>{st(i,((e,r)=>{const o=on(e,r);t.recordDroppedEvent(n,at(r),o)}))};return e.add((()=>n({body:ct(i)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&<&&k.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=pt(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof D)return lt&&k.error("Skipped sending event because buffer is full."),c("queue_overflow"),V({});throw t}))},flush:t=>e.drain(t)}}function on(t,n){if("event"===n||"transaction"===n)return Array.isArray(t)?t[1]:void 0}const sn=Symbol("AgentBaseInternalState");class cn extends s.Agent{[sn];options;keepAlive;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.slice(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(" "),d=+(p[1]||0),l=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:d,statusText:l,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 protocols=["http","https"];proxy;proxyHeaders;connectOpts;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?dn(n,"headers"):null,host:e,port:r}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){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({...dn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{fn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function pn(t){t.resume()}function dn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}const ln=32768;function mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const yn=e;let gn,bn=!1;function vn(t){yn.debug&&console.log(`[ANR Worker] ${t}`)}var _n,wn,Sn;const $n=function(t){let n;try{n=new URL(t.url)}catch(n){return N((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),rn(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env;return e&&e.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)))?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});return Qt((()=>{const n=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)=>{let d=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const l={...t.headers};f.body.length>ln&&(l["content-encoding"]="gzip",d=d.pipe(u()));const m=n.request({method:"POST",agent:e,headers:l,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),d.pipe(m)}))}}(t,t.httpModule??o,f);return rn(t,n)}))}({url:(_n=yn.dsn,wn=yn.tunnel,Sn=yn.sdkMetadata.sdk,wn||`${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/`}(_n)}?${nn(_n,Sn)}`),recordDroppedEvent:()=>{}});async function En(){if(gn){vn("Sending abnormal session"),bt(gn,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,n,e,r){const o=ft(e);return ot({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:C(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(gn,yn.dsn,yn.sdkMetadata,yn.tunnel);vn(JSON.stringify(t)),await $n.send(t);try{n?.postMessage("session-ended")}catch(t){}}}function xn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(M(n).function||"")&&n.pop(),n.reverse(),U.test(M(n).function||"")&&(n.pop(),U.test(M(n).function||"")&&n.pop()),n.slice(0,I).map((t=>({...t,filename:t.filename||M(n).filename,function:t.function||P})))}(t);if(yn.appRootPath)for(const t of n)t.filename&&(t.filename=Y(t.filename,yn.appRootPath));return n}async function Nn(t,n){if(bn)return;bn=!0,await En(),vn("Sending event");const e={event_id:z(),contexts:yn.contexts,release:yn.release,environment:yn.environment,dist:yn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${yn.anrThreshold} ms`,stacktrace:{frames:xn(t)},mechanism:{type:"ANR"}}]},tags:yn.staticTags};n&&function(t,n){if(Xt(t,n),!t.contexts?.trace){const{traceId:e,spanId:r,parentSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:r,parent_span_id:o},...t.contexts}}}(e,n);const r=Vt(e,yn.dsn,yn.sdkMetadata,yn.tunnel);vn(JSON.stringify(r)),await $n.send(r),await $n.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let kn;if(vn("Started"),yn.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=yn.appRootPath?function(t=(process.argv[1]?F(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)),s||(s=".");const u=s.lastIndexOf("/node_modules");if(u>-1)return`${s.slice(u+14).replace(/\//g,".")}:${i}`;if(s.startsWith(e)){let t=s.slice(e.length+1).replace(/\//g,".");return t&&(t+=":"),t+=i,t}return i}}(yn.appRootPath):()=>{},c=s.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return R({filename:r,module:e(r),function:t.functionName||P,colno:o,lineno:s,in_app:r?X(r):void 0})}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Nn(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&&e.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Nn(c,r).then(null,(()=>{vn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),kn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Cn}=function(t,n,e,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>n+e&&(s=!0,i&&r()),t<n+e&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),yn.pollInterval,yn.anrThreshold,(function(){vn("Watchdog timeout"),kn?(vn("Pausing debugger to capture stack trace"),kn()):(vn("Capturing event without a stack trace"),Nn().then(null,(()=>{vn("Sending ANR event failed on watchdog timeout.")})))}));n?.on("message",(t=>{t.session&&(gn=gt(t.session)),Cn()}));
|
|
1
|
+
/*! @sentry/node 8.26.0 (bff9dfd) | https://github.com/getsentry/sentry-javascript */
|
|
2
|
+
import{Session as t}from"node:inspector";import{parentPort as n,workerData 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=Object.prototype.toString;function p(t,n){return h.call(t)===`[object ${n}]`}function d(t){return p(t,"String")}function l(t){return p(t,"Object")}function m(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function y(t,n){try{return t instanceof n}catch(t){return!1}}const g="8.26.0",b=globalThis;function v(t,n,e){const r=e||b,o=r.__SENTRY__=r.__SENTRY__||{},s=o[g]=o[g]||{};return s[t]||(s[t]=n())}const _=b,w=80;function S(t,n){const e=t,r=[];if(!e||!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&&n.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(o&&o.length)o.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{e.id&&r.push(`#${e.id}`);const t=e.className;if(t&&d(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 $="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,E=["debug","info","warn","error","log","assert","trace"],x={};function N(t){if(!("console"in b))return t();const n=b.console,e={},r=Object.keys(x);r.forEach((t=>{const r=x[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const k=function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return $?E.forEach((e=>{n[e]=(...n)=>{t&&N((()=>{b.console[e](`Sentry Logger [${e}]:`,...n)}))}})):E.forEach((t=>{n[t]=()=>{}})),n}();function C(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}`}class D extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}function T(t){if(function(t){switch(h.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return y(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...j(t)};if(n=t,"undefined"!=typeof Event&&y(n,Event)){const n={type:t.type,target:O(t.target),currentTarget:O(t.currentTarget),...j(t)};return"undefined"!=typeof CustomEvent&&y(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function O(t){try{return n=t,"undefined"!=typeof Element&&y(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||w;for(;e&&s++<r&&(a=S(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 j(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 R(t){return A(t,new Map)}function A(t,n){if(function(t){if(!l(t))return!1;try{const n=Object.getPrototypeOf(t).constructor.name;return!n||"Object"===n}catch(t){return!0}}(t)){const e=n.get(t);if(void 0!==e)return e;const r={};n.set(t,r);for(const e of Object.keys(t))void 0!==t[e]&&(r[e]=A(t[e],n));return r}if(Array.isArray(t)){const e=n.get(t);if(void 0!==e)return e;const r=[];return n.set(t,r),t.forEach((t=>{r.push(A(t,n))})),r}return t}const I=50,P="?",U=/captureMessage|captureException/;function M(t){return t[t.length-1]||{}}const L="<anonymous>";const B=1e3;function G(){return Date.now()/B}const J=function(){const{performance:t}=b;if(!t||!t.now)return G;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/B}();function z(){const t=b,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function H(t,n=100,e=1/0){try{return W("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function W(t,n,e=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,n=t?new WeakSet:[];return[function(e){if(t)return!!n.has(e)||(n.add(e),!1);for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1},function(e){if(t)n.delete(e);else for(let t=0;t<n.length;t++)if(n[t]===e){n.splice(t,1);break}}]}()){const[s,i]=o;if(null==n||["number","boolean","string"].includes(typeof n)&&!Number.isNaN(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.t)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.o))return"[VueViewModel]";if(function(t){return l(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&n!=n)return"[NaN]";if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||L}catch(t){return L}}(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?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 W("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const p=T(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]=W(t,n,u-1,r,o),h++}return i(n),f}function Y(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:///")}(()=>{const{performance:t}=b;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,s=o<n,i=t.timing&&t.timing.navigationStart,c="number"==typeof i?Math.abs(i+e-r):n;(s||c<n)&&(o<=c&&t.timeOrigin)})();const q=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function F(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=q.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):"."}var K;function V(t){return new Z((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(K||(K={}));class Z{constructor(t){Z.prototype.__init.call(this),Z.prototype.__init2.call(this),Z.prototype.__init3.call(this),Z.prototype.__init4.call(this),this.i=K.PENDING,this.u=[];try{t(this.h,this.p)}catch(t){this.p(t)}}then(t,n){return new Z(((e,r)=>{this.u.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.l()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Z(((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)}))}))}__init(){this.h=t=>{this.m(K.RESOLVED,t)}}__init2(){this.p=t=>{this.m(K.REJECTED,t)}}__init3(){this.m=(t,n)=>{this.i===K.PENDING&&(m(n)?n.then(this.h,this.p):(this.i=t,this.v=n,this.l()))}}__init4(){this.l=()=>{if(this.i===K.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===K.RESOLVED&&t[1](this.v),this.i===K.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function Q(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=new D("Not adding Promise because buffer limit was reached."),new Z(((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 Z(((e,r)=>{let o=n.length;if(!o)return e(!0);const s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{V(t).then((()=>{--o||(clearTimeout(s),e(!0))}),r)}))}))}}}function X(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 tt="sentry-",nt=/^sentry-/;function et(t){const n=function(t){if(!t||!d(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce(((t,n)=>{const e=rt(n);return Object.entries(e).forEach((([n,e])=>{t[n]=e})),t}),{});return rt(t)}(t);if(!n)return;const e=Object.entries(n).reduce(((t,[n,e])=>{if(n.match(nt)){t[n.slice(tt.length)]=e}return t}),{});return Object.keys(e).length>0?e:void 0}function rt(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[n,e])=>(n&&e&&(t[n]=e),t)),{})}function ot(t,n=[]){return[t,n]}function st(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function it(t){return b.__SENTRY__&&b.__SENTRY__.encodePolyfill?b.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function ct(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[it(r),t]:r.push("string"==typeof t?it(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(H(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 ut={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",statsd:"metric_bucket"};function at(t){return ut[t]}function ft(t){if(!t||!t.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}const ht=6e4;function pt(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},s=e&&e["x-sentry-rate-limits"],i=e&&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)?ht:r-n}(i,r):429===n&&(o.all=r+6e4);return o}function dt(){return{traceId:z(),spanId:z().substring(16)}}const lt="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function mt(){return yt(b),b}function yt(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||g,n[g]=n[g]||{}}function gt(t){const n=J(),e={sid:z(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return R({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&&bt(e,t),e}function bt(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||J(),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:z()),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)}const vt="_sentrySpan";function _t(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){$&&k.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,vt,n):delete t[vt]}function wt(t){return t[vt]}class St{constructor(){this._=!1,this.S=[],this.N=[],this.k=[],this.C=[],this.D={},this.T={},this.O={},this.j={},this.R={},this.A=dt()}clone(){const t=new St;return t.k=[...this.k],t.T={...this.T},t.O={...this.O},t.j={...this.j},t.D=this.D,t.I=this.I,t.P=this.P,t.U=this.U,t.M=this.M,t.N=[...this.N],t.L=this.L,t.C=[...this.C],t.R={...this.R},t.A={...this.A},t.B=this.B,t.G=this.G,_t(t,wt(this)),t}setClient(t){this.B=t}setLastEventId(t){this.G=t}getClient(){return this.B}lastEventId(){return this.G}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.N.push(t),this}setUser(t){return this.D=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&bt(this.P,{user:t}),this.J(),this}getUser(){return this.D}getRequestSession(){return this.L}setRequestSession(t){return this.L=t,this}setTags(t){return this.T={...this.T,...t},this.J(),this}setTag(t,n){return this.T={...this.T,[t]:n},this.J(),this}setExtras(t){return this.O={...this.O,...t},this.J(),this}setExtra(t,n){return this.O={...this.O,[t]:n},this.J(),this}setFingerprint(t){return this.M=t,this.J(),this}setLevel(t){return this.I=t,this.J(),this}setTransactionName(t){return this.U=t,this.J(),this}setContext(t,n){return null===n?delete this.j[t]:this.j[t]=n,this.J(),this}setSession(t){return t?this.P=t:delete this.P,this.J(),this}getSession(){return this.P}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof $t?[n.getScopeData(),n.getRequestSession()]:l(n)?[t,t.requestSession]:[],{tags:o,extra:s,user:i,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=e||{};return this.T={...this.T,...o},this.O={...this.O,...s},this.j={...this.j,...c},i&&Object.keys(i).length&&(this.D=i),u&&(this.I=u),a.length&&(this.M=a),f&&(this.A=f),r&&(this.L=r),this}clear(){return this.k=[],this.T={},this.O={},this.D={},this.j={},this.I=void 0,this.U=void 0,this.M=void 0,this.L=void 0,this.P=void 0,_t(this,void 0),this.C=[],this.A=dt(),this.J(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:G(),...t},o=this.k;return o.push(r),this.k=o.length>e?o.slice(-e):o,this.J(),this}getLastBreadcrumb(){return this.k[this.k.length-1]}clearBreadcrumbs(){return this.k=[],this.J(),this}addAttachment(t){return this.C.push(t),this}clearAttachments(){return this.C=[],this}getScopeData(){return{breadcrumbs:this.k,attachments:this.C,contexts:this.j,tags:this.T,extra:this.O,user:this.D,level:this.I,fingerprint:this.M||[],eventProcessors:this.N,propagationContext:this.A,sdkProcessingMetadata:this.R,transactionName:this.U,span:wt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.A=t,this}getPropagationContext(){return this.A}captureException(t,n){const e=n&&n.event_id?n.event_id:z();if(!this.B)return k.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:z();if(!this.B)return k.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:z();return this.B?(this.B.captureEvent(t,{...n,event_id:e},this),e):(k.warn("No client configured on scope - will not capture event!"),e)}J(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}const $t=St;class Et{constructor(t,n){let e,r;e=t||new $t,r=n||new $t,this.H=[{scope:e}],this.W=r}withScope(t){const n=this.Y();let e;try{e=t(n)}catch(t){throw this.q(),t}return m(e)?e.then((t=>(this.q(),t)),(t=>{throw this.q(),t})):(this.q(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.W}getStackTop(){return this.H[this.H.length-1]}Y(){const t=this.getScope().clone();return this.H.push({client:this.getClient(),scope:t}),t}q(){return!(this.H.length<=1)&&!!this.H.pop()}}function xt(){const t=yt(mt());return t.stack=t.stack||new Et(v("defaultCurrentScope",(()=>new $t)),v("defaultIsolationScope",(()=>new $t)))}function Nt(t){return xt().withScope(t)}function kt(t,n){const e=xt();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Ct(t){return xt().withScope((()=>t(xt().getIsolationScope())))}function Dt(t){const n=yt(t);return n.acs?n.acs:{withIsolationScope:Ct,withScope:Nt,withSetScope:kt,withSetIsolationScope:(t,n)=>Ct(n),getCurrentScope:()=>xt().getScope(),getIsolationScope:()=>xt().getIsolationScope()}}function Tt(){return Dt(mt()).getCurrentScope().getClient()}const Ot="_sentryMetrics";function jt(t){const n=t[Ot];if(!n)return;const e={};for(const[,[t,r]]of n){(e[t]||(e[t]=[])).push(R(r))}return e}const Rt="sentry.source",At="sentry.sample_rate",It="sentry.op",Pt="sentry.origin",Ut=0,Mt=1,Lt=1;function Bt(t){const{spanId:n,traceId:e}=t.spanContext(),{parent_span_id:r}=zt(t);return R({parent_span_id:r,span_id:n,trace_id:e})}function Gt(t){return"number"==typeof t?Jt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Jt(t.getTime()):J()}function Jt(t){return t>9999999999?t/1e3:t}function zt(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{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}=t;return R({span_id:n,trace_id:e,data:r,description:s,parent_span_id:c,start_timestamp:Gt(o),timestamp:Gt(i)||void 0,status:Ht(u),op:r[It],origin:r[Pt],_metrics_summary:jt(t)})}return{span_id:n,trace_id:e}}catch(t){return{}}}function Ht(t){if(t&&t.code!==Ut)return t.code===Mt?"ok":t.message||"unknown_error"}const Wt="_sentryRootSpan";function Yt(t){return t[Wt]||t}const qt="production",Ft="_frozenDsc";function Kt(t){const n=Tt();if(!n)return{};const e=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o=R({environment:e.environment||qt,release:e.release,public_key:r,trace_id:t});return n.emit("createDsc",o),o}(zt(t).trace_id||"",n),r=Yt(t),o=r[Ft];if(o)return o;const s=r.spanContext().traceState,i=s&&s.get("sentry.dsc"),c=i&&et(i);if(c)return c;const u=zt(r),a=u.data||{},f=a[At];null!=f&&(e.sample_rate=`${f}`);const h=a[Rt],p=u.description;return"url"!==h&&p&&(e.transaction=p),e.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===Lt}(r)),n.emit("createDsc",e,r),e}function Vt(t,n,e,r){const o=ft(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&&e.sdk);const i=function(t,n,e,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:C(r)},...o&&{trace:R({...o})}}}(t,o,r,n);delete t.sdkProcessingMetadata;return ot(i,[[{type:s},t]])}const Zt="__SENTRY_SUPPRESS_TRACING__";function Qt(t){const n=Dt(mt());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=Dt(mt());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({[Zt]:!0}),t())))}function Xt(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,u=R(e);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=R(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=R(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=R(s);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:Bt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Kt(n),...t.sdkProcessingMetadata};const e=Yt(n),r=zt(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint&&!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 tn="7";function nn(t,n){return e={sentry_key:t.publicKey,sentry_version:tn,...n&&{sentry_client:`${n.name}/${n.version}`}},Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&");var e}const en=64;function rn(t,n,e=Q(t.bufferSize||en)){let r={};return{send:function(o){const s=[];if(st(o,((n,e)=>{const o=at(e);if(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e}(r,o)){const r=on(n,e);t.recordDroppedEvent("ratelimit_backoff",o,r)}else s.push(n)})),0===s.length)return V({});const i=ot(o[0],s),c=n=>{st(i,((e,r)=>{const o=on(e,r);t.recordDroppedEvent(n,at(r),o)}))};return e.add((()=>n({body:ct(i)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&<&&k.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=pt(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof D)return lt&&k.error("Skipped sending event because buffer is full."),c("queue_overflow"),V({});throw t}))},flush:t=>e.drain(t)}}function on(t,n){if("event"===n||"transaction"===n)return Array.isArray(t)?t[1]:void 0}const sn=Symbol("AgentBaseInternalState");class cn extends s.Agent{[sn];options;keepAlive;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.slice(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(" "),d=+(p[1]||0),l=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:d,statusText:l,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 protocols=["http","https"];proxy;proxyHeaders;connectOpts;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?dn(n,"headers"):null,host:e,port:r}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){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({...dn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{fn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function pn(t){t.resume()}function dn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}const ln=32768;function mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const yn=e;let gn,bn=!1;function vn(t){yn.debug&&console.log(`[ANR Worker] ${t}`)}var _n,wn,Sn;const $n=function(t){let n;try{n=new URL(t.url)}catch(n){return N((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),rn(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env;return e&&e.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)))?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});return Qt((()=>{const n=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)=>{let d=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const l={...t.headers};f.body.length>ln&&(l["content-encoding"]="gzip",d=d.pipe(u()));const m=n.request({method:"POST",agent:e,headers:l,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),d.pipe(m)}))}}(t,t.httpModule??o,f);return rn(t,n)}))}({url:(_n=yn.dsn,wn=yn.tunnel,Sn=yn.sdkMetadata.sdk,wn||`${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/`}(_n)}?${nn(_n,Sn)}`),recordDroppedEvent:()=>{}});async function En(){if(gn){vn("Sending abnormal session"),bt(gn,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,n,e,r){const o=ft(e);return ot({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:C(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(gn,yn.dsn,yn.sdkMetadata,yn.tunnel);vn(JSON.stringify(t)),await $n.send(t);try{n?.postMessage("session-ended")}catch(t){}}}function xn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(M(n).function||"")&&n.pop(),n.reverse(),U.test(M(n).function||"")&&(n.pop(),U.test(M(n).function||"")&&n.pop()),n.slice(0,I).map((t=>({...t,filename:t.filename||M(n).filename,function:t.function||P})))}(t);if(yn.appRootPath)for(const t of n)t.filename&&(t.filename=Y(t.filename,yn.appRootPath));return n}async function Nn(t,n){if(bn)return;bn=!0,await En(),vn("Sending event");const e={event_id:z(),contexts:yn.contexts,release:yn.release,environment:yn.environment,dist:yn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${yn.anrThreshold} ms`,stacktrace:{frames:xn(t)},mechanism:{type:"ANR"}}]},tags:yn.staticTags};n&&function(t,n){if(Xt(t,n),!t.contexts?.trace){const{traceId:e,spanId:r,parentSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:r,parent_span_id:o},...t.contexts}}}(e,n);const r=Vt(e,yn.dsn,yn.sdkMetadata,yn.tunnel);vn(JSON.stringify(r)),await $n.send(r),await $n.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let kn;if(vn("Started"),yn.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=yn.appRootPath?function(t=(process.argv[1]?F(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)),s||(s=".");const u=s.lastIndexOf("/node_modules");if(u>-1)return`${s.slice(u+14).replace(/\//g,".")}:${i}`;if(s.startsWith(e)){let t=s.slice(e.length+1).replace(/\//g,".");return t&&(t+=":"),t+=i,t}return i}}(yn.appRootPath):()=>{},c=s.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return R({filename:r,module:e(r),function:t.functionName||P,colno:o,lineno:s,in_app:r?X(r):void 0})}(t,e.get(t.location.scriptId),i))),u=setTimeout((()=>{Nn(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&&e.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Nn(c,r).then(null,(()=>{vn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),kn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Cn}=function(t,n,e,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>n+e&&(s=!0,i&&r()),t<n+e&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),yn.pollInterval,yn.anrThreshold,(function(){vn("Watchdog timeout"),kn?(vn("Pausing debugger to capture stack trace"),kn()):(vn("Capturing event without a stack trace"),Nn().then(null,(()=>{vn("Sending ANR event failed on watchdog timeout.")})))}));n?.on("message",(t=>{t.session&&(gn=gt(t.session)),Cn()}));
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { FsInstrumentation } from '@opentelemetry/instrumentation-fs';
|
|
2
|
+
import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { generateInstrumentOnce } from '../otel/instrument.js';
|
|
4
|
+
|
|
5
|
+
const INTEGRATION_NAME = 'FileSystem';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This integration will create spans for `fs` API operations, like reading and writing files.
|
|
9
|
+
*
|
|
10
|
+
* **WARNING:** This integration may add significant overhead to your application. Especially in scenarios with a lot of
|
|
11
|
+
* file I/O, like for example when running a framework dev server, including this integration can massively slow down
|
|
12
|
+
* your application.
|
|
13
|
+
*
|
|
14
|
+
* @param options Configuration for this integration.
|
|
15
|
+
*/
|
|
16
|
+
const fsIntegration = defineIntegration(
|
|
17
|
+
(
|
|
18
|
+
options
|
|
19
|
+
|
|
20
|
+
= {},
|
|
21
|
+
) => {
|
|
22
|
+
return {
|
|
23
|
+
name: INTEGRATION_NAME,
|
|
24
|
+
setupOnce() {
|
|
25
|
+
generateInstrumentOnce(
|
|
26
|
+
INTEGRATION_NAME,
|
|
27
|
+
() =>
|
|
28
|
+
new FsInstrumentation({
|
|
29
|
+
requireParentSpan: true,
|
|
30
|
+
endHook(functionName, { args, span, error }) {
|
|
31
|
+
span.updateName(`fs.${functionName}`);
|
|
32
|
+
|
|
33
|
+
span.setAttributes({
|
|
34
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',
|
|
35
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (options.recordErrorMessagesAsSpanAttributes) {
|
|
39
|
+
if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {
|
|
40
|
+
span.setAttribute('path_argument', args[0]);
|
|
41
|
+
} else if (
|
|
42
|
+
typeof args[0] === 'string' &&
|
|
43
|
+
typeof args[1] === 'string' &&
|
|
44
|
+
FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)
|
|
45
|
+
) {
|
|
46
|
+
span.setAttribute('target_argument', args[0]);
|
|
47
|
+
span.setAttribute('path_argument', args[1]);
|
|
48
|
+
} else if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {
|
|
49
|
+
span.setAttribute('prefix_argument', args[0]);
|
|
50
|
+
} else if (
|
|
51
|
+
typeof args[0] === 'string' &&
|
|
52
|
+
typeof args[1] === 'string' &&
|
|
53
|
+
FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)
|
|
54
|
+
) {
|
|
55
|
+
span.setAttribute('existing_path_argument', args[0]);
|
|
56
|
+
span.setAttribute('new_path_argument', args[1]);
|
|
57
|
+
} else if (
|
|
58
|
+
typeof args[0] === 'string' &&
|
|
59
|
+
typeof args[1] === 'string' &&
|
|
60
|
+
FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)
|
|
61
|
+
) {
|
|
62
|
+
span.setAttribute('src_argument', args[0]);
|
|
63
|
+
span.setAttribute('dest_argument', args[1]);
|
|
64
|
+
} else if (
|
|
65
|
+
typeof args[0] === 'string' &&
|
|
66
|
+
typeof args[1] === 'string' &&
|
|
67
|
+
FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)
|
|
68
|
+
) {
|
|
69
|
+
span.setAttribute('old_path_argument', args[0]);
|
|
70
|
+
span.setAttribute('new_path_argument', args[1]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (error && options.recordErrorMessagesAsSpanAttributes) {
|
|
75
|
+
span.setAttribute('fs_error', error.message);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
)();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ['rename', 'renameSync'];
|
|
86
|
+
const FS_OPERATIONS_WITH_SRC_DEST = ['copyFile', 'cp', 'copyFileSync', 'cpSync'];
|
|
87
|
+
const FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ['link', 'linkSync'];
|
|
88
|
+
const FS_OPERATIONS_WITH_PREFIX = ['mkdtemp', 'mkdtempSync'];
|
|
89
|
+
const FS_OPERATIONS_WITH_TARGET_PATH = ['symlink', 'symlinkSync'];
|
|
90
|
+
const FS_OPERATIONS_WITH_PATH_ARG = [
|
|
91
|
+
'access',
|
|
92
|
+
'appendFile',
|
|
93
|
+
'chmod',
|
|
94
|
+
'chown',
|
|
95
|
+
'exists',
|
|
96
|
+
'mkdir',
|
|
97
|
+
'lchown',
|
|
98
|
+
'lstat',
|
|
99
|
+
'lutimes',
|
|
100
|
+
'open',
|
|
101
|
+
'opendir',
|
|
102
|
+
'readdir',
|
|
103
|
+
'readFile',
|
|
104
|
+
'readlink',
|
|
105
|
+
'realpath',
|
|
106
|
+
'realpath.native',
|
|
107
|
+
'rm',
|
|
108
|
+
'rmdir',
|
|
109
|
+
'stat',
|
|
110
|
+
'truncate',
|
|
111
|
+
'unlink',
|
|
112
|
+
'utimes',
|
|
113
|
+
'writeFile',
|
|
114
|
+
'accessSync',
|
|
115
|
+
'appendFileSync',
|
|
116
|
+
'chmodSync',
|
|
117
|
+
'chownSync',
|
|
118
|
+
'existsSync',
|
|
119
|
+
'lchownSync',
|
|
120
|
+
'lstatSync',
|
|
121
|
+
'lutimesSync',
|
|
122
|
+
'opendirSync',
|
|
123
|
+
'mkdirSync',
|
|
124
|
+
'openSync',
|
|
125
|
+
'readdirSync',
|
|
126
|
+
'readFileSync',
|
|
127
|
+
'readlinkSync',
|
|
128
|
+
'realpathSync',
|
|
129
|
+
'realpathSync.native',
|
|
130
|
+
'rmdirSync',
|
|
131
|
+
'rmSync',
|
|
132
|
+
'statSync',
|
|
133
|
+
'truncateSync',
|
|
134
|
+
'unlinkSync',
|
|
135
|
+
'utimesSync',
|
|
136
|
+
'writeFileSync',
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
export { fsIntegration };
|
|
140
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sources":["../../../src/integrations/fs.ts"],"sourcesContent":["import { FsInstrumentation } from '@opentelemetry/instrumentation-fs';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '../otel/instrument';\n\nconst INTEGRATION_NAME = 'FileSystem';\n\n/**\n * This integration will create spans for `fs` API operations, like reading and writing files.\n *\n * **WARNING:** This integration may add significant overhead to your application. Especially in scenarios with a lot of\n * file I/O, like for example when running a framework dev server, including this integration can massively slow down\n * your application.\n *\n * @param options Configuration for this integration.\n */\nexport const fsIntegration = defineIntegration(\n (\n options: {\n /**\n * Setting this option to `true` will include any filepath arguments from your `fs` API calls as span attributes.\n *\n * Defaults to `false`.\n */\n recordFilePaths?: boolean;\n\n /**\n * Setting this option to `true` will include the error messages of failed `fs` API calls as a span attribute.\n *\n * Defaults to `false`.\n */\n recordErrorMessagesAsSpanAttributes?: boolean;\n } = {},\n ) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new FsInstrumentation({\n requireParentSpan: true,\n endHook(functionName, { args, span, error }) {\n span.updateName(`fs.${functionName}`);\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs',\n });\n\n if (options.recordErrorMessagesAsSpanAttributes) {\n if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {\n span.setAttribute('path_argument', args[0]);\n } else if (\n typeof args[0] === 'string' &&\n typeof args[1] === 'string' &&\n FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)\n ) {\n span.setAttribute('target_argument', args[0]);\n span.setAttribute('path_argument', args[1]);\n } else if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {\n span.setAttribute('prefix_argument', args[0]);\n } else if (\n typeof args[0] === 'string' &&\n typeof args[1] === 'string' &&\n FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)\n ) {\n span.setAttribute('existing_path_argument', args[0]);\n span.setAttribute('new_path_argument', args[1]);\n } else if (\n typeof args[0] === 'string' &&\n typeof args[1] === 'string' &&\n FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)\n ) {\n span.setAttribute('src_argument', args[0]);\n span.setAttribute('dest_argument', args[1]);\n } else if (\n typeof args[0] === 'string' &&\n typeof args[1] === 'string' &&\n FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)\n ) {\n span.setAttribute('old_path_argument', args[0]);\n span.setAttribute('new_path_argument', args[1]);\n }\n }\n\n if (error && options.recordErrorMessagesAsSpanAttributes) {\n span.setAttribute('fs_error', error.message);\n }\n },\n }),\n )();\n },\n };\n },\n);\n\nconst FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ['rename', 'renameSync'];\nconst FS_OPERATIONS_WITH_SRC_DEST = ['copyFile', 'cp', 'copyFileSync', 'cpSync'];\nconst FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ['link', 'linkSync'];\nconst FS_OPERATIONS_WITH_PREFIX = ['mkdtemp', 'mkdtempSync'];\nconst FS_OPERATIONS_WITH_TARGET_PATH = ['symlink', 'symlinkSync'];\nconst FS_OPERATIONS_WITH_PATH_ARG = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'exists',\n 'mkdir',\n 'lchown',\n 'lstat',\n 'lutimes',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'realpath.native',\n 'rm',\n 'rmdir',\n 'stat',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'existsSync',\n 'lchownSync',\n 'lstatSync',\n 'lutimesSync',\n 'opendirSync',\n 'mkdirSync',\n 'openSync',\n 'readdirSync',\n 'readFileSync',\n 'readlinkSync',\n 'realpathSync',\n 'realpathSync.native',\n 'rmdirSync',\n 'rmSync',\n 'statSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'writeFileSync',\n];\n"],"names":[],"mappings":";;;;AAIA,MAAM,gBAAA,GAAmB,YAAY,CAAA;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAc,GAAE,iBAAiB;AAC9C,EAAE;AACF,IAAI,OAAO;;AAcP,GAAI,EAAE;AACV,OAAO;AACP,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,gBAAgB;AAC5B,MAAM,SAAS,GAAG;AAClB,QAAQ,sBAAsB;AAC9B,UAAU,gBAAgB;AAC1B,UAAU;AACV,YAAY,IAAI,iBAAiB,CAAC;AAClC,cAAc,iBAAiB,EAAE,IAAI;AACrC,cAAc,OAAO,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAM,EAAC,EAAE;AAC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A,UAAA,EAAA,IAAA,EAAA,cAAA,EAAA,QAAA,CAAA,CAAA;AACA,MAAA,yCAAA,GAAA,CAAA,MAAA,EAAA,UAAA,CAAA,CAAA;AACA,MAAA,yBAAA,GAAA,CAAA,SAAA,EAAA,aAAA,CAAA,CAAA;AACA,MAAA,8BAAA,GAAA,CAAA,SAAA,EAAA,aAAA,CAAA,CAAA;AACA,MAAA,2BAAA,GAAA;AACA,EAAA,QAAA;AACA,EAAA,YAAA;AACA,EAAA,OAAA;AACA,EAAA,OAAA;AACA,EAAA,QAAA;AACA,EAAA,OAAA;AACA,EAAA,QAAA;AACA,EAAA,OAAA;AACA,EAAA,SAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA,SAAA;AACA,EAAA,UAAA;AACA,EAAA,UAAA;AACA,EAAA,UAAA;AACA,EAAA,iBAAA;AACA,EAAA,IAAA;AACA,EAAA,OAAA;AACA,EAAA,MAAA;AACA,EAAA,UAAA;AACA,EAAA,QAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA,YAAA;AACA,EAAA,gBAAA;AACA,EAAA,WAAA;AACA,EAAA,WAAA;AACA,EAAA,YAAA;AACA,EAAA,YAAA;AACA,EAAA,WAAA;AACA,EAAA,aAAA;AACA,EAAA,aAAA;AACA,EAAA,WAAA;AACA,EAAA,UAAA;AACA,EAAA,aAAA;AACA,EAAA,cAAA;AACA,EAAA,cAAA;AACA,EAAA,cAAA;AACA,EAAA,qBAAA;AACA,EAAA,WAAA;AACA,EAAA,QAAA;AACA,EAAA,UAAA;AACA,EAAA,cAAA;AACA,EAAA,YAAA;AACA,EAAA,YAAA;AACA,EAAA,eAAA;AACA,CAAA;;;;"}
|
|
@@ -5,7 +5,7 @@ import { LRUMap, logger } from '@sentry/utils';
|
|
|
5
5
|
import { hashFrames, functionNamesMatch } from './common.js';
|
|
6
6
|
|
|
7
7
|
// This string is a placeholder that gets overwritten with the worker code.
|
|
8
|
-
const base64WorkerScript = '
|
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vc3QoIkRlYnVnZ2VyLmVuYWJsZSIpO2NvbnN0IHI9ITEhPT1iLmNhcHR1cmVBbGxFeGNlcHRpb25zO2lmKGF3YWl0IG4ucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZTpyPyJhbGwiOiJ1bmNhdWdodCJ9KSxyKXtjb25zdCBlPWIubWF4RXhjZXB0aW9uc1BlclNlY29uZHx8NTA7eD1mdW5jdGlvbihlLG4sdCl7bGV0IG89MCxyPTUsaT0wO3JldHVybiBzZXRJbnRlcnZhbCgoKCk9PnswPT09aT9vPmUmJihyKj0yLHQocikscj44NjQwMCYmKHI9ODY0MDApLGk9cik6KGktPTEsMD09PWkmJm4oKSksbz0wfSksMWUzKS51bnJlZigpLCgpPT57bys9MX19KGUsKGFzeW5jKCk9Pnt2KCJSYXRlLWxpbWl0IGxpZnRlZC4iKSxhd2FpdCBuLnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6ImFsbCJ9KX0pLChhc3luYyBlPT57dihgUmF0ZS1saW1pdCBleGNlZWRlZC4gRGlzYWJsaW5nIGNhcHR1cmluZyBvZiBjYXVnaHQgZXhjZXB0aW9ucyBmb3IgJHtlfSBzZWNvbmRzLmApLGF3YWl0IG4ucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZToidW5jYXVnaHQifSl9KSl9fSkoKS5jYXRjaCgoZT0+e3YoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSksc2V0SW50ZXJ2YWwoKCgpPT57fSksMWU0KTs=';
|
|
9
9
|
|
|
10
10
|
function log(...args) {
|
|
11
11
|
logger.log('[LocalVariables]', ...args);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @sentry/node 8.
|
|
1
|
+
/*! @sentry/node 8.26.0 (bff9dfd) | https://github.com/getsentry/sentry-javascript */
|
|
2
2
|
import{Session as e}from"node:inspector/promises";import{workerData as n,parentPort as t}from"node:worker_threads";import{posix as o,sep as r}from"node:path";const i=50,s="?",c=/\(error: (.*)\)/,a=/captureMessage|captureException/;function u(e){return e[e.length-1]||{}}const f=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function l(e){const n=function(e){const n=e.length>1024?`<truncated>${e.slice(-1024)}`:e,t=f.exec(n);return t?t.slice(1):[]}(e),t=n[0]||"";let o=n[1];return t||o?(o&&(o=o.slice(0,o.length-1)),t+o):"."}function d(e,n=!1){return!(n||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==e&&!e.includes("node_modules/")}function p(e){const n=/^\s*[-]{4,}$/,t=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return o=>{const r=o.match(t);if(r){let n,t,o,i,c;if(r[1]){o=r[1];let e=o.lastIndexOf(".");if("."===o[e-1]&&e--,e>0){n=o.slice(0,e),t=o.slice(e+1);const r=n.indexOf(".Module");r>0&&(o=o.slice(r+1),n=n.slice(0,r))}i=void 0}t&&(i=n,c=t),"<anonymous>"===t&&(c=void 0,o=void 0),void 0===o&&(c=c||s,o=i?`${i}.${c}`:c);let a=r[2]&&r[2].startsWith("file://")?r[2].slice(7):r[2];const u="native"===r[5];return a&&a.match(/\/[A-Z]:/)&&(a=a.slice(1)),a||!r[5]||u||(a=r[5]),{filename:a,module:e?e(a):void 0,function:o,lineno:g(r[3]),colno:g(r[4]),in_app:d(a||"",u)}}if(o.match(n))return{filename:o}}}function g(e){return parseInt(e||"",10)||void 0}function m(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const b=n,$=function(...e){const n=e.sort(((e,n)=>e[0]-n[0])).map((e=>e[1]));return(e,t=0,o=0)=>{const r=[],f=e.split("\n");for(let e=t;e<f.length;e++){const t=f[e];if(t.length>1024)continue;const s=c.test(t)?t.replace(c,"$1"):t;if(!s.match(/\S*Error: /)){for(const e of n){const n=e(s);if(n){r.push(n);break}}if(r.length>=i+o)break}}return function(e){if(!e.length)return[];const n=Array.from(e);/sentryWrapped/.test(u(n).function||"")&&n.pop();n.reverse(),a.test(u(n).function||"")&&(n.pop(),a.test(u(n).function||"")&&n.pop());return n.slice(0,i).map((e=>({...e,filename:e.filename||u(n).filename,function:e.function||s})))}(r.slice(o))}}([90,p(function(e=(process.argv[1]?l(process.argv[1]):process.cwd()),n="\\"===r){const t=n?m(e):e;return e=>{if(!e)return;const r=n?m(e):e;let{dir:i,base:s,ext:c}=o.parse(r);".js"!==c&&".mjs"!==c&&".cjs"!==c||(s=s.slice(0,-1*c.length)),i||(i=".");const a=i.lastIndexOf("/node_modules");if(a>-1)return`${i.slice(a+14).replace(/\//g,".")}:${s}`;if(i.startsWith(t)){let e=i.slice(t.length+1).replace(/\//g,".");return e&&(e+=":"),e+=s,e}return s}}(b.basePath))]);function v(...e){b.debug&&console.log("[LocalVariables Worker]",...e)}async function w(e,n,t,o){const r=await e.post("Runtime.getProperties",{objectId:n,ownProperties:!0});o[t]=r.result.filter((e=>"length"!==e.name&&!isNaN(parseInt(e.name,10)))).sort(((e,n)=>parseInt(e.name,10)-parseInt(n.name,10))).map((e=>e.value?.value))}async function y(e,n,t,o){const r=await e.post("Runtime.getProperties",{objectId:n,ownProperties:!0});o[t]=r.result.map((e=>[e.name,e.value?.value])).reduce(((e,[n,t])=>(e[n]=t,e)),{})}function h(e,n){e.value&&("value"in e.value?void 0===e.value.value||null===e.value.value?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&"function"!==e.value.type?n[e.name]=`<${e.value.description}>`:"undefined"===e.value.type&&(n[e.name]="<undefined>"))}async function P(e,n){const t=await e.post("Runtime.getProperties",{objectId:n,ownProperties:!0}),o={};for(const n of t.result)if(n?.value?.objectId&&"Array"===n?.value.className){const t=n.value.objectId;await w(e,t,n.name,o)}else if(n?.value?.objectId&&"Object"===n?.value?.className){const t=n.value.objectId;await y(e,t,n.name,o)}else n?.value&&h(n,o);return o}let x;(async function(){const n=new e;n.connectToMainThread(),v("Connected to main thread");let o=!1;n.on("Debugger.resumed",(()=>{o=!1})),n.on("Debugger.paused",(e=>{o=!0,async function(e,n,{reason:o,data:r,callFrames:i}){if("exception"!==o&&"promiseRejection"!==o)return;x?.();const s=function(e,n){if(void 0!==n)return function(e){if(void 0!==e)return e.slice(-10).reduce(((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`),"")}(e(n,1))}(n,r?.description);if(null==s)return;const c=[];for(let n=0;n<i.length;n++){const{scopeChain:t,functionName:o,this:r}=i[n],s=t.find((e=>"local"===e.type)),a="global"!==r.className&&r.className?`${r.className}.${o}`:o;if(void 0===s?.object.objectId)c[n]={function:a};else{const t=await P(e,s.object.objectId);c[n]={function:a,vars:t}}}t?.postMessage({exceptionHash:s,frames:c})}(n,$,e.params).then((()=>o?n.post("Debugger.resume"):Promise.resolve()),(e=>{}))})),await n.post("Debugger.enable");const r=!1!==b.captureAllExceptions;if(await n.post("Debugger.setPauseOnExceptions",{state:r?"all":"uncaught"}),r){const e=b.maxExceptionsPerSecond||50;x=function(e,n,t){let o=0,r=5,i=0;return setInterval((()=>{0===i?o>e&&(r*=2,t(r),r>86400&&(r=86400),i=r):(i-=1,0===i&&n()),o=0}),1e3).unref(),()=>{o+=1}}(e,(async()=>{v("Rate-limit lifted."),await n.post("Debugger.setPauseOnExceptions",{state:"all"})}),(async e=>{v(`Rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),await n.post("Debugger.setPauseOnExceptions",{state:"uncaught"})}))}})().catch((e=>{v("Failed to start debugger",e)})),setInterval((()=>{}),1e4);
|
|
@@ -57,6 +57,10 @@ function connectToSpotlight(client, options) {
|
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
res => {
|
|
60
|
+
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
|
|
61
|
+
// Reset failed requests counter on success
|
|
62
|
+
failedRequests = 0;
|
|
63
|
+
}
|
|
60
64
|
res.on('data', () => {
|
|
61
65
|
// Drain socket
|
|
62
66
|
});
|
|
@@ -102,5 +106,5 @@ function isWrapped(impl) {
|
|
|
102
106
|
return '__sentry_original__' in impl;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
export { getNativeHttpRequest, spotlightIntegration };
|
|
109
|
+
export { INTEGRATION_NAME, getNativeHttpRequest, spotlightIntegration };
|
|
106
110
|
//# sourceMappingURL=spotlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sources":["../../../src/integrations/spotlight.ts"],"sourcesContent":["import * as http from 'node:http';\nimport { defineIntegration } from '@sentry/core';\nimport type { Client, Envelope, IntegrationFn } from '@sentry/types';\nimport { logger, serializeEnvelope } from '@sentry/utils';\n\ntype SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\
|
|
1
|
+
{"version":3,"file":"spotlight.js","sources":["../../../src/integrations/spotlight.ts"],"sourcesContent":["import * as http from 'node:http';\nimport { defineIntegration } from '@sentry/core';\nimport type { Client, Envelope, IntegrationFn } from '@sentry/types';\nimport { logger, serializeEnvelope } from '@sentry/utils';\n\ntype SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'Spotlight';\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const _options = {\n sidecarUrl: options.sidecarUrl || 'http://localhost:8969/stream',\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (typeof process === 'object' && process.env && process.env.NODE_ENV !== 'development') {\n logger.warn(\"[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?\");\n }\n connectToSpotlight(client, _options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n *\n * Important: This integration only works with Node 18 or newer.\n */\nexport const spotlightIntegration = defineIntegration(_spotlightIntegration);\n\nfunction connectToSpotlight(client: Client, options: Required<SpotlightConnectionOptions>): void {\n const spotlightUrl = parseSidecarUrl(options.sidecarUrl);\n if (!spotlightUrl) {\n return;\n }\n\n let failedRequests = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failedRequests > 3) {\n logger.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests');\n return;\n }\n\n const serializedEnvelope = serializeEnvelope(envelope);\n\n const request = getNativeHttpRequest();\n const req = request(\n {\n method: 'POST',\n path: spotlightUrl.pathname,\n hostname: spotlightUrl.hostname,\n port: spotlightUrl.port,\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n },\n res => {\n if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {\n // Reset failed requests counter on success\n failedRequests = 0;\n }\n res.on('data', () => {\n // Drain socket\n });\n\n res.on('end', () => {\n // Drain socket\n });\n res.setEncoding('utf8');\n },\n );\n\n req.on('error', () => {\n failedRequests++;\n logger.warn('[Spotlight] Failed to send envelope to Spotlight Sidecar');\n });\n req.write(serializedEnvelope);\n req.end();\n });\n}\n\nfunction parseSidecarUrl(url: string): URL | undefined {\n try {\n return new URL(`${url}`);\n } catch {\n logger.warn(`[Spotlight] Invalid sidecar URL: ${url}`);\n return undefined;\n }\n}\n\ntype HttpRequestImpl = typeof http.request;\ntype WrappedHttpRequest = HttpRequestImpl & { __sentry_original__: HttpRequestImpl };\n\n/**\n * We want to get an unpatched http request implementation to avoid capturing our own calls.\n */\nexport function getNativeHttpRequest(): HttpRequestImpl {\n const { request } = http;\n if (isWrapped(request)) {\n return request.__sentry_original__;\n }\n\n return request;\n}\n\nfunction isWrapped(impl: HttpRequestImpl): impl is WrappedHttpRequest {\n return '__sentry_original__' in impl;\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,gBAAiB,GAAE,YAAW;AAC3C;AACA,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAwC,EAAE,KAAK;AACtF,EAAE,MAAM,WAAW;AACnB,IAAI,UAAU,EAAE,OAAO,CAAC,UAAA,IAAc,8BAA8B;AACpE,GAAG,CAAA;AACH;AACA,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,OAAO,YAAY,QAAA,IAAY,OAAO,CAAC,GAAI,IAAG,OAAO,CAAC,GAAG,CAAC,QAAS,KAAI,aAAa,EAAE;AAChG,QAAQ,MAAM,CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAA;AACjH,OAAM;AACN,MAAM,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC1C,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,oBAAqB,GAAE,iBAAiB,CAAC,qBAAqB,EAAC;AAC5E;AACA,SAAS,kBAAkB,CAAC,MAAM,EAAU,OAAO,EAA8C;AACjG,EAAE,MAAM,eAAe,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAC1D,EAAE,IAAI,CAAC,YAAY,EAAE;AACrB,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,IAAI,cAAe,GAAE,CAAC,CAAA;AACxB;AACA,EAAE,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,QAAQ,KAAe;AACtD,IAAI,IAAI,cAAe,GAAE,CAAC,EAAE;AAC5B,MAAM,MAAM,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAA;AACzG,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,MAAM,kB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C,CAAC,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,MAAA,CAAA,IAAA,CAAA,CAAA,iCAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,OAAA,SAAA,CAAA;AACA,GAAA;AACA,CAAA;;AAKA;AACA;AACA;AACA,SAAA,oBAAA,GAAA;AACA,EAAA,MAAA,EAAA,OAAA,EAAA,GAAA,IAAA,CAAA;AACA,EAAA,IAAA,SAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,OAAA,CAAA,mBAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,OAAA,CAAA;AACA,CAAA;AACA;AACA,SAAA,SAAA,CAAA,IAAA,EAAA;AACA,EAAA,OAAA,qBAAA,IAAA,IAAA,CAAA;AACA;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';
|
|
2
|
-
import { defineIntegration } from '@sentry/core';
|
|
2
|
+
import { defineIntegration, spanToJSON, getRootSpan } from '@sentry/core';
|
|
3
|
+
import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';
|
|
3
4
|
import { generateInstrumentOnce } from '../../otel/instrument.js';
|
|
4
5
|
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
5
6
|
|
|
@@ -11,6 +12,7 @@ const instrumentGraphql = generateInstrumentOnce(
|
|
|
11
12
|
const options = {
|
|
12
13
|
ignoreResolveSpans: true,
|
|
13
14
|
ignoreTrivialResolveSpans: true,
|
|
15
|
+
useOperationNameForRootSpan: true,
|
|
14
16
|
..._options,
|
|
15
17
|
};
|
|
16
18
|
|
|
@@ -18,6 +20,35 @@ const instrumentGraphql = generateInstrumentOnce(
|
|
|
18
20
|
...options,
|
|
19
21
|
responseHook(span) {
|
|
20
22
|
addOriginToSpan(span, 'auto.graphql.otel.graphql');
|
|
23
|
+
|
|
24
|
+
const attributes = spanToJSON(span).data || {};
|
|
25
|
+
|
|
26
|
+
// If operation.name is not set, we fall back to use operation.type only
|
|
27
|
+
const operationType = attributes['graphql.operation.type'];
|
|
28
|
+
const operationName = attributes['graphql.operation.name'];
|
|
29
|
+
|
|
30
|
+
if (options.useOperationNameForRootSpan && operationType) {
|
|
31
|
+
const rootSpan = getRootSpan(span);
|
|
32
|
+
|
|
33
|
+
// We guard to only do this on http.server spans
|
|
34
|
+
|
|
35
|
+
const rootSpanAttributes = spanToJSON(rootSpan).data || {};
|
|
36
|
+
|
|
37
|
+
const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];
|
|
38
|
+
|
|
39
|
+
const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;
|
|
40
|
+
|
|
41
|
+
// We keep track of each operation on the root span
|
|
42
|
+
// This can either be a string, or an array of strings (if there are multiple operations)
|
|
43
|
+
if (Array.isArray(existingOperations)) {
|
|
44
|
+
existingOperations.push(newOperation);
|
|
45
|
+
rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);
|
|
46
|
+
} else if (existingOperations) {
|
|
47
|
+
rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);
|
|
48
|
+
} else {
|
|
49
|
+
rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
21
52
|
},
|
|
22
53
|
});
|
|
23
54
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sources":["../../../../src/integrations/tracing/graphql.ts"],"sourcesContent":["import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\nimport { generateInstrumentOnce } from '../../otel/instrument';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\ninterface GraphqlOptions {\n
|
|
1
|
+
{"version":3,"file":"graphql.js","sources":["../../../../src/integrations/tracing/graphql.ts"],"sourcesContent":["import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';\nimport { defineIntegration, getRootSpan, spanToJSON } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';\nimport type { IntegrationFn } from '@sentry/types';\nimport { generateInstrumentOnce } from '../../otel/instrument';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\ninterface GraphqlOptions {\n /**\n * Do not create spans for resolvers.\n *\n * Defaults to true.\n */\n ignoreResolveSpans?: boolean;\n\n /**\n * Don't create spans for the execution of the default resolver on object properties.\n *\n * When a resolver function is not defined on the schema for a field, graphql will\n * use the default resolver which just looks for a property with that name on the object.\n * If the property is not a function, it's not very interesting to trace.\n * This option can reduce noise and number of spans created.\n *\n * Defaults to true.\n */\n ignoreTrivialResolveSpans?: boolean;\n\n /**\n * If this is enabled, a http.server root span containing this span will automatically be renamed to include the operation name.\n * Set this to `false` if you do not want this behavior, and want to keep the default http.server span name.\n *\n * Defaults to true.\n */\n useOperationNameForRootSpan?: boolean;\n}\n\nconst INTEGRATION_NAME = 'Graphql';\n\nexport const instrumentGraphql = generateInstrumentOnce<GraphqlOptions>(\n INTEGRATION_NAME,\n (_options: GraphqlOptions = {}) => {\n const options = {\n ignoreResolveSpans: true,\n ignoreTrivialResolveSpans: true,\n useOperationNameForRootSpan: true,\n ..._options,\n };\n\n return new GraphQLInstrumentation({\n ...options,\n responseHook(span) {\n addOriginToSpan(span, 'auto.graphql.otel.graphql');\n\n const attributes = spanToJSON(span).data || {};\n\n // If operation.name is not set, we fall back to use operation.type only\n const operationType = attributes['graphql.operation.type'];\n const operationName = attributes['graphql.operation.name'];\n\n if (options.useOperationNameForRootSpan && operationType) {\n const rootSpan = getRootSpan(span);\n\n // We guard to only do this on http.server spans\n\n const rootSpanAttributes = spanToJSON(rootSpan).data || {};\n\n const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];\n\n const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n\n // We keep track of each operation on the root span\n // This can either be a string, or an array of strings (if there are multiple operations)\n if (Array.isArray(existingOperations)) {\n existingOperations.push(newOperation);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);\n } else if (existingOperations) {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);\n } else {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);\n }\n }\n },\n });\n },\n);\n\nconst _graphqlIntegration = ((options: GraphqlOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentGraphql(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * GraphQL integration\n *\n * Capture tracing data for GraphQL.\n */\nexport const graphqlIntegration = defineIntegration(_graphqlIntegration);\n"],"names":[],"mappings":";;;;;;AAqCA,MAAM,gBAAA,GAAmB,SAAS,CAAA;AAClC;AACO,MAAM,iBAAkB,GAAE,sBAAsB;AACvD,EAAE,gBAAgB;AAClB,EAAE,CAAC,QAAQ,GAAmB,EAAE,KAAK;AACrC,IAAI,MAAM,UAAU;AACpB,MAAM,kBAAkB,EAAE,IAAI;AAC9B,MAAM,yBAAyB,EAAE,IAAI;AACrC,MAAM,2BAA2B,EAAE,IAAI;AACvC,MAAM,GAAG,QAAQ;AACjB,KAAK,CAAA;AACL;AACA,IAAI,OAAO,IAAI,sBAAsB,CAAC;AACtC,MAAM,GAAG,OAAO;AAChB,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQ,eAAe,CAAC,IAAI,EAAE,2B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A,KAAA;AACA,EAAA,OAAA;AACA,IAAA,IAAA,EAAA,gBAAA;AACA,IAAA,SAAA,GAAA;AACA,MAAA,iBAAA,CAAA,OAAA,CAAA,CAAA;AACA,KAAA;AACA,GAAA,CAAA;AACA,CAAA,CAAA,EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,kBAAA,GAAA,iBAAA,CAAA,mBAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../src/integrations/tracing/nest/helpers.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { addNonEnumerableProperty } from '@sentry/utils';\nimport type { InjectableTarget } from './types';\n\nconst sentryPatched = 'sentryPatched';\n\n/**\n * Helper checking if a concrete target class is already patched.\n *\n * We already guard duplicate patching with isWrapped. However, isWrapped checks whether a file has been patched, whereas we use this check for concrete target classes.\n * This check might not be necessary, but better to play it safe.\n */\nexport function isPatched(target: InjectableTarget): boolean {\n if (target.sentryPatched) {\n return true;\n }\n\n addNonEnumerableProperty(target, sentryPatched, true);\n return false;\n}\n\n/**\n * Returns span options for nest middleware spans.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function getMiddlewareSpanOptions(target: InjectableTarget) {\n return {\n name: target.name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nestjs',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.nestjs',\n },\n };\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,aAAA,GAAgB,eAAe,CAAA;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/integrations/tracing/nest/helpers.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { addNonEnumerableProperty } from '@sentry/utils';\nimport type { CatchTarget, InjectableTarget } from './types';\n\nconst sentryPatched = 'sentryPatched';\n\n/**\n * Helper checking if a concrete target class is already patched.\n *\n * We already guard duplicate patching with isWrapped. However, isWrapped checks whether a file has been patched, whereas we use this check for concrete target classes.\n * This check might not be necessary, but better to play it safe.\n */\nexport function isPatched(target: InjectableTarget | CatchTarget): boolean {\n if (target.sentryPatched) {\n return true;\n }\n\n addNonEnumerableProperty(target, sentryPatched, true);\n return false;\n}\n\n/**\n * Returns span options for nest middleware spans.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function getMiddlewareSpanOptions(target: InjectableTarget | CatchTarget) {\n return {\n name: target.name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nestjs',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.nestjs',\n },\n };\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,aAAA,GAAgB,eAAe,CAAA;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAC,MAAM,EAA2C;AAC3E,EAAE,IAAI,MAAM,CAAC,aAAa,EAAE;AAC5B,IAAI,OAAO,IAAI,CAAA;AACf,GAAE;AACF;AACA,EAAE,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;AACvD,EAAE,OAAO,KAAK,CAAA;AACd,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,MAAM,EAAkC;AACjF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,MAAM,CAAC,IAAI;AACrB,IAAI,UAAU,EAAE;AAChB,MAAM,CAAC,4BAA4B,GAAG,mBAAmB;AACzD,MAAM,CAAC,gCAAgC,GAAG,wBAAwB;AAClE,KAAK;AACL,GAAG,CAAA;AACH;;;;"}
|