The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
#!/usr/bin/env node
;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._tracewayDebugIds=e._tracewayDebugIds||{},e._tracewayDebugIds[n]="ee90b88f-631f-4a10-a282-307f049173ab",e._tracewayDebugIdIdentifier="traceway-dbid-ee90b88f-631f-4a10-a282-307f049173ab")}catch(e){}}();import{trace as e,SpanKind as t,SpanStatusCode as r}from"@opentelemetry/api";import{NodeTracerProvider as o,BatchSpanProcessor as s}from"@opentelemetry/sdk-trace-node";import{OTLPTraceExporter as n}from"@opentelemetry/exporter-trace-otlp-http";import{defaultResource as a,resourceFromAttributes as c}from"@opentelemetry/resources";const i=new Map([["ord_1042",2]]);function p(e){const t=function(e,t){const r=i.get(e)??0;if(t>r)throw new RangeError(`cannot reserve ${t} units for order ${e}, only ${r} in stock`);return i.set(e,r-t),{orderId:e,units:t}}(e.orderId,e.units);return{orderId:e.orderId,reservation:t}}const d=process.env.TW_TOKEN||"5638c2de607f45169bcf98aa8774fe5c",l=process.env.TW_OTLP_URL||"http://localhost:8082/api/otel/v1/traces",u=process.argv[2]||"event";(async function(){const i=new o({resource:a().merge(c({"service.name":"symbolication-node-app"})),spanProcessors:[new s(new n({url:l,headers:{Authorization:`Bearer ${d}`}}))]});i.register();const m=e.getTracer("symbolication-node-app"),f=m.startSpan("POST /orders/fulfill",{kind:t.SERVER,attributes:{"http.request.method":"POST","http.route":"/orders/fulfill","url.path":"/orders/fulfill"}});try{const e=p({orderId:"ord_1042",units:3});f.setAttribute("http.response.status_code",200),f.setStatus({code:r.OK}),console.log("order fulfilled:",e)}catch(e){if(f.setAttribute("http.response.status_code",500),f.setStatus({code:r.ERROR,message:e.message}),"span"===u){m.startSpan("exception",{attributes:{"exception.type":e.name,"exception.message":e.message,"exception.stacktrace":e.stack}}).end()}else f.recordException(e);console.error(`reported ${e.name} via mode=${u}: ${e.message}`)}f.end(),await i.shutdown(),console.log(`flushed to ${l}`)})().catch(e=>{console.error("fatal:",e),process.exit(1)});
//# debugId=ee90b88f-631f-4a10-a282-307f049173ab