Feature request: ability to capture HTTP requests #675
Labels
completed
This item is complete and has been merged/shipped
feature-request
This item refers to a feature request for an existing or new utility
tracer
This item relates to the Tracer Utility
Milestone
Description of the feature request
Problem statement
As a customer using
Tracer
I want to be able to trace HTTP requests made to hosts/APIs just like I do with AWS SDK clients.Summary of the feature
Other runtimes support this feature and currently Powertools for TypeScript supports it as well via the escape hatch mechanism:
This unit of work aims at adding a more ergonomic way of enabling this plus providing examples & documentation that use more common request libraries like
axios
.Before staring the implementation there are two points on which I need a feedback:
1
The Python version of AWS Lambda Powertools, in addition to the above, supports another feature that allows to ignore arbitrary hostnames so that they don't appear in the traces, this is possible because the
aws-xray-sdk-python
supports the feature:At the moment the
aws-xray-sdk-node
doesn't support it, although it's on the team's backlog according to this answer on an issue I've opened: aws/aws-xray-sdk-node#480Question: Are we OK with moving forward without this feature? If the feature ever lands in the SDK we could add it.
2
The Python version of Powertools also captures automatically all requests (and AWS SDK clients) so that they are traced whenever a customer uses
Tracer
. For AWS SDK this is not possible since that we have two potential SDK versions being used (v2 & v3) and after this discussion we have opted to not capture SDK clients automatically and make it opt-in.For HTTP requests this could still be a possibility given that we could patch the
http
module which is then used by other higher level request packages (i.e.axios
).Question: Do we want to make capturing HTTP requests opt-in to be consistent with TypeScript behaviour of all captures are opt-in OR do we want to capture HTTP requests by default and have customers opt-out (in this second scenario all customers would always be importing the
http
module)?Code examples
Example 1:
Example 2:
Benefits for you and the wider AWS community
Additional features available in using Tracer from this library.
Describe alternatives you've considered
Continue using the escape hatch method.
Additional context
N/A
Related issues, RFCs
#275
The text was updated successfully, but these errors were encountered: