aws / aws-xray-sdk-java

The official AWS X-Ray Recorder SDK for Java.
Apache License 2.0
94 stars 98 forks source link

because Subsegment too long then trace log daemonSocket.send error #370

Closed feizhangyong closed 1 year ago

feizhangyong commented 1 year ago

 when file download  Subsegment is too long  daemonSocket.send error

→ I want to fix it image

then error is fixed → db trace logs are nothing image

willarmiros commented 1 year ago

Hi @feizhangyong - feel free to submit a PR if you have a fix for this issue ready!

feizhangyong commented 1 year ago

@willarmiros sorry ,not fix it ①BatchBaseApplication.java AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard().withDefaultPlugins().withSamplingStrategy(new NoSamplingStrategy()).withSegmentListener(new SLF4JSegmentListener());

②log is too long ,so i change the log image

these log are changed, sizes are ok

③after endSegment, segment.subsegmentsList sizes also be too long why?

feizhangyong commented 1 year ago

trace map and trace logs can be see,

The log (too long) part is not output to trace log

willarmiros commented 1 year ago

If you are getting subsegment too long errors, it is likely because the metadata you are adding is too big to fit into a UDP socket which is 64 KB. I would suggest removing or trimming the metadata you're adding to be less than 64 kB.

feizhangyong commented 1 year ago

thank you control →service → logic  parent son grandson

add this, Asserting Parent-Child Relationships of Classes

@Override
protected Object processXRayTrace(ProceedingJoinPoint pjp) throws Throwable {
    Subsegment subsegment = AWSXRay.beginSubsegment(pjp.getSignature().getDeclaringTypeName() + "." + pjp.getSignature().getName());
    **subsegment.setParentId(subsegment.getParentSegment().getId());**

UDPEmitter overwrite it loop Subsegment, Iterator iterator = subsegment.getSubsegments().iterator(); while (iterator.hasNext()) { Subsegment childSubsegment = iterator.next(); sendSubsegment(childSubsegment); iterator.remove();

→After the top-level response is completed, it is possible to resolve this issue.

feizhangyong commented 1 year ago

message too long are fixed should i need to post a pullrequest to overwrite UDPEmitter ? @willarmiros

feizhangyong commented 1 year ago

If you are getting subsegment too long errors, it is likely because the metadata you are adding is too big to fit into a UDP socket which is 64 KB. I would suggest removing or trimming the metadata you're adding to be less than 64 kB. @willarmiros

thank you ,

willarmiros commented 1 year ago

No need for a PR here - glad the issue was resolved!