[{"data":1,"prerenderedAt":1361},["ShallowReactive",2],{"navigation":3,"docs-path-index":268,"-docs-modules-telemetry-instrumentation":348,"-docs-modules-telemetry-instrumentation-surround":1356},[4],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":56},"Docs","i-lucide-book-marked","\u002Fdocs","docs",[10,26,57,229,250],{"title":11,"path":12,"stem":13,"children":14,"icon":25},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started\u002F1.index",[15,17,21],{"title":16,"path":12,"stem":13},"Introduction",{"title":18,"path":19,"stem":20},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","docs\u002F1.getting-started\u002F2.installation",{"title":22,"path":23,"stem":24},"Examples","\u002Fdocs\u002Fgetting-started\u002Fexamples","docs\u002F1.getting-started\u002F3.examples","i-lucide-rocket",{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":56},"Core features","i-lucide-square-function","\u002Fdocs\u002Fcore-features","docs\u002F2.core-features",[32,36,40,44,48,52],{"title":33,"path":34,"stem":35},"Configuration","\u002Fdocs\u002Fcore-features\u002Fconfiguration","docs\u002F2.core-features\u002F0.configuration",{"title":37,"path":38,"stem":39},"Dependency Injection","\u002Fdocs\u002Fcore-features\u002Fcontainer","docs\u002F2.core-features\u002F1.container",{"title":41,"path":42,"stem":43},"Controllers","\u002Fdocs\u002Fcore-features\u002Fcontrollers","docs\u002F2.core-features\u002F2.controllers",{"title":45,"path":46,"stem":47},"Middlewares","\u002Fdocs\u002Fcore-features\u002Fmiddlewares","docs\u002F2.core-features\u002F3.middlewares",{"title":49,"path":50,"stem":51},"Validation","\u002Fdocs\u002Fcore-features\u002Fvalidation","docs\u002F2.core-features\u002F4.validation",{"title":53,"path":54,"stem":55},"Introspection","\u002Fdocs\u002Fcore-features\u002Fintrospection","docs\u002F2.core-features\u002F5.introspection",false,{"title":58,"icon":59,"defaultOpen":60,"path":61,"stem":62,"children":63,"page":56},"Modules","i-lucide-boxes",true,"\u002Fdocs\u002Fmodules","docs\u002F3.modules",[64,81,92,108,127,142,150,165,176,191,210,218],{"title":65,"icon":56,"defaultOpen":56,"path":66,"stem":67,"children":68,"page":56},"Auth","\u002Fdocs\u002Fmodules\u002Fauth","docs\u002F3.modules\u002F1.auth",[69,73,77],{"title":70,"path":71,"stem":72},"Overview","\u002Fdocs\u002Fmodules\u002Fauth\u002Foverview","docs\u002F3.modules\u002F1.auth\u002F0.overview",{"title":74,"path":75,"stem":76},"Decorators","\u002Fdocs\u002Fmodules\u002Fauth\u002Fdecorators","docs\u002F3.modules\u002F1.auth\u002F1.decorators",{"title":78,"path":79,"stem":80},"API Reference","\u002Fdocs\u002Fmodules\u002Fauth\u002Fapi","docs\u002F3.modules\u002F1.auth\u002F2.api",{"title":82,"icon":56,"defaultOpen":56,"path":83,"stem":84,"children":85,"page":56},"Devtools","\u002Fdocs\u002Fmodules\u002Fdevtools","docs\u002F3.modules\u002F10.devtools",[86,89],{"title":70,"path":87,"stem":88},"\u002Fdocs\u002Fmodules\u002Fdevtools\u002Foverview","docs\u002F3.modules\u002F10.devtools\u002F0.overview",{"title":33,"path":90,"stem":91},"\u002Fdocs\u002Fmodules\u002Fdevtools\u002Fconfiguration","docs\u002F3.modules\u002F10.devtools\u002F1.configuration",{"title":93,"path":94,"stem":95,"children":96,"page":56},"Telemetry","\u002Fdocs\u002Fmodules\u002Ftelemetry","docs\u002F3.modules\u002F11.telemetry",[97,100,104],{"title":70,"path":98,"stem":99},"\u002Fdocs\u002Fmodules\u002Ftelemetry\u002Foverview","docs\u002F3.modules\u002F11.telemetry\u002F0.overview",{"title":101,"path":102,"stem":103},"API","\u002Fdocs\u002Fmodules\u002Ftelemetry\u002Fapi","docs\u002F3.modules\u002F11.telemetry\u002F1.api",{"title":105,"path":106,"stem":107},"Instrumentation","\u002Fdocs\u002Fmodules\u002Ftelemetry\u002Finstrumentation","docs\u002F3.modules\u002F11.telemetry\u002F2.instrumentation",{"title":109,"path":110,"stem":111,"children":112,"page":56},"Queue","\u002Fdocs\u002Fmodules\u002Fqueue","docs\u002F3.modules\u002F12.queue",[113,116,120,124],{"title":70,"path":114,"stem":115},"\u002Fdocs\u002Fmodules\u002Fqueue\u002Foverview","docs\u002F3.modules\u002F12.queue\u002F0.overview",{"title":117,"path":118,"stem":119},"Consumers","\u002Fdocs\u002Fmodules\u002Fqueue\u002Fconsumers","docs\u002F3.modules\u002F12.queue\u002F1.consumers",{"title":121,"path":122,"stem":123},"Strategies","\u002Fdocs\u002Fmodules\u002Fqueue\u002Fstrategies","docs\u002F3.modules\u002F12.queue\u002F2.strategies",{"title":101,"path":125,"stem":126},"\u002Fdocs\u002Fmodules\u002Fqueue\u002Fapi","docs\u002F3.modules\u002F12.queue\u002F3.api",{"title":128,"icon":56,"defaultOpen":56,"path":129,"stem":130,"children":131,"page":56},"Logger","\u002Fdocs\u002Fmodules\u002Flogger","docs\u002F3.modules\u002F2.logger",[132,135,139],{"title":70,"path":133,"stem":134},"\u002Fdocs\u002Fmodules\u002Flogger\u002Foverview","docs\u002F3.modules\u002F2.logger\u002F0.overview",{"title":136,"path":137,"stem":138},"Drains & Adapters","\u002Fdocs\u002Fmodules\u002Flogger\u002Fdrivers","docs\u002F3.modules\u002F2.logger\u002F1.drivers",{"title":101,"path":140,"stem":141},"\u002Fdocs\u002Fmodules\u002Flogger\u002Fapi","docs\u002F3.modules\u002F2.logger\u002F2.api",{"title":143,"icon":56,"defaultOpen":56,"path":144,"stem":145,"children":146,"page":56},"Serverless","\u002Fdocs\u002Fmodules\u002Fserverless","docs\u002F3.modules\u002F3.serverless",[147],{"title":70,"path":148,"stem":149},"\u002Fdocs\u002Fmodules\u002Fserverless\u002Foverview","docs\u002F3.modules\u002F3.serverless\u002F0.overview",{"title":151,"icon":56,"defaultOpen":56,"path":152,"stem":153,"children":154,"page":56},"Storage","\u002Fdocs\u002Fmodules\u002Fstorage","docs\u002F3.modules\u002F4.storage",[155,158,162],{"title":70,"path":156,"stem":157},"\u002Fdocs\u002Fmodules\u002Fstorage\u002Foverview","docs\u002F3.modules\u002F4.storage\u002F0.overview",{"title":159,"path":160,"stem":161},"Drivers","\u002Fdocs\u002Fmodules\u002Fstorage\u002Fdrivers","docs\u002F3.modules\u002F4.storage\u002F1.drivers",{"title":101,"path":163,"stem":164},"\u002Fdocs\u002Fmodules\u002Fstorage\u002Fapi","docs\u002F3.modules\u002F4.storage\u002F2.api",{"title":166,"icon":56,"defaultOpen":56,"path":167,"stem":168,"children":169,"page":56},"Web Sockets","\u002Fdocs\u002Fmodules\u002Fweb-sockets","docs\u002F3.modules\u002F5.web-sockets",[170,173],{"title":70,"path":171,"stem":172},"\u002Fdocs\u002Fmodules\u002Fweb-sockets\u002Foverview","docs\u002F3.modules\u002F5.web-sockets\u002F0.overview",{"title":101,"path":174,"stem":175},"\u002Fdocs\u002Fmodules\u002Fweb-sockets\u002Fapi","docs\u002F3.modules\u002F5.web-sockets\u002F1.api",{"title":177,"icon":56,"defaultOpen":56,"path":178,"stem":179,"children":180,"page":56},"Schema","\u002Fdocs\u002Fmodules\u002Fschema","docs\u002F3.modules\u002F6.schema",[181,184,187],{"title":70,"path":182,"stem":183},"\u002Fdocs\u002Fmodules\u002Fschema\u002Foverview","docs\u002F3.modules\u002F6.schema\u002F0.overview",{"title":74,"path":185,"stem":186},"\u002Fdocs\u002Fmodules\u002Fschema\u002Fdecorators","docs\u002F3.modules\u002F6.schema\u002F1.decorators",{"title":188,"path":189,"stem":190},"Scalar","\u002Fdocs\u002Fmodules\u002Fschema\u002Fscalar","docs\u002F3.modules\u002F6.schema\u002F2.scalar",{"title":192,"icon":56,"defaultOpen":56,"path":193,"stem":194,"children":195,"page":56},"Nitro","\u002Fdocs\u002Fmodules\u002Fnitro","docs\u002F3.modules\u002F7.nitro",[196,199,202,206],{"title":70,"path":197,"stem":198},"\u002Fdocs\u002Fmodules\u002Fnitro\u002Foverview","docs\u002F3.modules\u002F7.nitro\u002F0.overview",{"title":151,"path":200,"stem":201},"\u002Fdocs\u002Fmodules\u002Fnitro\u002Fstorage","docs\u002F3.modules\u002F7.nitro\u002F1.storage",{"title":203,"path":204,"stem":205},"File-Based Routes","\u002Fdocs\u002Fmodules\u002Fnitro\u002Ffile-based-routes","docs\u002F3.modules\u002F7.nitro\u002F2.file-based-routes",{"title":207,"path":208,"stem":209},"Middleware","\u002Fdocs\u002Fmodules\u002Fnitro\u002Fmiddleware","docs\u002F3.modules\u002F7.nitro\u002F3.middleware",{"title":211,"icon":56,"defaultOpen":56,"path":212,"stem":213,"children":214,"page":56},"Vite","\u002Fdocs\u002Fmodules\u002Fvite","docs\u002F3.modules\u002F8.vite",[215],{"title":70,"path":216,"stem":217},"\u002Fdocs\u002Fmodules\u002Fvite\u002Foverview","docs\u002F3.modules\u002F8.vite\u002F0.overview",{"title":219,"icon":56,"defaultOpen":56,"path":220,"stem":221,"children":222,"page":56},"Cache","\u002Fdocs\u002Fmodules\u002Fcache","docs\u002F3.modules\u002F9.cache",[223,226],{"title":70,"path":224,"stem":225},"\u002Fdocs\u002Fmodules\u002Fcache\u002Foverview","docs\u002F3.modules\u002F9.cache\u002F0.overview",{"title":101,"path":227,"stem":228},"\u002Fdocs\u002Fmodules\u002Fcache\u002Fapi","docs\u002F3.modules\u002F9.cache\u002F1.api",{"title":230,"icon":231,"path":232,"stem":233,"children":234,"page":56},"Deployment","i-lucide-cloud-upload","\u002Fdocs\u002Fdeployment","docs\u002F4.deployment",[235,238,242,246],{"title":70,"path":236,"stem":237},"\u002Fdocs\u002Fdeployment\u002Foverview","docs\u002F4.deployment\u002F0.overview",{"title":239,"path":240,"stem":241},"Vercel","\u002Fdocs\u002Fdeployment\u002Fvercel","docs\u002F4.deployment\u002F1.vercel",{"title":243,"path":244,"stem":245},"AWS Lambda","\u002Fdocs\u002Fdeployment\u002Faws-lambda","docs\u002F4.deployment\u002F2.aws-lambda",{"title":247,"path":248,"stem":249},"Azure Functions","\u002Fdocs\u002Fdeployment\u002Fazure-functions","docs\u002F4.deployment\u002F3.azure-functions",{"title":251,"icon":252,"path":253,"stem":254,"children":255,"page":56},"Advanced","i-lucide-brain","\u002Fdocs\u002Fadvanced","docs\u002F99.advanced",[256,260,264],{"title":257,"path":258,"stem":259},"Custom Decorator","\u002Fdocs\u002Fadvanced\u002Fcustom-decorator","docs\u002F99.advanced\u002F1.custom-decorator",{"title":261,"path":262,"stem":263},"Plugins","\u002Fdocs\u002Fadvanced\u002Fcustom-plugin","docs\u002F99.advanced\u002F2.custom-plugin",{"title":265,"path":266,"stem":267},"Custom CLI Command","\u002Fdocs\u002Fadvanced\u002Fcustom-cli-command","docs\u002F99.advanced\u002F3.custom-cli-command",[269,271,273,274,275,276,278,279,280,281,282,283,284,286,288,289,290,291,293,294,295,296,297,298,299,300,301,302,304,305,306,307,309,310,312,313,314,315,317,318,319,321,322,323,324,326,327,328,329,330,332,333,335,336,337,339,340,341,342,343,345,346,347],{"path":270},"\u002Fdocs\u002F.navigation",{"path":272},"\u002Fdocs\u002Fgetting-started\u002F.navigation",{"path":12},{"path":19},{"path":23},{"path":277},"\u002Fdocs\u002Fcore-features\u002F.navigation",{"path":34},{"path":38},{"path":42},{"path":46},{"path":50},{"path":54},{"path":285},"\u002Fdocs\u002Fmodules\u002F.navigation",{"path":287},"\u002Fdocs\u002Fmodules\u002Fauth\u002F.navigation",{"path":71},{"path":75},{"path":79},{"path":292},"\u002Fdocs\u002Fmodules\u002Fdevtools\u002F.navigation",{"path":87},{"path":90},{"path":98},{"path":102},{"path":106},{"path":114},{"path":118},{"path":122},{"path":125},{"path":303},"\u002Fdocs\u002Fmodules\u002Flogger\u002F.navigation",{"path":133},{"path":137},{"path":140},{"path":308},"\u002Fdocs\u002Fmodules\u002Fserverless\u002F.navigation",{"path":148},{"path":311},"\u002Fdocs\u002Fmodules\u002Fstorage\u002F.navigation",{"path":156},{"path":160},{"path":163},{"path":316},"\u002Fdocs\u002Fmodules\u002Fweb-sockets\u002F.navigation",{"path":171},{"path":174},{"path":320},"\u002Fdocs\u002Fmodules\u002Fschema\u002F.navigation",{"path":182},{"path":185},{"path":189},{"path":325},"\u002Fdocs\u002Fmodules\u002Fnitro\u002F.navigation",{"path":197},{"path":200},{"path":204},{"path":208},{"path":331},"\u002Fdocs\u002Fmodules\u002Fvite\u002F.navigation",{"path":216},{"path":334},"\u002Fdocs\u002Fmodules\u002Fcache\u002F.navigation",{"path":224},{"path":227},{"path":338},"\u002Fdocs\u002Fdeployment\u002F.navigation",{"path":236},{"path":240},{"path":244},{"path":248},{"path":344},"\u002Fdocs\u002Fadvanced\u002F.navigation",{"path":258},{"path":262},{"path":266},{"id":349,"title":105,"body":350,"description":1350,"extension":1351,"links":1352,"meta":1353,"navigation":60,"path":106,"seo":1354,"stem":107,"__hash__":1355},"docs\u002Fdocs\u002F3.modules\u002F11.telemetry\u002F2.instrumentation.md",{"type":351,"value":352,"toc":1342},"minimark",[353,373,376,381,473,476,483,487,638,647,658,661,780,784,787,1085,1096,1114,1117,1121,1242,1255,1258,1262,1316,1323,1327,1338],[354,355,356,360,361,364,365,368,369,372],"p",{},[357,358,359],"code",{},"@vercube\u002Ftelemetry\u002Finstrument"," is the toolkit the framework's own packages use to instrument themselves, and it is public for the same reason they need it. ",[357,362,363],{},"@vercube\u002Fstorage"," traces every operation, ",[357,366,367],{},"@vercube\u002Fcache"," counts hits and misses, ",[357,370,371],{},"@vercube\u002Fqueue"," carries trace context across a process boundary, and none of them depends on OpenTelemetry directly.",[354,374,375],{},"Nothing on this subpath touches the HTTP layer, the plugin or the DI container. A library that wants to be traceable can import it without pulling the framework in.",[377,378,380],"h2",{"id":379},"createinstrument","createInstrument",[382,383,388],"pre",{"className":384,"code":385,"language":386,"meta":387,"style":387},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createInstrument, SpanKind, ValueType } from '@vercube\u002Ftelemetry\u002Finstrument';\n\nconst instrument = createInstrument('acme-billing');\n","ts","",[357,389,390,436,442],{"__ignoreMap":387},[391,392,395,399,403,407,410,413,415,418,421,424,427,430,433],"span",{"class":393,"line":394},"line",1,[391,396,398],{"class":397},"s7zQu","import",[391,400,402],{"class":401},"sMK4o"," {",[391,404,406],{"class":405},"sTEyZ"," createInstrument",[391,408,409],{"class":401},",",[391,411,412],{"class":405}," SpanKind",[391,414,409],{"class":401},[391,416,417],{"class":405}," ValueType",[391,419,420],{"class":401}," }",[391,422,423],{"class":397}," from",[391,425,426],{"class":401}," '",[391,428,359],{"class":429},"sfazB",[391,431,432],{"class":401},"'",[391,434,435],{"class":401},";\n",[391,437,439],{"class":393,"line":438},2,[391,440,441],{"emptyLinePlaceholder":60},"\n",[391,443,445,449,452,455,458,461,463,466,468,471],{"class":393,"line":444},3,[391,446,448],{"class":447},"spNyl","const",[391,450,451],{"class":405}," instrument ",[391,453,454],{"class":401},"=",[391,456,406],{"class":457},"s2Zo4",[391,459,460],{"class":405},"(",[391,462,432],{"class":401},[391,464,465],{"class":429},"acme-billing",[391,467,432],{"class":401},[391,469,470],{"class":405},")",[391,472,435],{"class":401},[354,474,475],{},"The argument is the instrumentation scope, conventionally your package name. It shows up on every span and instrument you produce, which is how a backend tells your spans apart from the framework's.",[354,477,478,479,482],{},"Call it once at module level. Creating the toolkit creates nothing: the tracer is resolved on first span and the instruments on first use. That matters for metrics, because the OpenTelemetry metrics API has no proxy meter and an instrument created before a ",[357,480,481],{},"MeterProvider"," is registered stays a no-op for the life of the process.",[377,484,486],{"id":485},"spans","Spans",[382,488,490],{"className":384,"code":489,"language":386,"meta":387,"style":387},"export function charge(amount: number): Promise\u003CReceipt> {\n  return instrument.span('billing.charge', { kind: SpanKind.CLIENT, attributes: { 'billing.amount': amount } }, () =>\n    gateway.charge(amount),\n  );\n}\n",[357,491,492,534,605,624,632],{"__ignoreMap":387},[391,493,494,497,500,503,505,509,512,516,519,522,525,528,531],{"class":393,"line":394},[391,495,496],{"class":397},"export",[391,498,499],{"class":447}," function",[391,501,502],{"class":457}," charge",[391,504,460],{"class":401},[391,506,508],{"class":507},"sHdIc","amount",[391,510,511],{"class":401},":",[391,513,515],{"class":514},"sBMFI"," number",[391,517,518],{"class":401},"):",[391,520,521],{"class":514}," Promise",[391,523,524],{"class":401},"\u003C",[391,526,527],{"class":514},"Receipt",[391,529,530],{"class":401},">",[391,532,533],{"class":401}," {\n",[391,535,536,539,542,545,547,550,552,555,557,559,561,564,566,568,570,573,575,578,580,582,584,587,589,591,594,596,599,602],{"class":393,"line":438},[391,537,538],{"class":397},"  return",[391,540,541],{"class":405}," instrument",[391,543,544],{"class":401},".",[391,546,391],{"class":457},[391,548,460],{"class":549},"swJcz",[391,551,432],{"class":401},[391,553,554],{"class":429},"billing.charge",[391,556,432],{"class":401},[391,558,409],{"class":401},[391,560,402],{"class":401},[391,562,563],{"class":549}," kind",[391,565,511],{"class":401},[391,567,412],{"class":405},[391,569,544],{"class":401},[391,571,572],{"class":405},"CLIENT",[391,574,409],{"class":401},[391,576,577],{"class":549}," attributes",[391,579,511],{"class":401},[391,581,402],{"class":401},[391,583,426],{"class":401},[391,585,586],{"class":549},"billing.amount",[391,588,432],{"class":401},[391,590,511],{"class":401},[391,592,593],{"class":405}," amount",[391,595,420],{"class":401},[391,597,598],{"class":401}," },",[391,600,601],{"class":401}," ()",[391,603,604],{"class":447}," =>\n",[391,606,607,610,612,615,617,619,621],{"class":393,"line":444},[391,608,609],{"class":405},"    gateway",[391,611,544],{"class":401},[391,613,614],{"class":457},"charge",[391,616,460],{"class":549},[391,618,508],{"class":405},[391,620,470],{"class":549},[391,622,623],{"class":401},",\n",[391,625,627,630],{"class":393,"line":626},4,[391,628,629],{"class":549},"  )",[391,631,435],{"class":401},[391,633,635],{"class":393,"line":634},5,[391,636,637],{"class":401},"}\n",[354,639,640,642,643,646],{},[357,641,391],{}," returns whatever your function returned, unchanged. A synchronous function stays synchronous, and the span ends when the work settles however it settles: a plain return, a synchronous throw, or a rejection. A failure records the exception, sets ",[357,644,645],{},"error.type"," and marks the span as failed.",[354,648,649,650,653,654,657],{},"Server spans follow a different rule, and you do not want it here. A 4xx on a server span describes the caller, so the framework's request span is not marked failed by one. An error out of a storage driver carrying ",[357,651,652],{},"status: 404"," is a genuine failure of that operation, so ",[357,655,656],{},"instrument.span"," marks it.",[354,659,660],{},"The callback receives the span, for anything you only learn while the work runs:",[382,662,664],{"className":384,"code":663,"language":386,"meta":387,"style":387},"instrument.span('billing.charge', {}, (span) => {\n  const receipt = gateway.charge(amount);\n  span.setAttribute('billing.receipt', receipt.id);\n\n  return receipt;\n});\n",[357,665,666,700,726,758,762,770],{"__ignoreMap":387},[391,667,668,671,673,675,677,679,681,683,685,688,691,693,695,698],{"class":393,"line":394},[391,669,670],{"class":405},"instrument",[391,672,544],{"class":401},[391,674,391],{"class":457},[391,676,460],{"class":405},[391,678,432],{"class":401},[391,680,554],{"class":429},[391,682,432],{"class":401},[391,684,409],{"class":401},[391,686,687],{"class":401}," {},",[391,689,690],{"class":401}," (",[391,692,391],{"class":507},[391,694,470],{"class":401},[391,696,697],{"class":447}," =>",[391,699,533],{"class":401},[391,701,702,705,708,711,714,716,718,720,722,724],{"class":393,"line":438},[391,703,704],{"class":447},"  const",[391,706,707],{"class":405}," receipt",[391,709,710],{"class":401}," =",[391,712,713],{"class":405}," gateway",[391,715,544],{"class":401},[391,717,614],{"class":457},[391,719,460],{"class":549},[391,721,508],{"class":405},[391,723,470],{"class":549},[391,725,435],{"class":401},[391,727,728,731,733,736,738,740,743,745,747,749,751,754,756],{"class":393,"line":444},[391,729,730],{"class":405},"  span",[391,732,544],{"class":401},[391,734,735],{"class":457},"setAttribute",[391,737,460],{"class":549},[391,739,432],{"class":401},[391,741,742],{"class":429},"billing.receipt",[391,744,432],{"class":401},[391,746,409],{"class":401},[391,748,707],{"class":405},[391,750,544],{"class":401},[391,752,753],{"class":405},"id",[391,755,470],{"class":549},[391,757,435],{"class":401},[391,759,760],{"class":393,"line":626},[391,761,441],{"emptyLinePlaceholder":60},[391,763,764,766,768],{"class":393,"line":634},[391,765,538],{"class":397},[391,767,707],{"class":405},[391,769,435],{"class":401},[391,771,773,776,778],{"class":393,"line":772},6,[391,774,775],{"class":401},"}",[391,777,470],{"class":405},[391,779,435],{"class":401},[377,781,783],{"id":782},"crossing-a-process-boundary","Crossing a process boundary",[354,785,786],{},"A span parents itself on whatever is active. When the work continues in another process, the parent has to travel with the message.",[382,788,790],{"className":384,"code":789,"language":386,"meta":387,"style":387},"export function publish(job: Job): Promise\u003Cvoid> {\n  return instrument.span('acme.publish', { kind: SpanKind.PRODUCER }, () => {\n    const headers: Record\u003Cstring, string> = {};\n    instrument.inject(headers);\n\n    return transport.send(job, headers);\n  });\n}\n\nexport function consume(job: Job, headers: Record\u003Cstring, string>): Promise\u003Cvoid> {\n  return instrument.spanFrom('acme.process', { kind: SpanKind.CONSUMER }, instrument.extract(headers), () => run(job));\n}\n",[357,791,792,824,866,896,915,919,944,954,959,964,1011,1080],{"__ignoreMap":387},[391,793,794,796,798,801,803,806,808,811,813,815,817,820,822],{"class":393,"line":394},[391,795,496],{"class":397},[391,797,499],{"class":447},[391,799,800],{"class":457}," publish",[391,802,460],{"class":401},[391,804,805],{"class":507},"job",[391,807,511],{"class":401},[391,809,810],{"class":514}," Job",[391,812,518],{"class":401},[391,814,521],{"class":514},[391,816,524],{"class":401},[391,818,819],{"class":514},"void",[391,821,530],{"class":401},[391,823,533],{"class":401},[391,825,826,828,830,832,834,836,838,841,843,845,847,849,851,853,855,858,860,862,864],{"class":393,"line":438},[391,827,538],{"class":397},[391,829,541],{"class":405},[391,831,544],{"class":401},[391,833,391],{"class":457},[391,835,460],{"class":549},[391,837,432],{"class":401},[391,839,840],{"class":429},"acme.publish",[391,842,432],{"class":401},[391,844,409],{"class":401},[391,846,402],{"class":401},[391,848,563],{"class":549},[391,850,511],{"class":401},[391,852,412],{"class":405},[391,854,544],{"class":401},[391,856,857],{"class":405},"PRODUCER",[391,859,598],{"class":401},[391,861,601],{"class":401},[391,863,697],{"class":447},[391,865,533],{"class":401},[391,867,868,871,874,876,879,881,884,886,889,891,893],{"class":393,"line":444},[391,869,870],{"class":447},"    const",[391,872,873],{"class":405}," headers",[391,875,511],{"class":401},[391,877,878],{"class":514}," Record",[391,880,524],{"class":401},[391,882,883],{"class":514},"string",[391,885,409],{"class":401},[391,887,888],{"class":514}," string",[391,890,530],{"class":401},[391,892,710],{"class":401},[391,894,895],{"class":401}," {};\n",[391,897,898,901,903,906,908,911,913],{"class":393,"line":626},[391,899,900],{"class":405},"    instrument",[391,902,544],{"class":401},[391,904,905],{"class":457},"inject",[391,907,460],{"class":549},[391,909,910],{"class":405},"headers",[391,912,470],{"class":549},[391,914,435],{"class":401},[391,916,917],{"class":393,"line":634},[391,918,441],{"emptyLinePlaceholder":60},[391,920,921,924,927,929,932,934,936,938,940,942],{"class":393,"line":772},[391,922,923],{"class":397},"    return",[391,925,926],{"class":405}," transport",[391,928,544],{"class":401},[391,930,931],{"class":457},"send",[391,933,460],{"class":549},[391,935,805],{"class":405},[391,937,409],{"class":401},[391,939,873],{"class":405},[391,941,470],{"class":549},[391,943,435],{"class":401},[391,945,947,950,952],{"class":393,"line":946},7,[391,948,949],{"class":401},"  }",[391,951,470],{"class":549},[391,953,435],{"class":401},[391,955,957],{"class":393,"line":956},8,[391,958,637],{"class":401},[391,960,962],{"class":393,"line":961},9,[391,963,441],{"emptyLinePlaceholder":60},[391,965,967,969,971,974,976,978,980,982,984,986,988,990,992,994,996,998,1001,1003,1005,1007,1009],{"class":393,"line":966},10,[391,968,496],{"class":397},[391,970,499],{"class":447},[391,972,973],{"class":457}," consume",[391,975,460],{"class":401},[391,977,805],{"class":507},[391,979,511],{"class":401},[391,981,810],{"class":514},[391,983,409],{"class":401},[391,985,873],{"class":507},[391,987,511],{"class":401},[391,989,878],{"class":514},[391,991,524],{"class":401},[391,993,883],{"class":514},[391,995,409],{"class":401},[391,997,888],{"class":514},[391,999,1000],{"class":401},">):",[391,1002,521],{"class":514},[391,1004,524],{"class":401},[391,1006,819],{"class":514},[391,1008,530],{"class":401},[391,1010,533],{"class":401},[391,1012,1014,1016,1018,1020,1023,1025,1027,1030,1032,1034,1036,1038,1040,1042,1044,1047,1049,1051,1053,1056,1058,1060,1062,1064,1066,1068,1071,1073,1075,1078],{"class":393,"line":1013},11,[391,1015,538],{"class":397},[391,1017,541],{"class":405},[391,1019,544],{"class":401},[391,1021,1022],{"class":457},"spanFrom",[391,1024,460],{"class":549},[391,1026,432],{"class":401},[391,1028,1029],{"class":429},"acme.process",[391,1031,432],{"class":401},[391,1033,409],{"class":401},[391,1035,402],{"class":401},[391,1037,563],{"class":549},[391,1039,511],{"class":401},[391,1041,412],{"class":405},[391,1043,544],{"class":401},[391,1045,1046],{"class":405},"CONSUMER",[391,1048,598],{"class":401},[391,1050,541],{"class":405},[391,1052,544],{"class":401},[391,1054,1055],{"class":457},"extract",[391,1057,460],{"class":549},[391,1059,910],{"class":405},[391,1061,470],{"class":549},[391,1063,409],{"class":401},[391,1065,601],{"class":401},[391,1067,697],{"class":447},[391,1069,1070],{"class":457}," run",[391,1072,460],{"class":549},[391,1074,805],{"class":405},[391,1076,1077],{"class":549},"))",[391,1079,435],{"class":401},[391,1081,1083],{"class":393,"line":1082},12,[391,1084,637],{"class":401},[354,1086,1087,1089,1090,1092,1093,1095],{},[357,1088,905],{}," writes W3C trace context into a plain header record, ",[357,1091,1055],{}," reads it back into a context usable as a parent, and ",[357,1094,1022],{}," takes that context instead of the active one. Without this the consumer starts a trace of its own and the two halves of the same operation can never be put back together.",[354,1097,1098,1099,1101,1102,1106,1107,1110,1111,1113],{},"Call ",[357,1100,905],{}," from ",[1103,1104,1105],"strong",{},"inside"," the producer span, not before it. It writes whatever is active at that moment, so injecting first names the caller of ",[357,1108,1109],{},"publish"," as the parent and the producer span drops out of the chain. ",[357,1112,371],{}," builds its headers inside the publish span for this reason.",[354,1115,1116],{},"Both use the globally registered propagator, so they do nothing until an application installs one.",[377,1118,1120],{"id":1119},"metrics","Metrics",[382,1122,1124],{"className":384,"code":1123,"language":386,"meta":387,"style":387},"instrument\n  .counter('acme.billing.charges', {\n    description: 'Charges handed to the gateway.',\n    unit: '{charge}',\n    valueType: ValueType.INT,\n  })\n  .add(1, { 'billing.currency': currency });\n",[357,1125,1126,1131,1152,1168,1184,1200,1207],{"__ignoreMap":387},[391,1127,1128],{"class":393,"line":394},[391,1129,1130],{"class":405},"instrument\n",[391,1132,1133,1136,1139,1141,1143,1146,1148,1150],{"class":393,"line":438},[391,1134,1135],{"class":401},"  .",[391,1137,1138],{"class":457},"counter",[391,1140,460],{"class":405},[391,1142,432],{"class":401},[391,1144,1145],{"class":429},"acme.billing.charges",[391,1147,432],{"class":401},[391,1149,409],{"class":401},[391,1151,533],{"class":401},[391,1153,1154,1157,1159,1161,1164,1166],{"class":393,"line":444},[391,1155,1156],{"class":549},"    description",[391,1158,511],{"class":401},[391,1160,426],{"class":401},[391,1162,1163],{"class":429},"Charges handed to the gateway.",[391,1165,432],{"class":401},[391,1167,623],{"class":401},[391,1169,1170,1173,1175,1177,1180,1182],{"class":393,"line":626},[391,1171,1172],{"class":549},"    unit",[391,1174,511],{"class":401},[391,1176,426],{"class":401},[391,1178,1179],{"class":429},"{charge}",[391,1181,432],{"class":401},[391,1183,623],{"class":401},[391,1185,1186,1189,1191,1193,1195,1198],{"class":393,"line":634},[391,1187,1188],{"class":549},"    valueType",[391,1190,511],{"class":401},[391,1192,417],{"class":405},[391,1194,544],{"class":401},[391,1196,1197],{"class":405},"INT",[391,1199,623],{"class":401},[391,1201,1202,1204],{"class":393,"line":772},[391,1203,949],{"class":401},[391,1205,1206],{"class":405},")\n",[391,1208,1209,1211,1214,1216,1220,1222,1224,1226,1229,1231,1233,1236,1238,1240],{"class":393,"line":946},[391,1210,1135],{"class":401},[391,1212,1213],{"class":457},"add",[391,1215,460],{"class":405},[391,1217,1219],{"class":1218},"sbssI","1",[391,1221,409],{"class":401},[391,1223,402],{"class":401},[391,1225,426],{"class":401},[391,1227,1228],{"class":549},"billing.currency",[391,1230,432],{"class":401},[391,1232,511],{"class":401},[391,1234,1235],{"class":405}," currency ",[391,1237,775],{"class":401},[391,1239,470],{"class":405},[391,1241,435],{"class":401},[354,1243,1244,1246,1247,1250,1251,1254],{},[357,1245,1138],{},", ",[357,1248,1249],{},"upDownCounter"," and ",[357,1252,1253],{},"histogram"," memoize by name, so calling them on every operation is what you are meant to do. The options are read the first time and ignored afterwards.",[354,1256,1257],{},"Keep the attribute values bounded. One time series per customer id is how a metrics backend gets destroyed; put the unbounded value on the span instead, where it costs one attribute rather than one series.",[377,1259,1261],{"id":1260},"the-active-span","The active span",[382,1263,1265],{"className":384,"code":1264,"language":386,"meta":387,"style":387},"instrument.activeSpan()?.addEvent('acme.decision', { 'acme.outcome': outcome });\n",[357,1266,1267],{"__ignoreMap":387},[391,1268,1269,1271,1273,1276,1279,1282,1285,1287,1289,1292,1294,1296,1298,1300,1303,1305,1307,1310,1312,1314],{"class":393,"line":394},[391,1270,670],{"class":405},[391,1272,544],{"class":401},[391,1274,1275],{"class":457},"activeSpan",[391,1277,1278],{"class":405},"()",[391,1280,1281],{"class":401},"?.",[391,1283,1284],{"class":457},"addEvent",[391,1286,460],{"class":405},[391,1288,432],{"class":401},[391,1290,1291],{"class":429},"acme.decision",[391,1293,432],{"class":401},[391,1295,409],{"class":401},[391,1297,402],{"class":401},[391,1299,426],{"class":401},[391,1301,1302],{"class":549},"acme.outcome",[391,1304,432],{"class":401},[391,1306,511],{"class":401},[391,1308,1309],{"class":405}," outcome ",[391,1311,775],{"class":401},[391,1313,470],{"class":405},[391,1315,435],{"class":401},[354,1317,1318,1319,1322],{},"Use this when the thing you are recording is part of an operation somebody else already opened a span for. ",[357,1320,1321],{},"@vercube\u002Fauth"," records its decision this way: the check is part of serving the request, and a span of its own for something that takes microseconds buys nothing.",[377,1324,1326],{"id":1325},"cost-when-nobody-is-collecting","Cost when nobody is collecting",[354,1328,1329,1330,1333,1334,1337],{},"Every method is a no-op until the application registers a provider, so a library can instrument itself unconditionally. The OpenTelemetry API creates non-recording spans in that state, which is not free but is close to it, and with ",[357,1331,1332],{},"telemetry: false"," the framework's own instrumentation points are a single ",[357,1335,1336],{},"null"," check.",[1339,1340,1341],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":387,"searchDepth":394,"depth":438,"links":1343},[1344,1345,1346,1347,1348,1349],{"id":379,"depth":438,"text":380},{"id":485,"depth":438,"text":486},{"id":782,"depth":438,"text":783},{"id":1119,"depth":438,"text":1120},{"id":1260,"depth":438,"text":1261},{"id":1325,"depth":438,"text":1326},"Producing spans and metrics from a library of your own","md",null,{},{"title":105,"description":1350},"oT-alxTKi68FPGEFR-z5LeD4y9-uZ3m_3VJ5cD6T33M",[1357,1359],{"title":101,"path":102,"stem":103,"description":1358,"children":-1},"The Telemetry token and the package's entry points",{"title":70,"path":114,"stem":115,"description":1360,"children":-1},"Background jobs for Vercube, with one job model over BullMQ, RabbitMQ, Kafka and memory",1791443501342]