UNPKG

hud-sdk

Version:

Hud's Node SDK

1 lines 165 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,()=>(()=>{var e={196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.patchLayerBase=function(e,t){return function(e,t){if(e.prototype[u.HUD_EXPRESS_PATCHED_SYMBOL])return e;e.prototype[u.HUD_EXPRESS_PATCHED_SYMBOL]=!0;const r=e.prototype[t];return e.prototype[t]=function(e,t,u,...p){let g=!1;try{return globalThis.hudRunningMode!==n.HudRunningMode.enabled||e[i.HUD_PATH_IGNORE_SYMBOL]?(g=!0,r.apply(this,[e,t,u,...p])):this[i.HUD_PATH_IGNORE_SYMBOL]?((this.route||"router"===this.name)&&(e[i.HUD_PATH_IGNORE_SYMBOL]=!0),g=!0,r.apply(this,[e,t,u,...p])):(u=function(e,t,r){if(!e.path||!e[i.HUD_PATH_SYMBOL])return r;let n;if(n=Array.isArray(e[i.HUD_PATH_SYMBOL])?e.path:e[i.HUD_PATH_SYMBOL],!n)return r;r[f]=t[d]||"",t[d]=r[f]+n;let o=r;if(!r[l]){const e=r;o=function(...r){return t[d]=e[f],e(...r)},o[l]=!0,(0,c.copyPropertiesToTarget)(e,o)}return o}(this,e,u),function(e,t){if(!Object.prototype.hasOwnProperty.call(e,"method"))return;const r=(0,a.getFlowState)();if(!r)return;r.shouldLinkFunction=!0;const n=r.httpMetric;if(!n)return;let s;s=e[i.HUD_USE_ALL_METHODS_SYMBOL]?(0,i.getMethods)():e.method?[e.method]:["all"];const c=(0,o.normalizePath)(t[d]||"/"),u=(0,i.generateEndpointFlowId)(c,s);n.setFlowId(u),r.flowId=u}(this,e),g=!0,r.apply(this,[e,t,u,...p]))}catch(n){if(g)throw n;return s.instrument_logger.error("Failed to run patched handle method",{msg:n instanceof Error?n.message:void 0,stack:n instanceof Error?n.stack:void 0}),r.apply(this,[e,t,u,...p])}},(0,c.copyPropertiesToTarget)(r,e.prototype[t]),e}(e,t.handleMethodName)};const n=r(8528),o=r(8269),i=r(2546),s=r(523),a=r(7131),c=r(8949),u=r(5265),d=Symbol.for("hud_layer_path"),l=Symbol.for("hud_next_wrapper"),f=Symbol.for("hud_next_restore")},290:e=>{"use strict";e.exports=require("async_hooks")},336:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(523),o=r(7131),i=r(2822),s=r(8949),a=r(4393),c=r(714);class u extends c.FrameworkPatcher{_patch(e){return this._patchSendRequest(e),n.instrument_logger.info("Patched @codegenie/serverless-express/src/frameworks/express.js successfully"),e}_patchSendRequest(e){const t=e.sendRequest;e.sendRequest=function(e){const r=e?.request,c=e?.response;if(!r||!c)return t.call(this,e);const u=a.HttpEndpointMetric.createUsableMetric(),d=(0,o.getFlowStateStorage)(),l={httpMetric:u},f=()=>{try{u.start(),u.setRequestAttributes(r)}catch(e){n.instrument_logger.error("Failed to start flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{c.once("finish",function(){try{u.calculateDuration(),(0,i.finishHttpInvestigation)(r,c,u),u.setResponseAttributes(c),u.end()}catch(e){n.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),c.once("close",()=>{(0,i.clearInvestigationDataFromStorage)(),(0,s.clearFlowStateData)(l)})}catch(e){n.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return(0,i.runWithInvestigation)(()=>t.call(this,e))};return d?d.run(l,f):f()},(0,s.copyPropertiesToTarget)(t,e.sendRequest)}}t.default=u},347:e=>{"use strict";e.exports=require("./source-map-support")},392:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.patchAllSetIntervalFunctions=function(){if(c)return;c=!0;const e=function(e){const t=function(t,...r){let s="";try{const e=(0,i.executionAsyncResource)()[o.kHudCaller]??globalThis.hudStack[globalThis.hudStackIndex.value];s="function"==typeof t?function(...r){try{(0,i.executionAsyncResource)()[o.kHudCaller]=e}catch{(0,n.limitedLogger)("wrappedHandler failed")}return t.apply(this,r)}:t}catch{(0,n.limitedLogger)("patchedSetInterval failed")}return e(s,...r)};return(0,s.copyPropertiesToTarget)(e,t),t}(a.setInterval);a.setInterval=e,globalThis.setInterval=e};const n=r(523),o=r(7131),i=r(6698),s=r(8949),a=r(7997);let c=!1},486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8544);class o extends n.BaseKafkaJSPatcher{getExportsRoot(e){return e}getGroupId(e){return e[0].groupId}moduleName(){return"KafkaJS"}}t.default=o},523:e=>{"use strict";e.exports=require("./logger")},646:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(523),o=r(8949),i=r(5128),s=r(714);class a extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),n.instrument_logger.info("Patched NestJS RouterExecutionContext successfully"),e}_patchCreate(e){const t=e.RouterExecutionContext.prototype.create;e.RouterExecutionContext.prototype.create=function(...e){try{const t=e[0],r=e[1];"function"==typeof t.constructor&&"function"==typeof r?e[1]=(0,i.wrapLinkedFunction)(r):n.instrument_logger.error("Invalid args in NestJS RouterExecutionContext.create",{args:e})}catch(e){n.instrument_logger.error("Error in NestJS RouterExecutionContext patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,o.copyPropertiesToTarget)(t,e.RouterExecutionContext.prototype.create)}}t.default=a},714:function(e,t,r){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&o(t,e,r[s]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.FrameworkPatcher=void 0,t.isCoveredByCorrelatedFramework=l,t.isSupportedVersion=f,t.extractModuleVersion=p,t.getFrameworkPatcher=function(e){return new(r(2828)(`./${e}`).default)};const a=r(2546),c=r(523),u=s(r(6928)),d=r(8064);function l(e,t){const r=t?.coveredByFramework;return!!r&&!!r.enabled&&!!f(e,r.versionRange)}function f(e,t){return""===e||d.satisfies(d.coerce(e),t)}function p(e){try{const t=a.suppressTracesFS.readFileSync(u.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(t).version;return"string"==typeof r?r:""}catch{c.instrument_logger.info("Failed extracting version",{baseDir:e})}return""}t.FrameworkPatcher=class{patch(e,t,r,n,o=this.constructor.name){try{if(this.isSupported(t,o,r,n))return this._patch(e)}catch(e){c.instrument_logger.error("Unhandled error during patching framework",{framework:o,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}isSupported(e,t,r,n){const o=p(e);return!!f(o,r)||(l(o,n)?(c.instrument_logger.info("Unsupported version covered by correlated framework instrumentation",{framework:t,version:o,correlatedFramework:n?.coveredByFramework?.frameworkKey}),!1):(c.instrument_logger.warning("Unsupported version",{framework:t,version:o,supportedVersion:r,basedir:e}),n&&n.isOutbound||c.customer_logger.logEntry(a.UserErrorLogs.UnsupportedFrameworkVersion(t)),!1))}}},828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KafkaJSMetric=void 0;const n=r(523),o=r(7131),i=r(9873);class s extends i.FlowMetric{partition;error;producedTimestamp;totalConsumeDuration;constructor(e){super(e)}_createUsableMetric(e){return this}end(){this.producedTimestamp&&(this.totalConsumeDuration=Number(Date.now()-this.producedTimestamp)*Number(1e6)),super.end()}addProducedTimestamp(e){void 0!==e&&(this.producedTimestamp=Number(e))}addPartition(e){this.partition=e}setError(e){this.error=(0,o.extractName)(e)}setUserError(e){this.error=e}toRaw(){if(void 0!==this.partition)return{flow_id:this.flowId,type:"KafkaJSMetric",duration:this.duration,partition:this.partition,error:this.error,total_consume_duration:this.totalConsumeDuration,error_breakdown:this.errorBreakdown};n.instrument_logger.warning("No partition found for message",{flowId:this.flowId})}}t.KafkaJSMetric=s},857:e=>{"use strict";e.exports=require("os")},911:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setWebSocketPayload=t.getWebSocketPayload=t.buildWebSocketContext=t.setQueuePayload=t.getQueuePayload=t.buildQueueContext=t.FLOW_TYPE_HELPER_REGISTRY=void 0;const n=r(8528),o=r(2268),i=r(5548),s=r(1148);t.FLOW_TYPE_HELPER_REGISTRY={[n.FlowType.Queue]:{investigationType:n.InvestigationType.Queue,buildContext:i.buildQueueContext,createMetric:e=>o.GenericQueueMetric.createUsableMetric(e,n.FlowType.Queue),setPayload:i.setQueuePayload,applyAttributes:(e,t)=>e.setQueueAttributes(t)},[n.FlowType.WebSocket]:{investigationType:n.InvestigationType.WebSocket,buildContext:s.buildWebSocketContext,createMetric:e=>o.GenericFlowMetric.createUsableMetric(e,n.FlowType.WebSocket),setPayload:s.setWebSocketPayload,applyAttributes:()=>{}},[n.FlowType.Custom]:{investigationType:n.InvestigationType.CustomFlow,buildContext:()=>{},createMetric:e=>o.GenericFlowMetric.createUsableMetric(e,n.FlowType.Custom),setPayload:()=>{},applyAttributes:()=>{}}};var a=r(5548);Object.defineProperty(t,"buildQueueContext",{enumerable:!0,get:function(){return a.buildQueueContext}}),Object.defineProperty(t,"getQueuePayload",{enumerable:!0,get:function(){return a.getQueuePayload}}),Object.defineProperty(t,"setQueuePayload",{enumerable:!0,get:function(){return a.setQueuePayload}});var c=r(1148);Object.defineProperty(t,"buildWebSocketContext",{enumerable:!0,get:function(){return c.buildWebSocketContext}}),Object.defineProperty(t,"getWebSocketPayload",{enumerable:!0,get:function(){return c.getWebSocketPayload}}),Object.defineProperty(t,"setWebSocketPayload",{enumerable:!0,get:function(){return c.setWebSocketPayload}})},932:e=>{"use strict";e.exports=require("process")},1009:function(e,t,r){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&o(t,e,r[s]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.PRELOADED_EXPRESS_MODULES=void 0,t.getPreloadedExpress4PackageDirs=function(e){const t=a.sep+f,r=new Set;for(const n of e){if(!n.endsWith(t))continue;const e=p(n);e&&g(e)&&r.add(e)}return Array.from(r)},t.getPreloadedExpressModuleFilename=function(e,t){const r=function(e){if(e.startsWith(d))return e.slice(d.length)}(t);if(r)return a.join(e,r)};const a=s(r(6928)),c=r(714),u="express",d=`${u}${a.sep}`,l=a.join("lib","application.js"),f=a.join(u,l);function p(e){if(e.endsWith(a.sep+l))return e.slice(0,e.length-l.length-1)}function g(e){const t=(0,c.extractModuleVersion)(e);return""!==t&&(0,c.isSupportedVersion)(t,">=4 <5")}t.PRELOADED_EXPRESS_MODULES=[a.join(u,"lib","application.js"),a.join(u,"lib","router","index.js"),a.join(u,"lib","router","layer.js")]},1115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._internals=void 0;const n=r(523),o=r(8949),i=r(7928),s=r(5128),a=r(714),c=Symbol.for("hudFastifyFactoryPatched"),u=Symbol.for("hudFastifyInstancePatched");function d(e){const t=e.toUpperCase();return"GET"===t?["GET","HEAD"]:[t]}function l(e){try{if(!e||"function"!=typeof e.handler)return;e.handler=(0,s.wrapLinkedFunction)(e.handler)}catch(e){n.instrument_logger.error("Failed to wrap fastify route handler",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async function f(e){try{const t=e?.routeOptions?.url??e?.routerPath,r=e?.method;if("string"!=typeof t||0===t.length||"string"!=typeof r||0===r.length)return void(0,n.limitedLogger)("Skipping fastify onRequest hook: missing route url or method",{hasUrl:"string"==typeof t,hasMethod:"string"==typeof r});const o=d(r);(0,i.declareAndBindHttpEndpoint)(t,o,"fastify")}catch(e){(0,n.limitedLogger)("Failed to declare/bind fastify endpoint in onRequest hook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}function p(e){if(e&&"function"==typeof e.addHook&&!e[u])try{e.addHook("onRoute",l),e.addHook("onRequest",f);try{e[u]=!0}catch{}}catch(e){n.instrument_logger.error("Failed to register fastify hooks",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}class g extends a.FrameworkPatcher{_patch(e){try{const t=this._patchFactory(e);return n.instrument_logger.info("Patched fastify successfully"),t}catch(t){return n.instrument_logger.error("Failed to patch fastify",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0}),e}}_patchFactory(e){if("function"!=typeof e)return e;if(e[c])return e;const t=function(...t){const r=e.apply(this,t);try{p(r)}catch(e){n.instrument_logger.error("Failed to install fastify hooks on instance",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r};try{(0,o.copyPropertiesToTarget)(e,t)}catch(e){n.instrument_logger.error("Failed to copy properties on fastify factory",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}t.fastify=t,t.default=t,t[c]=!0;try{e[c]=!0}catch(e){(0,n.limitedLogger)("Failed to mark fastify factory as patched",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t}}t.default=g,t._internals={methodsForRoute:d,handleOnRoute:l,handleOnRequest:f,installHooks:p}},1148:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.buildWebSocketContext=t.getWebSocketPayload=t.setWebSocketPayload=void 0,n=(0,r(4134).createTypeUtils)(),t.setWebSocketPayload=n.setPayload,t.getWebSocketPayload=n.getPayload,t.buildWebSocketContext=n.buildContext},1326:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),i=r(523),s=r(8949),a=r(714),c=n(r(9589));class u extends a.FrameworkPatcher{static nextJSHudMarked=Symbol.for("hudNextJSMarked");_patch(e){return(0,o.setIsNextJsApp)(!0),this._pathLoad(e),i.instrument_logger.info("Patched Next.js successfully"),e}_pathLoad(e){try{const t=e.RouteModuleLoader;if(t[u.nextJSHudMarked])return e;const r=t.load;t.load=async function(...e){const t=await r.apply(this,e);try{if(t){const e=t.definition?.pathname;e&&!t[u.nextJSHudMarked]&&(c.default._detectAndPatchSupportedMethods(t,e),t[u.nextJSHudMarked]=!0)}}catch(e){i.instrument_logger.error("Failed to patch Next.js route module",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t},t[u.nextJSHudMarked]=!0,(0,s.copyPropertiesToTarget)(r,t.load)}catch(e){i.instrument_logger.error("Failed to patch Next.js base server",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}}t.default=u},1427:e=>{"use strict";e.exports=require("./nativerequire")},1502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5809),o=r(8528),i=r(8269),s=r(2546),a=r(523),c=r(2489),u=r(8949),d=r(714);class l extends d.FrameworkPatcher{static koaModuleName="koa";static koaPatchedSymbol=Symbol.for(n.hudConfig.hudPatchedName);_patch(e){return this._patchAppUse(e),a.instrument_logger.info("Patched koa successfully"),e}_patchAppUse(e){const t=e.prototype.use;e.prototype.use=function(e){const r=t.apply(this,arguments);try{if(!arguments[0].router)return r;const e=arguments[0].router.stack;for(let t=0;t<e.length;t++)l._wrapRoute(e[t])}catch(e){a.instrument_logger.error("Failed to patch koa.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,u.copyPropertiesToTarget)(t,e.prototype.use)}static _wrapRoute(e){if(e.methods&&0===e.methods.length)return;if(!e.stack[0][l.koaPatchedSymbol]){const t=(0,u.wrapFlow)(m,e.stack[0],!0,(e,t,r)=>{const n=r[0];n?.req&&void 0!==n.request?.body&&(n.req[c.HUD_HTTP_BODY_SYMBOL]=n.request.body)});e.stack[0]=t,e.stack[0][l.koaPatchedSymbol]=!0}const t=(0,s.generateEndpointFlowId)(e.path,e.methods);(0,i.storeEndpointDeclaration)(new o.EndpointDeclaration(t,e.methods,"koa",void 0,e.path));for(const r of e.methods)g(t,e.path,r)}}function f(e,t){return e+"|"+t}t.default=l;const p=new Map;function g(e,t,r){p.set(f(t,r),e)}function m(e,t){if(0===t.length)return;const r=t[0]._matchedRoute,n=t[0].req?.method;return function(e,t){return p.get(f(e,t))}(r,n)}},1890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5809),o=r(8528),i=r(8269),s=r(523),a=r(7928),c=r(714),u=r(9938);function d(e){const t=e[0];if(!t||"object"!=typeof t)return{query:void 0,params:void 0};const r="string"==typeof t.query?t.query:void 0,n=[];null!==t.query_params&&void 0!==t.query_params&&n.push(t.query_params);const o={query:r,params:n.length>0?n:void 0};return"string"==typeof t.query_id&&(o.query_id=t.query_id),"string"==typeof t.session_id&&(o.session_id=t.session_id),o}function l(e){const t=parseInt(e,10);return t>0?t:void 0}function f(e){if(!e||"object"!=typeof e)return;const t={},r=["read_rows","read_bytes","written_rows","written_bytes","total_rows_to_read","result_rows","result_bytes","elapsed_ns"];for(const n of r){const r=l(e[n]);void 0!==r&&(t[n]=r)}return Object.keys(t).length>0?t:void 0}function p(e){return"string"==typeof e?.query_id?e.query_id:void 0}class g extends c.FrameworkPatcher{_patch(e){return s.instrument_logger.info("Patching @clickhouse/client"),e&&"object"==typeof e?((()=>"function"==typeof e.createClient?(s.instrument_logger.info("Wrapping clickhouse createClient"),this._wrapCreateClient(e),!0):e.ClickHouseClient?.prototype?(s.instrument_logger.info("Patching clickhouse prototype"),this._patchPrototype(e.ClickHouseClient.prototype),!0):(s.instrument_logger.error("ClickHouse exports missing createClient/ClickHouseClient"),!1))()&&((0,i.storeLoadedOutbound)("@clickhouse/client"),s.instrument_logger.info("Patched @clickhouse/client successfully")),e):e}_wrapCreateClient(e){const t=e.createClient,r=this._patchPrototype.bind(this),n=(0,a.patchMethodOnce)(t,e=>function(...t){const n=e.apply(this,t);try{const e=n&&Object.getPrototypeOf(n);e&&r(e)}catch(e){s.instrument_logger.error("Failed to patch ClickHouse client prototype",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n}),o=Object.getOwnPropertyDescriptor(e,"createClient");!o||o.writable||o.set?e.createClient=n:o.configurable?Object.defineProperty(e,"createClient",{configurable:!0,enumerable:o.enumerable??!0,writable:!0,value:n}):s.instrument_logger.error("Cannot replace non-configurable createClient export")}_patchPrototype(e){this._patchQuery(e),this._patchExec(e),this._patchCommand(e),this._patchInsert(e),this._patchClose(e)}_patchQuery(e){const t=e.query;e.query=(0,u.wrapOutboundFunction)(t,n.hudConfig.clickhouseQueryFunctionId,d,e=>({query_id:p(e)}),o.OutboundType.DB)}_patchExec(e){const t=e.exec;e.exec=(0,u.wrapOutboundFunction)(t,n.hudConfig.clickhouseExecFunctionId,d,e=>({query_id:p(e),...f(e?.summary)}),o.OutboundType.DB)}_patchCommand(e){const t=e.command;e.command=(0,u.wrapOutboundFunction)(t,n.hudConfig.clickhouseCommandFunctionId,d,e=>{const t=f(e?.summary);return{rowsCount:t?.written_rows,query_id:p(e),...t}},o.OutboundType.DB)}_patchInsert(e){const t=e.insert;e.insert=(0,u.wrapOutboundFunction)(t,n.hudConfig.clickhouseInsertFunctionId,e=>{const t=e[0];if(!t||"object"!=typeof t)return{query:void 0,params:void 0};const r=[];Array.isArray(t.values)&&t.values.length>0&&r.push(t.values[0]);const n={table:"string"==typeof t.table?t.table.trim():void 0,params:r.length>0?r:void 0};return Array.isArray(t.values)&&(n.valuesCount=t.values.length),"string"==typeof t.format&&(n.format=t.format),"string"==typeof t.session_id&&(n.session_id=t.session_id),n},e=>{const t=f(e?.summary);return{rowsCount:t?.written_rows,query_id:p(e),...t}},o.OutboundType.DB)}_patchClose(e){const t=e.close;e.close=(0,u.wrapOutboundFunction)(t,n.hudConfig.clickhouseCloseFunctionId,void 0,void 0,o.OutboundType.DB)}}t.default=g},2080:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SqsMetric=void 0;const n=r(9873);class o extends n.FlowMetric{errors;msgCount;e2eEpocStartTimeMS;e2eDurationNS;_finishedMessageCount;constructor(e){super(e),this._finishedMessageCount=0,this.errors={}}addError(e,t=1){this.errors[e]=(this.errors[e]??0)+t}setUserError(e){this.addError(e,1)}increaseAndShouldEnd(e=1){return this._finishedMessageCount+=e,!(this.msgCount&&this._finishedMessageCount<this.msgCount)}end(){this.e2eEpocStartTimeMS&&(this.e2eDurationNS=Number(Date.now()-this.e2eEpocStartTimeMS)*Number(1e6)),super.end()}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"SqsMetric",duration:this.duration,e2e_duration:this.e2eDurationNS,msg_count:this.msgCount,errors:this.errors,error_breakdown:this.errorBreakdown}}}t.SqsMetric=o},2086:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(523),o=r(9486),i=r(714);class s extends i.FrameworkPatcher{_patch(e){try{return(0,o.patchRouterBase)(e),n.instrument_logger.info("Patched express.Router successfully"),e}catch(t){return n.instrument_logger.error("Failed to patch express.Router",t),e}}}t.default=s},2096:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._internals=t.HUD_HONO_INCOMING_SYMBOL=void 0,t.patchHonoRequestPrototype=u;const n=r(523),o=r(2489),i=r(7928),s=r(714);t.HUD_HONO_INCOMING_SYMBOL=Symbol.for("hudHonoIncoming");const a=["json","text","arrayBuffer","blob","formData","bytes","parseBody"];function c(e){return function(...r){const i=e.apply(this,r);try{const e=this?.[t.HUD_HONO_INCOMING_SYMBOL];e?Promise.resolve(i).then(t=>{e[o.HUD_HTTP_BODY_SYMBOL]=t}).catch(()=>{}):(0,n.limitedLogger)("hono body accessor read without a linked incoming message")}catch{}return i}}function u(e){for(const t of a)try{e[t]=(0,i.patchMethodOnce)(e[t],c)}catch(e){(0,n.limitedLogger)("Failed to patch hono request body accessor",{method:t,msg:e instanceof Error?e.message:void 0})}}class d extends s.FrameworkPatcher{_patch(e){const t=e?.HonoRequest?.prototype;return t&&"object"==typeof t?(u(t),n.instrument_logger.info("Patched hono request successfully"),e):(n.instrument_logger.warning("hono request module missing HonoRequest prototype"),e)}}t.default=d,t._internals={patchHonoRequestPrototype:u,teeBodyMethod:c,HONO_BODY_METHODS:a}},2197:function(e,t,r){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&o(t,e,r[s]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.wrapFlow=t.serializableInvestigation=t.createNewInvestigation=t.koa=t.express=t.wrapScopedFlow=t.runInFlow=t.openMetric=t.openGenericFlowMetric=t.generateFlowIdAndStoreDeclaration=t.finalizeFlow=t.clearFlowState=t.safeLog=t.registerHook=t.hudRITM=void 0;var c=r(5688);Object.defineProperty(t,"hudRITM",{enumerable:!0,get:function(){return c.hudRITM}}),Object.defineProperty(t,"registerHook",{enumerable:!0,get:function(){return c.registerHook}}),Object.defineProperty(t,"safeLog",{enumerable:!0,get:function(){return c.safeLog}});var u=r(7928);Object.defineProperty(t,"clearFlowState",{enumerable:!0,get:function(){return u.clearFlowState}}),Object.defineProperty(t,"finalizeFlow",{enumerable:!0,get:function(){return u.finalizeFlow}}),Object.defineProperty(t,"generateFlowIdAndStoreDeclaration",{enumerable:!0,get:function(){return u.generateFlowIdAndStoreDeclaration}}),Object.defineProperty(t,"openGenericFlowMetric",{enumerable:!0,get:function(){return u.openGenericFlowMetric}}),Object.defineProperty(t,"openMetric",{enumerable:!0,get:function(){return u.openMetric}}),Object.defineProperty(t,"runInFlow",{enumerable:!0,get:function(){return u.runInFlow}}),Object.defineProperty(t,"wrapScopedFlow",{enumerable:!0,get:function(){return u.wrapScopedFlow}}),s(r(3901),t),t.express=a(r(7127)),s(r(714),t),t.koa=a(r(1502)),s(r(7166),t),s(r(3073),t),s(r(392),t);var d=r(2822);Object.defineProperty(t,"createNewInvestigation",{enumerable:!0,get:function(){return d.createNewInvestigation}});var l=r(6986);Object.defineProperty(t,"serializableInvestigation",{enumerable:!0,get:function(){return l.serializableInvestigation}});var f=r(8949);Object.defineProperty(t,"wrapFlow",{enumerable:!0,get:function(){return f.wrapFlow}})},2268:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenericQueueMetric=t.GenericFlowMetric=void 0;const n=r(523),o=r(7131),i=r(9873);class s extends i.FlowMetric{error;flowType;constructor(e,t){super(e),this.flowType=t}_createUsableMetric(e){return this}setUserError(e){this.error=e}setException(e){this.error=(0,o.extractName)(e)}toRaw(){if(this.flowId)return{flow_id:this.flowId,type:"GenericFlowMetric",flow_type:this.flowType,duration:this.duration,error:this.error,error_breakdown:this.errorBreakdown}}}t.GenericFlowMetric=s,t.GenericQueueMetric=class extends s{messageId;e2eDurationNS;msgCount;e2eEpochStartTimeMS;_createUsableMetric(e){return this}setQueueAttributes(e){void 0!==e.messageCount&&Number.isInteger(e.messageCount)&&e.messageCount>0&&(this.msgCount=e.messageCount),void 0!==e.enqueueTime&&Number.isFinite(e.enqueueTime)&&e.enqueueTime>0&&(this.e2eEpochStartTimeMS=e.enqueueTime)}end(){if(-1===this.duration&&this.calculateDuration(),this.e2eEpochStartTimeMS){const e=1e6*(Date.now()-this.e2eEpochStartTimeMS);this.duration<=e?this.e2eDurationNS=e:(0,n.limitedLogger)("Generic queue flow e2e duration out of range; dropping",{e2e_duration:e,duration:this.duration,enqueue_time:this.e2eEpochStartTimeMS})}super.end()}toRaw(){if(this.flowId)return{flow_id:this.flowId,type:"GenericQueueMetric",flow_type:this.flowType,duration:this.duration,error:this.error,e2e_duration:this.e2eDurationNS,error_breakdown:this.errorBreakdown,msg_count:this.msgCount}}}},2489:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HUD_HTTP_BODY_SYMBOL=t.HUD_HTTP_QUERY_SYMBOL=t.HUD_HTTP_PARAMS_SYMBOL=void 0,t.HUD_HTTP_PARAMS_SYMBOL=Symbol.for("hudHttpParams"),t.HUD_HTTP_QUERY_SYMBOL=Symbol.for("hudHttpQuery"),t.HUD_HTTP_BODY_SYMBOL=Symbol.for("hudHttpBody")},2546:e=>{"use strict";e.exports=require("./lib")},2729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(523),o=r(7131),i=r(2822),s=r(8949),a=r(4393),c=r(714);class u extends c.FrameworkPatcher{_patch(e){const t=this._patchGetFramework(e);return n.instrument_logger.info("Patched serverless-http/lib/framework/get-framework.js successfully"),t}_patchGetFramework(e){const t=e;return e=function(...e){const r=t.apply(t.this,e);async function c(e,...t){const c=a.HttpEndpointMetric.createUsableMetric(),u=(0,o.getFlowStateStorage)(),d={httpMetric:c};let l=!1;const f=t=>{if(!l){l=!0;try{c.calculateDuration(),(0,i.finishHttpInvestigation)(e,t,c),c.setResponseAttributes(t),c.end()}catch(e){n.instrument_logger.error("Failed to end flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}},p=async()=>{try{c.start(),c.setRequestAttributes(e)}catch(e){n.instrument_logger.error("Failed to start flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const o=await(0,i.runWithInvestigation)(()=>{const n=r.apply(r.this,[e,...t]);return n&&(n.writableEnded||n.finished)&&f(n),n});return o.once("finish",()=>f(o)),o.once("close",()=>{(0,i.clearInvestigationDataFromStorage)(),(0,s.clearFlowStateData)(d)}),o};return u?await u.run(d,p):await p()}return(0,s.copyPropertiesToTarget)(r,c),c},(0,s.copyPropertiesToTarget)(t,e),e}}t.default=u},2784:e=>{"use strict";e.exports=require("../native/_index")},2822:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBaseInvestigationStorage=m,t.createNewInvestigation=function(){if(!globalThis.hudEnableInvestigation)return;const e=(0,a.getInvestigationStorage)();void 0!==e&&e.enterWith(m())},t.runWithInvestigation=function(e){if(!globalThis.hudEnableInvestigation)return e();const t=(0,a.getInvestigationStorage)();return void 0===t?e():t.run(m(),e)},t.captureInvestigationScope=function(){const e=(0,a.getInvestigationStorage)(),t=e?.getStore();return void 0===e||void 0===t?e=>e():r=>e.run(t,r)},t.closeInvestigation=h,t.clearInvestigationDataFromStorage=y,t.storeInvestigation=_,t.getInvestigationDedupingKey=v,t.finishHttpInvestigation=function(e,t,r){r.apiProtocol!==c.ApiProtocol.GraphQL?function(e,t,r){const i=(0,n.matchesInvestigationErrorStatusCode)(t.statusCode)||void 0!==r.error,a=w(r,o.InvestigationType.HTTP,i,r.error??t.statusCode.toString());k("http",o.InvestigationType.HTTP,r,a,function(){try{(0,s.limitedLogger)("http requests headers",{headers:Object.keys(e.headers)})}catch{(0,s.limitedLogger)("failed to log http requests headers")}const n=r.getFlowId(),o=r.apiProtocolAttributes;if(!o||void 0===o.method)return void(0,s.limitedLogger)("method is undefined even though it shouldn't",{flowId:n,method:o?.method});const i=e.originalUrl||e.url||e.path,a=i?.split("?")[0];let u;return u=r.apiProtocol===c.ApiProtocol.REST&&void 0!==r.endReason?r.statusCode:r.statusCode??t.statusCode,{endpoint_uuid:n??"",route:a,method:o.method,params:(0,f.minimizeObject)(e.params??e[d.HUD_HTTP_PARAMS_SYMBOL]),query:(0,f.minimizeObject)(e.query??e[d.HUD_HTTP_QUERY_SYMBOL]),request_body:(0,f.minimizeObject)(e.body??e[d.HUD_HTTP_BODY_SYMBOL]),...void 0!==u?{status_code:u}:{},observability_identifiers:(0,p.getHttpObservabilityIdentifiers)(e),extra_headers:(0,p.getExtraHeaders)(e)}})}(e,t,r):function(e,t,r){const i=r.apiProtocolAttributes,s=(0,n.matchesInvestigationErrorStatusCode)(t.statusCode)||Boolean(i&&i.errorOccurred),c=w(r,o.InvestigationType.GraphQL,s,t.statusCode.toString());k("graphql",o.InvestigationType.GraphQL,r,c,function(){const o=r.apiProtocolAttributes?.errors;return{request_body:(0,f.minimizeObject)(e.body??e[d.HUD_HTTP_BODY_SYMBOL],Math.max(n.hudConfig.dynamicConfig.investigationRateLimits.maxObjectDepth,4)),graphql_errors:o?.map(e=>({name:(0,a.extractName)(e),message:(0,f.minimizeObject)((0,a.extractMessage)(e)),stackTrace:e instanceof Error?(0,f.getStackTraceWithoutMessage)(e.message,e.stack):void 0})),status_code:t.statusCode,observability_identifiers:(0,p.getHttpObservabilityIdentifiers)(e)}})}(e,t,r)},t.finishSqsInvestigation=function(e,t){const r=Object.keys(t.errors),n=w(t,o.InvestigationType.SQS,r.length>0,r.length>0?r[0]:void 0);k("sqs",o.InvestigationType.SQS,t,n,function(){return{messages:(0,f.minimizeObject)(e)}})},t.finishGenericFlowInvestigation=function(e,t,r,n){const o=u.FLOW_TYPE_HELPER_REGISTRY[t],i=w(e,o.investigationType,void 0!==e.error,e.error);k(t,o.investigationType,e,i,()=>({...o.buildContext()??{},framework:r,flow_name:n}))},t.finishKafkaJSInvestigation=function(e,t,r,n){const i=w(t,o.InvestigationType.Kafka,void 0!==t.error,t.error);k("kafkajs",o.InvestigationType.Kafka,t,i,function(){const t=e.map(e=>{let t=e.value;t instanceof Buffer&&(t=t.toString());try{t=JSON.parse(t)}catch{}return{key:e.key,value:t,timestamp:e.timestamp,offset:e.offset,headers:e.headers,attributes:e.attributes}});return{topic:r,partition:n,messages:(0,f.minimizeObject)(t)}})},t.getErrorRecordsFromInvestigation=S;const n=r(5809),o=r(8528),i=r(8269),s=r(523),a=r(7131),c=r(4393),u=r(911),d=r(2489),l=r(7808),f=r(6986),p=r(7603),g=r(3808);function m(){return{status:o.InvestigationStatus.Open,data:{triggerType:void 0,duration:0,caught:!0,exceptions:new Map,outbounds:[]}}}function h(){const e=(0,a.getInvestigationStorage)();if(void 0===e)return void(0,s.limitedLogger)("closeInvestigation: getStorage() is undefined");const t=e.getStore();if(void 0!==t&&t.status===o.InvestigationStatus.Open)return t.status=o.InvestigationStatus.Closed,t;(0,s.limitedLogger)(`closeInvestigation: investigation is undefined or not open, is undefined: ${void 0===t}`)}function y(){try{const e=(0,a.getInvestigationStorage)();if(void 0===e)return;const t=e.getStore();if(void 0===t||t.status===o.InvestigationStatus.Cleared)return;!function(e){try{e.data.exceptions.clear(),e.data.outbounds.length=0,e.data=void 0,e.status=o.InvestigationStatus.Cleared}catch{}}(t)}catch{}}function _(e,t){e.data.context=t;const r=(0,f.serializableInvestigation)(e);void 0!==r?(0,i.storeClosedInvestigation)(r):(0,s.limitedLogger)("storeInvestigation: serializableInvestigation is undefined")}function b(e){for(const t of e)if(!t.is_outbound_function)return t.function_id;(0,s.limitedLogger)("getInnerNonOutboundFunctionId: no inner non outbound function id found",{executionFlow:e})}function v(e,t,r,n){let o=`${t}|${r??""}|${n??""}`;for(const t of e)o+=`|${t.error_type}-${t.function_id}`;return o}function w(e,t,r,n){const o=function(){const e=(0,a.getInvestigationStorage)();if(void 0===e)return;const t=e.getStore();return t?.data?.userDefinedError}();return r||void 0!==o?{type:"Error",...void 0!==n?{frameworkResult:n}:{},...o?{userError:o}:{}}:!!function(e,t){const r=e.getFlowId();if(void 0===r)return!1;const n=E(r,t);return void 0!==n&&n.duration<e.duration}(e,t)&&{type:"Duration"}}function k(e,t,r,o,a){try{if(!1===o)return;const c=function(e,t,r){if(!1===t)return;let o;if(o="Error"===t.type?function(e,t,r){const o=h();if(void 0===o)return void(0,s.limitedLogger)("finishErrorInvestigation: investigation is undefined");const a=e.getFlowId();if(void 0===a)return void(0,s.limitedLogger)("finishErrorInvestigation: flowId is undefined");const c=S(o),u=v(c,o.data.caught,t,r),d={key:u,errors:c,caught:o.data.caught,framework_result:t,user_error:r};if(e.setErrorBreakdown(d),o.data.errorBreakdown=d,o.data.userDefinedError&&e.setUserError(o.data.userDefinedError),(0,i.getGlobalInvestigationTracking)()>=n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations)return void(0,s.limitedLogger)("finishErrorInvestigation: globalInvestigationTracking is greater than maxTotalInvestigations",{globalInvestigationTracking:(0,i.getGlobalInvestigationTracking)(),maxTotalInvestigations:n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations});if((0,i.getTotalInvestigationsErrorBased)()>=n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigationsErrorBased)return void(0,s.limitedLogger)("finishErrorInvestigation: currentTotalInvestigationsErrorBased is greater than maxTotalInvestigationsErrorBased");const l=(0,i.getInvestigationDedupingCache)(a).get(u)??0;if(!(l>=n.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations))return(0,i.increaseGlobalInvestigationTracking)(),(0,i.increaseTotalInvestigationsErrorBased)(),(0,i.increaseInvestigationDedupingCache)(a,u),o;(0,s.limitedLogger)("finishErrorInvestigation: investigationCount is greater than maxSameInvestigations",{flowId:a,investigationDedupKey:u,investigationCount:l,maxSameInvestigations:n.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations},u)}(e,t.frameworkResult,t.userError):function(e,t){const r=e.getFlowId();if(void 0===r)return void(0,s.limitedLogger)("finishDurationInvestigation: flowId is undefined");if((0,i.getGlobalInvestigationTracking)()>=n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations)return void(0,s.limitedLogger)("finishDurationInvestigation: currentTotalInvestigationsGlobal is greater than maxTotalInvestigations");if((0,i.getTotalInvestigationsDurationBased)()>=n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigationsDurationBased)return void(0,s.limitedLogger)("finishDurationInvestigation: currentTotalInvestigationsDurationBased is greater than maxTotalInvestigationsDurationBased");const o=E(r,t);if(void 0===o)return void(0,s.limitedLogger)("finishDurationInvestigation: durationThresholdAndCount is undefined");return(0,i.getInvestigationDurationCount)(r)>=o.number_of_dumps?((0,s.limitedLogger)("finishDurationInvestigation: currentInvestigationCount is greater than durationThresholdAndCount.count"),void s.app_logger.debug("finishDurationInvestigation: currentInvestigationCount is greater than durationThresholdAndCount.count")):((0,i.increaseInvestigationDurationCount)(r),(0,i.increaseGlobalInvestigationTracking)(),(0,i.increaseTotalInvestigationsDurationBased)(),h())}(e,r),void 0!==o)return o.data.triggerType=t.type,o.data.duration=e.duration,o.data.durationThreshold=E(e.getFlowId()??"",r)?.duration,o;(0,s.limitedLogger)("finishInvestigation: investigation return undefined")}(r,o,t);if(void 0===c)return;const u=r.getFlowId(),d=r.getMsStartTime();if(void 0===u||void 0===d)return void(0,s.limitedLogger)(`${e}: flowId or reqTimestamp is undefined even though it shouldn't`,{flowId:u,reqTimestamp:d});const f=a();if(void 0===f)return;_(c,{...f,type:t,flow_id:u,timestamp:d,machine_metrics:(0,l.getMachineMetrics)(),system_info:(0,g.getSystemInfo)(),observability_identifiers:{...(0,p.getObservabilityIdentifiers)(),...f.observability_identifiers}})}catch(t){(0,s.limitedLogger)(`Failed to finish ${e} investigation`,{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}finally{y()}}function E(e,t){const r=(0,i.getFlowIdDurationThresholdAndCount)(e);return void 0===r?(0,i.getFlowIdDurationThresholdAndCount)(`default-${t}`):r}function S(e){const t=new Set,r=[];for(const n of e.data.exceptions.values()){const e=(0,a.extractName)(n.exception),o=b(n.executionFlow)??"",i=`${e}-${o}`;if(t.has(i))continue;t.add(i);const s={error_type:e,function_id:o};r.push(s)}return r}},2828:(e,t,r)=>{var n={"./amqplib":3245,"./amqplib.ts":3245,"./baseKafkaJsPatcher":8544,"./baseKafkaJsPatcher.ts":8544,"./bullmq":8204,"./bullmq.ts":8204,"./codeGenieServerlessExpress":336,"./codeGenieServerlessExpress.ts":336,"./confluentKafkaJs":7276,"./confluentKafkaJs.ts":7276,"./eventHubs":7419,"./eventHubs.ts":7419,"./express":7127,"./express.ts":7127,"./express/application":8634,"./express/application.ts":8634,"./express/patchLayerBase":196,"./express/patchLayerBase.ts":196,"./express/patchRouterBase":9486,"./express/patchRouterBase.ts":9486,"./express/symbols":5265,"./express/symbols.ts":5265,"./expressLayer":7738,"./expressLayer.ts":7738,"./expressLayerInRouter":8036,"./expressLayerInRouter.ts":8036,"./expressRouter":2086,"./expressRouter.ts":2086,"./expressRouterInRouter":6680,"./expressRouterInRouter.ts":6680,"./fastify":1115,"./fastify.ts":1115,"./flows/flow":9873,"./flows/flow.ts":9873,"./flows/generic":2268,"./flows/generic.ts":2268,"./flows/http":4393,"./flows/http.ts":4393,"./flows/kafkajs":828,"./flows/kafkajs.ts":828,"./flows/sqs":2080,"./flows/sqs.ts":2080,"./flows/types":911,"./flows/types/":911,"./flows/types/index":911,"./flows/types/index.ts":911,"./flows/types/queue":5548,"./flows/types/queue.ts":5548,"./flows/types/typeUtils":4134,"./flows/types/typeUtils.ts":4134,"./flows/types/websocket":1148,"./flows/types/websocket.ts":1148,"./frameworkPatcher":714,"./frameworkPatcher.ts":714,"./graphql":7214,"./graphql.ts":7214,"./hapi":8707,"./hapi.ts":8707,"./hono":8969,"./hono.ts":8969,"./honoRequest":2096,"./honoRequest.ts":2096,"./http":5459,"./http.ts":5459,"./httpEndReasonTracker":8636,"./httpEndReasonTracker.ts":8636,"./internal/pLimit":4986,"./internal/pLimit.ts":4986,"./kafkajs":486,"./kafkajs.ts":486,"./koa":1502,"./koa.ts":1502,"./nestjsRouterExecutionContext":646,"./nestjsRouterExecutionContext.ts":646,"./nestjsRpcContextCreator":4290,"./nestjsRpcContextCreator.ts":4290,"./nextJsConfig":9723,"./nextJsConfig.ts":9723,"./nextJsModuleLoader":1326,"./nextJsModuleLoader.ts":1326,"./nextJsRouteModule":8840,"./nextJsRouteModule.ts":8840,"./nextjs":9589,"./nextjs.ts":9589,"./outbound/axios":5354,"./outbound/axios.ts":5354,"./outbound/clickhouse":1890,"./outbound/clickhouse.ts":1890,"./outbound/ioredis":7535,"./outbound/ioredis.ts":7535,"./outbound/mongoHelpers":7255,"./outbound/mongoHelpers.ts":7255,"./outbound/mongodb":9702,"./outbound/mongodb.ts":9702,"./outbound/mongoose":9803,"./outbound/mongoose.ts":9803,"./outbound/nodeFetch":8564,"./outbound/nodeFetch.ts":8564,"./outbound/pg":7427,"./outbound/pg.ts":7427,"./outbound/request":4349,"./outbound/request.ts":4349,"./outbound/wrapOutbound":9938,"./outbound/wrapOutbound.ts":9938,"./pubsub":4040,"./pubsub.ts":4040,"./queueInstrumentation":7492,"./queueInstrumentation.ts":7492,"./serverlessHttp":2729,"./serverlessHttp.ts":2729,"./servicebus":9796,"./servicebus.ts":9796,"./sqsConsumer":5150,"./sqsConsumer.ts":5150};function o(e){var t=i(e);return r(t)}function i(e){if(!r.o(n,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}o.keys=function(){return Object.keys(n)},o.resolve=i,e.exports=o,o.id=2828},2987:e=>{"use strict";e.exports=require("perf_hooks")},3073:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerStackHooks=function(){const e=(0,n.getAsyncHook)();if(e)return e.enable(),e;(0,o.setHudExecutionAsyncResource)(i.executionAsyncResource);const t=(0,i.createHook)({init:c});return t.enable(),(0,n.setAsyncHook)(t),t};const n=r(8269),o=r(7131),i=r(290),s=new Set(["Timeout","Immediate","TickObject","PROMISE","Microtask","prisma-client-request"]),a=new Set(["NONE","DIRHANDLE","DNSCHANNEL","ELDHISTOGRAM","FILEHANDLE","FILEHANDLECLOSEREQ","FIXEDSIZEBLOBCOPY","FSEVENTWRAP","FSREQCALLBACK","FSREQPROMISE","GETADDRINFOREQWRAP","GETNAMEINFOREQWRAP","HEAPSNAPSHOT","HTTP2SESSION","HTTP2STREAM","HTTP2PING","HTTP2SETTINGS","HTTPINCOMINGMESSAGE","HTTPCLIENTREQUEST","JSSTREAM","JSUDPWRAP","MESSAGEPORT","PIPECONNECTWRAP","PIPESERVERWRAP","PIPEWRAP","PROCESSWRAP","QUERYWRAP","SHUTDOWNWRAP","SIGNALWRAP","STATWATCHER","STREAMPIPE","TCPCONNECTWRAP","TCPSERVERWRAP","TCPWRAP","TTYWRAP","UDPSENDWRAP","UDPWRAP","SIGINTWATCHDOG","WORKER","WORKERHEAPSNAPSHOT","WRITEWRAP","ZLIB","CHECKPRIMEREQUEST","PBKDF2REQUEST","KEYPAIRGENREQUEST","KEYGENREQUEST","KEYEXPORTREQUEST","CIPHERREQUEST","DERIVEBITSREQUEST","HASHREQUEST","RANDOMBYTESREQUEST","RANDOMPRIMEREQUEST","SCRYPTREQUEST","SIGNREQUEST","TLSWRAP","VERIFYREQUEST","INSPECTORJSBINDING"]);function c(e,t,r,c){try{if(!s.has(t))return c[o.kHudCaller]="",void function(e){a.has(e)||(0,n.recordUnknownAsyncContextType)(e)}(t);const e=(0,i.executionAsyncResource)();if(void 0===e)return;if(void 0!==e[o.kHudCaller])return void(c[o.kHudCaller]=e[o.kHudCaller]);const r=globalThis.hudStack[globalThis.hudStackIndex.value];c[o.kHudCaller]=r,globalThis.hudStackPop&&(globalThis.hudStackPop=!1,globalThis.hudStackIndex.value--)}catch{}}},3176:e=>{"use strict";e.exports=require("buffer-crc32")},3245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8528),o=r(2546),i=r(523),s=r(7928),a=r(714),c=r(7492),u=n.FlowType.Queue,d=n.FlowFramework.Amqplib;class l extends a.FrameworkPatcher{_patch(e){return function(e){const t=e?.prototype;var r;t?(t.consume=(r=t.consume,(0,s.patchMethodOnce)(r,e=>async function(...t){try{const e=t[0],r=t[1],n=t[2];if("string"==typeof e&&"function"==typeof r){const o=(0,s.generateFlowIdAndStoreDeclaration)(u,d,e);n&&!0===n.noAck?t[1]=(0,s.wrapScopedFlow)(o,r,u,d,e,!0,void 0,!1,p):t[1]=(0,s.wrapOpenFlow)(o,r,u,d,e,!0,p)}else(0,i.limitedLogger)("amqplib: skipping consume — queue is not a string or callback is not a function",{queueType:typeof e,callbackType:typeof r})}catch(e){(0,i.limitedLogger)("amqplib: failed to wrap consume callback",{msg:e instanceof Error?e.message:void 0})}return await e.apply(this,t)})),t.ack=(0,c.patchSettleMethod)(t.ack,"ack"),t.nack=(0,c.patchSettleMethod)(t.nack,"nack",c.SettleError.MessageNacked),t.reject=(0,c.patchSettleMethod)(t.reject,"reject",c.SettleError.MessageRejected),t.ackAll=f(t.ackAll),t.nackAll=f(t.nackAll)):i.instrument_logger.warning("amqplib: Channel.prototype missing — skipping consume/ack patch")}(e?.Channel),i.instrument_logger.info("Patched amqplib successfully"),e}}function f(e){return(0,s.patchMethodOnce)(e,e=>function(...t){try{(0,i.limitedLogger)("amqplib: ackAll/nackAll settle the whole channel and aren't tracked by Hud"),(0,o.customerLimitedUserLog)(o.UserErrorLogs.AmqplibWholeChannelSettleUnsupported())}catch{}return e.apply(this,t)})}function p(e){return{payload:{messages:[e[0]]}}}t.default=l},3339:e=>{"use strict";e.exports=require("module")},3808:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSystemInfo=function(){return{pod_name:u(),node_name:d()}};const o=r(2546),i=n(r(857)),s=Symbol("not found");let a,c;function u(){if(a!==s){if(a)return a;try{return a=i.default.hostname(),a}catch{return void(a=s)}}}function d(){if(c!==s){if(c)return c;try{const e=o.suppressTracesFS.readFileSync("/etc/machine-id","utf8").trim();return c=e,c}catch{return void(c=s)}}}},3868:e=>{"use strict";e.exports=require("@jridgewell/sourcemap-codec")},3901:function(e,t,r){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&o(t,e,r[s]);return i(t,e),t}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.destructuredImportObj=t.defaultImportObj=void 0,t.getFunctionWrapperTemplate=C,t.splitCode=F,t.getEsbuildMark=I,t.getBundlerBuildIdForMarkedFile=x,t.editInSplits=A,t.appendCiBuildId=H,t.editWithCliBuildId=function(e,t,r,n){let{transformedCode:o,metadatas:i}=j(e,t,r,[],!0);return o+=`\n//# sourceMappingURL=${v.default.basename(t)}.map`,o=H(o,n),{transformedCode:o,metadatas:i}},t.edit=j,t.incrementInstrumentedFunctionsCount=B;const c=a(r(3176)),u=r(3903),d=r(5809),l=r(2546),f=r(523),p=r(8528),g=r(8269),m=r(2546),h=r(1427),y=r(7131),_=r(3868),b=s(r(2784)),v=a(r(6928)),w=/([0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/;function k(){return d.SDK_MODULE_NAME+"/wrap"}function E(e,t){return`\n ${d.hudConfig.internalAsyncWrapperFunctionName}(\n ${e} ${d.hudConfig.internalAsyncWrapperFunctionName}(\n ${t}, ${d.hudConfig.callContextVarName}, ${(0,y.getWrapperTypeFromPrefix)(e,!0)}\n ),\n ${d.hudConfig.callContextVarName},\n ${(0,y.getWrapperTypeFromPrefix)(e,!1)}\n )\n `}function S(e){return"true"===process.env.HUD_DO_NOT_WRAP_WITH_TRY_CATCH?e:`\n try {\n ${e}\n } catch {}\n `}function C(e,r,n=!1,o=!1,i=!1){const s="BODY_PLACEHOLDER",a="FUNCTION_ID_PLACEHOLDER",c="AWAITABLE_PLACEHOLDER",u="EXCEPTION_VARIABLE_PLACEHOLDER",l="ARGS_ARRAY_PLACEHOLDER",f=function(e,r,n=!1,o=!1){const i=[];if(n)return i;let s;r===p.Format.cjs?s="require":r===p.Format.esm&&(i.push(`import { createRequire as ${e}_createRequire } from "module";`,`const ${e}_require = ${e}_createRequire(import.meta.url);`),s=`${e}_require`);const a=o?`"${k()}"`:`String.raw\`${h.myRequire.resolve(k())}\``;return i.push(`let ${e}_temp = ${t.defaultImportObj};`,`try {\n let ${e}_module = ${s}(${a});\n const ${e}_assert = (x) => {\n if (!x) {\n throw new Error();\n }\n };\n ${e}_assert(${e}_module._hudVersion === "${d.SDK_VERSION}");\n Object.keys(${e}_temp).forEach((key) => {\n ${e}_assert(typeof ${e}_temp[key] === typeof ${e}_module[key]);\n }); \n ${e}_assert(typeof ${e}_module.asyncIteratorWrapper === "function");\n ${e}_temp = ${e}_module;\n } catch {}`,`const ${t.destructuredImportObj} = ${e}_temp;`),i}(e,r,n,i),g=o?", true":"";return{functionWrapper:`{\n let ${d.hudConfi