aws / aws/aws-xray-sdk-java

Adding Subsegment.setShouldPropagate(boolean)

Open
#346 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

Currently there exists `Subsegment.shouldPropagate()` which for regular subsegments always returns true and is only false for some use-cases of `AWSXrayRecorder.beginSubsegment()` (when there is no segment in the thread context).

`SubsegmentImpl` already returns `shouldPropagate()` based on a variable, though no-where sets this value to anything other than `true`.

My use-case is, I have a code path that generates thousands of xray subsegments (calls thousands of RPCs), which in aggregate (including downstream segments), exceeds the AWSXRay trace document size limit. I was looking for a way to suppress downstream x-ray segments in other APIs and this seemed to be named for this use-case.

Alternatively, I've been considering explicitly setting `Segment.setSampled(false)` to `false` once a certain number of subsegments are created, and then back to `true` before the Segment is completed. This would also allow me to stop generating downstream segments from my other apis (as we propagate `sampled` to our downstream).

Is there another alternative to help me manage segment generation/trace document size during massive fanout like this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.