# Sentry Bedrock Tracing: Keep Token Counts Without Capturing Prompts

Set prompt and response capture explicitly in the Sentry JavaScript and Python SDKs, and verify streamed Bedrock traces with synthetic data.

By Paras Madan | 2026-11-22


You don't need to send customer prompts to Sentry to see whether a Bedrock model got slower or started using more tokens. You do need to set the capture policy in the right place. The JavaScript and Python SDKs don't use the same rules.

[Sentry's November 20 changelog](https://sentry.io/changelog/bedrock-tracing-python-javascript/) documents Bedrock tracing across both SDKs. This is a cross-SDK announcement, not the release date of the packages: the [Python 2.75.0 release](https://github.com/getsentry/sentry-python/releases/tag/2.75.0) shipped November 12 and the [JavaScript 11.13.0 release](https://github.com/getsentry/sentry-javascript/releases/tag/11.13.0) shipped November 16.

## JavaScript: override capture for Bedrock

JavaScript 11.13.0's AWS integration records Bedrock content by default. Its scope includes `Converse`, `ConverseStream`, `InvokeModel` and `InvokeModelWithResponseStream`. If the SDK already has tracing enabled, check this before upgrading a service that handles customer text.

Add this integration entry to the server-side initialization, alongside your existing integrations. If you already configure `awsIntegration`, update that entry rather than adding a second one:

```javascript
Sentry.awsIntegration({
  recordInputs: false,
  recordOutputs: false,
})
```

Those options apply to Bedrock. If you want the same policy across other supported AI integrations, review the SDK-wide `dataCollection.genAI` policy as well. An explicit Bedrock setting takes precedence. In particular, a service-wide setting of `inputs: false` is not a guarantee if a local integration configuration sets `recordInputs: true`. The [SDK override tests](https://github.com/getsentry/sentry-javascript/pull/26414) cover that precedence.

## Python: turn off the two AI fields explicitly

With Python 2.75.0, Boto3 can appear automatically in the integrations when installed. The Bedrock-specific spans cover `Converse` and `ConverseStream`. Don't expect the same Python span for every method listed in the JavaScript release.

The [versioned Python implementation](https://github.com/getsentry/sentry-python/blob/2.75.0/sentry_sdk/integrations/boto3/_services/bedrock.py) uses the legacy PII setting to decide whether to record message content when no explicit collection policy is configured. But the code can still add a tool schema in that path. A schema can disclose internal tool names, descriptions or example arguments, even if the chat text is absent.

For a metadata-only Bedrock trace, set both values inside your existing `data_collection` policy:

```python
"gen_ai": {
    "inputs": False,
    "outputs": False,
}
```

These are Python's snake-case option names. If you're moving from `send_default_pii` to `data_collection`, review the rest of the policy as part of that change. The [2.75.0 configuration code](https://github.com/getsentry/sentry-python/blob/2.75.0/sentry_sdk/data_collection.py) gives an explicitly supplied policy precedence and uses category defaults for omitted fields. Paste the two AI settings into a reviewed policy rather than assuming a partial object preserves your prior choices for headers and other data.

## Prove that the span exists and the text doesn't

Start in a separate staging project with tracing on. Make a non-streamed request with invented text such as `CANARY-PROMPT-482: name a fictional planet`. Add a different marker to a synthetic system instruction and tool description. Repeat on the streamed method your app uses and consume the test response to completion. Record a trace ID so you inspect the request you actually sent, rather than an older one.

Check for a Bedrock span, its model identifier and the usage fields your response provided. Then inspect the span attributes for input messages, system instructions, tool definitions and output messages. Those content fields should be absent under the intended policy. If the whole span is missing, troubleshoot tracing and sampling before calling the privacy test a pass.

Do one more pass over the other events attached to the test request. An application logger that prints request bodies, a custom span attribute or an error that includes the prompt is a separate path. The Bedrock integration switches cannot remove content your code logs on its own.

I would make this two-part test a release check: the trace still tells you which model ran and how long it took, and it carries none of the fixture text. Run it again when upgrading either SDK or changing the service's collection settings.

I'm Paras. I work at the intersection of AI, engineering and distribution.

I help AI teams turn deployment and observability details into technical writing developers can use.

[Book a 30-minute call](https://cal.com/paras-madan/30min)
