Description
Description of the feature request
I'd like tracer.captureMethod()
to allow customers to disable capturing the response as metadata on a per-method basis.
Problem statement
I find when capturing a method that returns a boatload of data, the subsegment may fail to send because the subsegment exceeds X-Ray's 64KB segment document size limit.
In my project, I'm finding it useful to capture the response by default. But, in this particular case, there's just this one method with an oversized method response. I'd want to disable response capture on a per-method basis rather than globally, so the POWERTOOLS_TRACER_CAPTURE_RESPONSE env doesn't fit my need.
Summary of the feature
I think that AWS Lambda Powertools for TypeScript should implement the Python version's decorator option.
Code examples
const tracer = new Tracer();
class MyThing {
@tracer.captureMethod({ captureResponse: false })
getBigResponse() { ... }
}
Benefits for you and the wider AWS community
Allowing customers to disable response capturing on a per-method basis would allow them to observe these subsegments in their trace timelines where they would otherwise fail to send.
Describe alternatives you've considered
I considered POWERTOOLS_TRACER_CAPTURE_RESPONSE
, but I don't want to disable response capturing across my entire app.
Additional context
None
Related issues, RFCs
None