---
title: "Scrubbing data"
url: https://develop.sentry.dev/sdk/telemetry/spans/scrubbing-data/
---

# Scrubbing data

🚧 This document is work in progress.

This document uses key words such as "MUST", "SHOULD", and "MAY" as defined in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement levels.

## [Scrubbing data with `beforeSendSpan`](https://develop.sentry.dev/sdk/telemetry/spans/scrubbing-data.md#scrubbing-data-with-beforesendspan)

This callback MUST NOT allow the removal of any spans from the span tree. It receives a deep copy of a span.

```bash
[
  {
    'name': 'GET /',
    'attributes': [
      'http.request.method': 'GET',
      'http.response.status_code': 200,
    ]
  },
]
```

Users MAY mutate any exposed properties to perform sanitation on sensitive data or PII. The return value of `beforeSendSpan` MUST be merged with the original span prior to emission.
