-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore tracing for certain Urls /hostname #35
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @sudhirpandey thanks a lot for using Lambda Powertools and for this feature I didn't know ;-) As this is part of X-Ray extensions, perhaps we could simply export them directly here, then you have full control to follow X-Ray docs as they suggest If you'd like to take a stab at it, I'm happy to provide any guidance and write docs for it. I'm working heavily on completing the new feature flags utility to launch either this Friday evening or Monday. If you can help with this feature I can make sure it's part of the next release already ;-), otherwise I can work on that later for 1.20. Thank you!! |
Forgot to share that in the meantime you can disable Tracer auto-capturing your method's response: https://awslabs.github.io/aws-lambda-powertools-python/latest/core/tracer/#disabling-response-auto-capture from aws_lambda_powertools import Tracer
@tracer.capture_method(capture_response=False)
def fetch_sensitive_information():
return "sensitive_information"
@tracer.capture_lambda_handler(capture_response=False)
def handler(event, context):
sensitive_information = fetch_sensitive_information() |
Transferring to Roadmap to improve visibility of what's being worked on. |
@heitorlessa - would the UX be something like this? from aws_lambda_powertools import Tracer
tracer = Tracer()
tracer.ignore_endpoint(hostname="ec2.amazon.com")
def ec2_api_calls():
return "suppress_api_responses"
@tracer.capture_lambda_handler
def handler(event, context):
for x in long_list:
ec2_api_calls() alternatively your suggestion is also useful to suppress the responses: from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_method(capture_response=False)
def ec2_api_calls():
return "suppress_api_responses"
@tracer.capture_lambda_handler(capture_response=False)
def handler(event, context):
for x in long_list:
ec2_api_calls() |
I think it needs something more explicit for naming, like tracer.ignore_endpoints(hostnames=[...]) But to make it future proof, it'd be interesting to see how and whether OpenTelemetry has this capability too. |
@heitorlessa @sudhirpandey - a PR is up for this aws-powertools/powertools-lambda-python#910 |
this is now merged - it'll be available in the next release! |
hey @sudhirpandey thanks a lot for the feature request, @michaelbrewer for the implementation - this is available in the 1.24 release |
Is your feature request related to a problem? Please describe.
We are using a capture lambda handler decorations, but unfortunately our lambda is making a large amount of api calls to ec2.amazon.com, which we dont want any trace(segements) for. Since a large amount of trace subsegment is generate due to this api call( that happens in loop), we run out of xray limit for a signel trace which is 500Kb .
https://docs.aws.amazon.com/general/latest/gr/xray.html#limits_xray.
Describe the solution you'd like
If we could avoid generating trace segements for a known URL /hostname as described here https://github.com/aws/aws-xray-sdk-python#ignoring-httplib-requests, while using tracer , we would be able to get our trace limit under the limit and still use tracer. Its possible for us to use xray sdk directly and start tracing only methods we wanted but, it would be very useful to have such ignore capability in tracer too.
The text was updated successfully, but these errors were encountered: