aws / aws/aws-xray-sdk-java

Solution for emitting subsegment larger than 65507 bytes

Open
#395 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
100
Forks
100
PR merge metrics
No merged PRs in 30d

Description

This is a feature request for cases where SDK (not only Java SDK but for any other XRay SDKs) cannot send (sub)segments if they are larger than 65507 bytes.

Currently com.amazonaws.xray.emitters.UDPEmitter best effort to send large segments to the agent is to dissolve into subsegments and eventually throw an exception with the details if the subsegment is still larger than the maximum UDP datagram size as per [this code](https://github.com/aws/aws-xray-sdk-java/blob/cb52ccb6aff1956c721a4016954297aed9890cad/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/emitters/UDPEmitter.java#L123) and will eventually lead to a `java.io.IOException`

(details behind this limitation of the UDP protocol are [here](https://en.wikipedia.org/wiki/User_Datagram_Protocol#UDP_datagram_structure))

However, there are scenarios when we cannot avoid emitting large (sub)segments due to automatic instrumentation (for example large SQL queries). For these cases there could be some mitigation/workaround to still receive the subsegment or at least a part of it.

Options:
- Truncate segment workload (SQL query text in the particular case)
- Implement TCP communication between SDK and the agent
- Implement programmatic datagram fragmentation (as UDP doesn't support fragmentation by design)

Contributor guide

Open the contributing guide

Research direction

Start with aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/emitters/UDPEmitter.java at the linked size-handling code, and review how oversized segments are dissolved and rejected. Compare the proposed truncation, TCP, and datagram-fragmentation approaches; done requires a defined mitigation for oversized automatically instrumented segments and coverage for the selected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.