{"version":3,"file":"setHttpServerSpanRouteAttribute.js","sources":["../../../src/utils/setHttpServerSpanRouteAttribute.ts"],"sourcesContent":["import { getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core';\n\n/**\n * Set the `http.route` attribute on the root HTTP server span for the current trace.\n *\n * No-op when there is no active span, no root span, or the root span is not an\n * `http.server` span — so framework instrumentations can call this unconditionally\n * without risking attribute pollution on non-HTTP root spans.\n */\nexport function setHttpServerSpanRouteAttribute(route: string): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n const rootSpan = getRootSpan(activeSpan);\n if (!rootSpan) {\n return;\n }\n if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') {\n return;\n }\n rootSpan.setAttribute('http.route', route);\n}\n"],"names":[],"mappings":";;AASO,SAAS,gCAAgC,KAAA,EAAqB;AACnE,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA;AAAA,EACF;AACA,EAAA,MAAM,QAAA,GAAW,YAAY,UAAU,CAAA;AACvC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA;AAAA,EACF;AACA,EAAA,IAAI,WAAW,QAAQ,CAAA,CAAE,IAAA,CAAK,4BAA4B,MAAM,aAAA,EAAe;AAC7E,IAAA;AAAA,EACF;AACA,EAAA,QAAA,CAAS,YAAA,CAAa,cAAc,KAAK,CAAA;AAC3C;;;;"}