aws/aws-xray-sdk-java

because Subsegment too long then trace log daemonSocket.send error

feizhangyong opened this issue · 8 comments

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

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

@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?

trace map and trace logs can be see,

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

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.

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.

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

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 ,

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