Skip to content

Commit c882cbe

Browse files
andrewpowellhaotianw465
authored andcommitted
Custom metadata in Spring traces (#6)
* Adding Spring modules for X-Ray. * Adding POM description * Fixing issues highlighted from PR #1 * Removing GPG maven plugin override * Reformatting code * Homologizing logging declarations * abstracting spring version to property and removing SLF4J dependency * referencing parent version for module version * removing redundant groupId from POM * adding newline at EOF * Incorporating feedback from PR #1 * Adding newline at EOF * updating POMs * Adding module into main pom * Removing beginSegment() per comments on PR #1 * Bumping version to 1.3.0 for release of Spring integration * Instating the ability for developers to override generateMetadata to create custom metadata outside of the base metadata provoided by XRayInterceptorUtils.generateMetadata.
1 parent cbcc484 commit c882cbe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

aws-xray-recorder-sdk-spring/src/main/java/com/amazonaws/xray/spring/aop/AbstractXRayInterceptor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.aspectj.lang.annotation.Around;
1212
import org.aspectj.lang.annotation.Pointcut;
1313

14+
import java.util.Map;
1415
import java.util.Optional;
1516

1617
import static com.amazonaws.xray.AWSXRay.getCurrentSegmentOptional;
@@ -46,7 +47,7 @@ public Object traceAroundMethods(ProceedingJoinPoint pjp) throws Throwable {
4647
protected Object processXRayTrace(ProceedingJoinPoint pjp) throws Throwable {
4748
try {
4849
Subsegment subsegment = AWSXRay.beginSubsegment(pjp.getSignature().getName());
49-
subsegment.setMetadata(XRayInterceptorUtils.generateMetadata(pjp, subsegment));
50+
subsegment.setMetadata(generateMetadata(pjp, subsegment));
5051
return XRayInterceptorUtils.conditionalProceed(pjp);
5152
} catch (Exception e) {
5253
AWSXRay.getCurrentSegment().addException(e);
@@ -91,4 +92,8 @@ public Object traceAroundRepositoryMethods(ProceedingJoinPoint pjp) throws Throw
9192
}
9293
}
9394

95+
protected Map<String, Map<String, Object>> generateMetadata(ProceedingJoinPoint pjp, Subsegment subsegment) {
96+
return XRayInterceptorUtils.generateMetadata(pjp, subsegment);
97+
}
98+
9499
}

0 commit comments

Comments
 (0)