Aspect for X-Ray
See original GitHub issueHi guys, Are there plans to create an example for this using Spring AOP for cross-cutting concerns like X-Ray? Currently we are trying to avoid many responsibilities in the code that don’t belong to the class, and for that we are using AOP. This is an example of what we are doing, but it is not working in the case of errors.
@Aspect
public class XRayAspect {
private Logger logger = LoggerFactory.getLogger(XRayAspect.class);
@Pointcut("@annotation(com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand) && execution(* *(..))")
public void annotationHystrixPointCut() {
}
@Before("annotationHystrixPointCut()")
public void createSubsegment(JoinPoint joinPoint) {
logger.info("---------------------- it executed before " + joinPoint);
AWSXRay.getThreadLocal().addSubsegment(AWSXRay.beginSubsegment(joinPoint.getSignature().getName()));
}
@AfterThrowing(pointcut = "annotationHystrixPointCut()", throwing = "ex")
public void addExceptiontoSubSegment(Exception ex) {
logger.error("---------------------- it happened an error ", ex);
AWSXRay.getCurrentSubsegment().addException(ex);
}
@After("annotationHystrixPointCut()")
public void finalizeSubsegment() {
logger.info("---------------------- it happened after ");
AWSXRay.endSubsegment();
}
}
I would appreciate any feedback you could provide.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Aspect-Oriented Programming for AWS X-Ray Using Spring
An aspect-oriented approach is a perfect way to implement AWS X-Ray because it keeps the underlying code clean and provides non-invasive, ...
Read more >Aspect Ratios in Underwater Imaging | X-Ray Mag
In simple words, aspect ratios are about image proportions. The right proportion can give the final kick to an image. Aspect ratio is...
Read more >X-ray Radiographic Patient Positioning - StatPearls - NCBI - NIH
The lateral aspect of the ankle is generally placed against the receptor with an X-ray beam directed from medial to lateral.
Read more >Practical Aspects of X-ray Measurement, with Special ...
We should seek a unit of quantity which is fundamental, determined by a property of the rays themselves, and measurable to an exact...
Read more >Knowing right from left on X-rays: A way to minimize errors ...
Errors in laterality identification on radiographic images can lead to unnecessary repeat radiographic exposures or even errors in therapeutic or surgical ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve added some information about multithreading to the developer guide- Using Instrumented Clients in Worker Threads Passing Segment Context between Threads in a Multithreaded Application
Hi @mwunderl, thanks! I finally found that the best approach to register the exceptions is by using an
around
aspect;before
andafter
are useful only on annotations and metadata.