()
| 185 | : {}; |
| 186 | |
| 187 | const executeSpan = (): unknown => { |
| 188 | return startSpan({ name: methodName, attributes }, span => { |
| 189 | if (startNewTrace && storage) { |
| 190 | const storedContext = getStoredSpanContext(storage, methodName); |
| 191 | |
| 192 | if (storedContext) { |
| 193 | span.addLinks(buildSpanLinks(storedContext)); |
| 194 | // TODO: Remove this once EAP can store span links. We currently only set this attribute so that we |
| 195 | // can obtain the previous trace information from the EAP store. Long-term, EAP will handle |
| 196 | // span links and then we should remove this again. Also throwing in a TODO(v11), to remind us |
| 197 | // to check this at v11 time :) |
| 198 | const sampledFlag = storedContext.sampled ? '1' : '0'; |
| 199 | span.setAttribute( |
| 200 | 'sentry.previous_trace', |
| 201 | `${storedContext.traceId}-${storedContext.spanId}-${sampledFlag}`, |
| 202 | ); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | try { |
| 207 | const result = Reflect.apply(target, thisArg, args); |
| 208 | |
| 209 | if (isThenable(result)) { |
| 210 | return result.then(onFulfilled, onRejected); |
| 211 | } else { |
| 212 | return onFulfilled(result); |
| 213 | } |
| 214 | } catch (e) { |
| 215 | return onRejected(e); |
| 216 | } |
| 217 | }); |
| 218 | }; |
| 219 | |
| 220 | if (rpcMeta) { |
| 221 | return continueTrace( |
no test coverage detected