Skip to content

Commit 58a5177

Browse files
authored
fix(cloudflare): Allow non-uuid instance IDs in workflows (#14470)
In this PR we removed the UUID limitations around `instanceId`s in Cloudflare workflows. - getsentry/sentry-javascript#17121 This PR updates the docs to reflect this change!
1 parent 606e3f0 commit 58a5177

File tree

1 file changed

+12
-4
lines changed
  • docs/platforms/javascript/guides/cloudflare/features

1 file changed

+12
-4
lines changed

docs/platforms/javascript/guides/cloudflare/features/workflows.mdx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ You can use the `instrumentWorkflowWithSentry` method to instrument [Cloudflare
99
Workflows](https://developers.cloudflare.com/workflows/).
1010

1111
Because workflows can be hibernated and lose all state, we use the workflows
12-
`instanceId` as the Sentry `trace_id` to link all steps together. We also use
13-
the last 4 characters of the `instanceId` for sampling to ensure all steps have
14-
the same sampling decision. If you are starting your workflows with a custom
15-
`instanceId`, ensure you use valid random UUIDs either with or without dashes.
12+
`instanceId` to generate the Sentry `trace_id` to link all steps together into a
13+
single trace. If `instanceId` is a UUID (with or without dashes), it will be
14+
used directly as the `trace_id`. If not, we SHA1 hash the `instanceId` to
15+
generate a deterministic `trace_id`.
16+
17+
We use the last 4 characters of the `trace_id` for sampling to ensure all steps
18+
have the same sampling decision.
19+
20+
Because the `instanceId` is used for both the `trace_id` and for sampling
21+
decisions, you should ensure that the `instanceId` is unique for each workflow
22+
instance. If you are using custom UUIDs, you should ensure the last 4 digits are
23+
sufficiently random to ensure a good distribution of sampling decisions.
1624

1725
```typescript
1826
import { WorkflowEntrypoint, WorkflowStep, WorkflowEvent } from 'cloudflare:workers';

0 commit comments

Comments
 (0)