Adding Subsegment.setShouldPropagate(boolean)

Open
#346 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java

Research direction

Start by reviewing Subsegment.shouldPropagate(), SubsegmentImpl, and AWSXrayRecorder.beginSubsegment() to understand the existing propagation behavior. Determine whether the requested setter or another supported mechanism should control downstream segment generation during massive fanout, and define completion around a documented API behavior with coverage for the stated use case.

Written by the indexing model from the issue text.

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?

Dominant language
Java
Stars
100
Forks
100
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-xray-sdk-java

All issues in aws/aws-xray-sdk-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.