Skip to content

Where to put xray_recorder.configure(...AsyncContext()) in AWS Lambda functions? #203

Closed
@xjia1

Description

@xjia1

If running inside AWS Lambda, and the function is using asyncio so I need

xray_recorder.configure(service='...', context=AsyncContext())

However if I put it in the global, or in my lambda handler, I always get errors like

cannot find the current segment/subsegment, please make sure you have a segment open
No segment found, cannot begin subsegment

I think it's because Lambda has its own segment created, presumably it's the LambdaContext defined in aws_xray_sdk/core/lambda_launcher.py?

So how should I configure it properly so that @xray_recorder.capture_async can work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions