|
7 | 7 | import org.aspectj.lang.ProceedingJoinPoint; |
8 | 8 | import org.aspectj.lang.annotation.Around; |
9 | 9 | import org.aspectj.lang.annotation.Aspect; |
| 10 | +import org.aspectj.lang.annotation.Pointcut; |
| 11 | +import org.springframework.stereotype.Component; |
| 12 | + |
10 | 13 |
|
11 | | -/** |
12 | | - * Aspect to create spans for JGit method executions only if parent exists. |
13 | | - */ |
14 | 14 | @Aspect |
15 | 15 | public class JGitTelemetryAspect { |
16 | 16 |
|
17 | | - private static final Tracer tracer = GlobalOpenTelemetry.getTracer("org.eclipse.jgit"); |
| 17 | + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("appsmith.org.eclipse.jgit"); |
18 | 18 |
|
19 | 19 | @Around("execution(* org.eclipse.jgit..*(..))") |
20 | | - public Object createSpanForMethod(ProceedingJoinPoint joinPoint) throws Throwable { |
21 | | - Span parent = Span.current(); |
22 | | - // System.out.println("[JGitTelemetryAspect] Parent Span ID: " + parent.getSpanContext().getSpanId()); |
23 | | - if (!parent.getSpanContext().isValid()) { |
24 | | - return joinPoint.proceed(); |
25 | | - } |
| 20 | + public Object traceAppsmithBusinessLogic(ProceedingJoinPoint joinPoint) throws Throwable { |
| 21 | + String spanName = joinPoint.getSignature().getDeclaringTypeName() + "." |
| 22 | + + joinPoint.getSignature().getName(); |
26 | 23 |
|
27 | | - Span span = tracer.spanBuilder(joinPoint.getSignature().toShortString()) |
28 | | - .startSpan(); |
| 24 | + Span span = tracer.spanBuilder(spanName).startSpan(); |
29 | 25 |
|
30 | 26 | try (Scope scope = span.makeCurrent()) { |
| 27 | + System.out.println("🚀 " + span.getSpanContext().getTraceId() + " > " |
| 28 | + + span.getSpanContext().getSpanId() + " > " + spanName); |
31 | 29 | return joinPoint.proceed(); |
32 | 30 | } catch (Throwable t) { |
33 | 31 | span.recordException(t); |
|
0 commit comments