(options?: TraceMethodOptions)
| 358 | * Decorator function that can be used to capture a single lifecycle methods of the component. |
| 359 | */ |
| 360 | export function TraceMethod(options?: TraceMethodOptions): MethodDecorator { |
| 361 | return (_target: unknown, propertyKey: string | symbol, descriptor: PropertyDescriptor) => { |
| 362 | const originalMethod = descriptor.value; |
| 363 | descriptor.value = function (...args: unknown[]): ReturnType<typeof originalMethod> { |
| 364 | const now = timestampInSeconds(); |
| 365 | |
| 366 | runOutsideAngular(() => { |
| 367 | startInactiveSpan({ |
| 368 | onlyIfParent: true, |
| 369 | name: `<${options?.name ? options.name : 'unnamed'}>`, |
| 370 | op: `${ANGULAR_OP}.${String(propertyKey)}`, |
| 371 | startTime: now, |
| 372 | attributes: { |
| 373 | [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', |
| 374 | }, |
| 375 | }).end(now); |
| 376 | }); |
| 377 | |
| 378 | if (originalMethod) { |
| 379 | // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access |
| 380 | return originalMethod.apply(this, args); |
| 381 | } |
| 382 | }; |
| 383 | return descriptor; |
| 384 | }; |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * Takes the parameterized route from a given ActivatedRouteSnapshot and concatenates the snapshot's |
no test coverage detected