---
title: "Cloudflare Durable Objects"
description: "Learn how to add Sentry instrumentation for Cloudflare Durable Objects."
url: https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/durableobject/
---

# Cloudflare Durable Objects | Sentry for Cloudflare

Available since: `v9.16.0`

You can use the `instrumentDurableObjectWithSentry` method to instrument [Cloudflare Durable Objects](https://developers.cloudflare.com/durable-objects/).

```typescript
import * as Sentry from "@sentry/cloudflare";

class MyDurableObjectBase extends DurableObject<Env> {
  // impl
}

// Export your named class as defined in your wrangler config
export const MyDurableObject = Sentry.instrumentDurableObjectWithSentry(
  (env: Env) => ({
    dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
    tracesSampleRate: 1.0,
  }),
  MyDurableObjectBase,
);
```

## [Classes That Extend Durable Objects](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/durableobject.md#classes-that-extend-durable-objects)

`instrumentDurableObjectWithSentry` works with any class that extends `DurableObject`, not only those that extend it directly. This includes classes built on top of Durable Objects by other libraries.

For classes built on the [Cloudflare Agents SDK](https://developers.cloudflare.com/agents/) (`Agent`, `AIChatAgent`, `McpAgent`), use the dedicated `instrumentAgentWithSentry` wrapper instead (SDK version 10.69.0 or higher). It applies the same Durable Object instrumentation and adds spans for `@callable()` RPC methods as well as automatic conversation IDs. See [Cloudflare Agents SDK](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/agents-sdk.md).

## [Durable Object Storage Spans](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/durableobject.md#durable-object-storage-spans)

`instrumentDurableObjectWithSentry` automatically instruments Durable Object storage operations (`get`, `put`, `delete`, `list`). Each storage operation creates a span.

The SDK also filters out framework-internal storage operations (version 10.69.0 or higher): keys prefixed with `cf_`, `cf:`, `__ps_`, or `/` (used internally by the Agents SDK and PartyServer) don't create spans, so your traces show only your own storage access.

## [RPC Trace Propagation](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/durableobject.md#rpc-trace-propagation)

To enable distributed tracing across RPC calls to your Durable Objects, see [Distributed Tracing](https://docs.sentry.io/platforms/javascript/guides/cloudflare/tracing/distributed-tracing.md).
