{"version":3,"file":"interceptor-DQg3cR_9.mjs","names":[],"sources":["../src/cli/telemetry/interceptor.ts"],"sourcesContent":["import { trace, SpanStatusCode } from \"@opentelemetry/api\";\nimport type { Interceptor } from \"@connectrpc/connect\";\n\n/**\n * Create a Connect-RPC interceptor that records OTLP spans for each RPC call.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @returns Tracing interceptor\n */\nexport function createTracingInterceptor(): Interceptor {\n  return (next) => async (req) => {\n    const tracer = trace.getTracer(\"tailor\");\n\n    return tracer.startActiveSpan(`rpc.${req.method.name}`, async (span) => {\n      span.setAttribute(\"rpc.method\", req.method.name);\n      span.setAttribute(\"rpc.service\", \"OperatorService\");\n      span.setAttribute(\"rpc.system\", \"connect-rpc\");\n\n      try {\n        const response = await next(req);\n        span.setStatus({ code: SpanStatusCode.OK });\n        return response;\n      } catch (error) {\n        span.setStatus({ code: SpanStatusCode.ERROR });\n        if (error instanceof Error) {\n          span.recordException(error);\n        }\n        throw error;\n      } finally {\n        span.end();\n      }\n    });\n  };\n}\n"],"mappings":"+DASA,SAAgB,0BAAwC,CACtD,MAAQ,IAAS,KAAO,IACP,EAAM,UAAU,QAEnB,CAAC,CAAC,gBAAgB,OAAO,EAAI,OAAO,OAAQ,KAAO,IAAS,CACtE,EAAK,aAAa,aAAc,EAAI,OAAO,IAAI,EAC/C,EAAK,aAAa,cAAe,iBAAiB,EAClD,EAAK,aAAa,aAAc,aAAa,EAE7C,GAAI,CACF,IAAM,EAAW,MAAM,EAAK,CAAG,EAE/B,OADA,EAAK,UAAU,CAAE,KAAM,EAAe,EAAG,CAAC,EACnC,CACT,OAAS,EAAO,CAKd,MAJA,EAAK,UAAU,CAAE,KAAM,EAAe,KAAM,CAAC,EACzC,aAAiB,OACnB,EAAK,gBAAgB,CAAK,EAEtB,CACR,QAAU,CACR,EAAK,IAAI,CACX,CACF,CAAC,CAEL"}