---
title: "AWS Lambda tracing with the Python SDK"
description: "Version 3.0 of the Sentry Python SDK improves trace-connectedness for AWS Lambda functions by linking synchronous Invoke API calls to the initiating client trace. Before 3.0, traces were only connected for HTTP-triggered invocations where trace headers arrived in the event. The SDK picks up trace metadata from the custom client context passed to a RequestResponse Lambda invocation via boto3, with Boto3Integration handling this automatically; for non-Python callers, sentry-trace and baggage can be manually added under the custom field in the client context. Trace propagation also works across SQS queues and SNS topics by passing sentry-trace and baggage as message attributes, which links the producer’s trace to the consumer’s trace. Additionally, Amazon Bedrock Converse and ConverseStream calls are traced with rich GenAI spans that include model inputs, model outputs, and token usage among other information."
---

# AWS Lambda tracing with the Python SDK

[Sentry](https://yomu.fyi/company/sentry) · Nov 30, 2026

**Type:** Announcement

## Summary

Version 3.0 of the Sentry Python SDK improves trace-connectedness for AWS Lambda functions by linking synchronous Invoke API calls to the initiating client trace. Before 3.0, traces were only connected for HTTP-triggered invocations where trace headers arrived in the event. The SDK picks up trace metadata from the custom client context passed to a RequestResponse Lambda invocation via boto3, with Boto3Integration handling this automatically; for non-Python callers, sentry-trace and baggage can be manually added under the custom field in the client context. Trace propagation also works across SQS queues and SNS topics by passing sentry-trace and baggage as message attributes, which links the producer’s trace to the consumer’s trace. Additionally, Amazon Bedrock Converse and ConverseStream calls are traced with rich GenAI spans that include model inputs, model outputs, and token usage among other information.

## Context

Before version 3.0 of the Sentry Python SDK, trace-connectedness for AWS Lambda was limited to HTTP-triggered invocations where trace headers arrived in the event. Synchronous Lambda Invoke API calls and asynchronous messaging via SQS and SNS were not linked. This update addresses those gaps, and also adds tracing for Amazon Bedrock calls.

## Approach / What changed

The Sentry Python SDK version 3.0 adds trace propagation for synchronous AWS Lambda Invoke API calls by reading trace metadata from the custom client context passed to the invocation. It also links SQS and SNS publishers to consumers by passing trace metadata as message attributes. Both mechanisms are handled automatically when the SDK’s Boto3Integration is active, or can be done manually by the caller. Amazon Bedrock Converse and ConverseStream calls are also traced with rich GenAI spans.

## Takeaways

- Sentry Python SDK 3.0 propagates traces for synchronous Lambda Invoke API calls by reading sentry-trace and baggage from the custom client context.
- Trace metadata can be passed across SQS and SNS by including sentry-trace and baggage as message attributes, linking producer and consumer traces.
- Amazon Bedrock Converse and ConverseStream calls are traced with GenAI spans that capture model inputs, outputs, and token usage.

## FAQ

### Do I need to add code in the Lambda function to receive the trace?

The SDK's AwsLambdaIntegration reads the sentry-trace and baggage values from the custom client context on the receiving Lambda function, so no additional code is needed in the Lambda handler.

### Can I propagate traces from a non-Python caller?

Yes, if the caller is not written in Python and cannot use the SDK's Boto3Integration, you must manually put sentry-trace and baggage values under custom in the client context when invoking the Lambda.

### How do I manually pass trace metadata for SQS?

For SQS, pass sentry-trace and baggage as message attributes of type String when calling send\_message. The SDK's consumer side automatically reads these attributes and links the producer's trace to the consumer's trace.

**Tags:** [AWS](https://yomu.fyi/topic/aws), [AWS Lambda](https://yomu.fyi/topic/aws-lambda), [Python](https://yomu.fyi/topic/python), [Sentry](https://yomu.fyi/topic/sentry), [Tracing](https://yomu.fyi/topic/tracing)

- Source: [Sentry](https://blog.sentry.io/sentry-python-aws-lambda)
- Source URL: https://blog.sentry.io/sentry-python-aws-lambda
- Ingested by Yomu: 2026-11-30T21:00:15.167Z

[Read original post](https://blog.sentry.io/sentry-python-aws-lambda)
