# Workers - Workers tracing now supports custom spans

Publisher-attributed story with a reviewed brief or permitted publisher paragraph. The original publisher is responsible for the linked reporting.

- Publisher: Cloudflare Developers
- Category: Cloud
- Original publication time: 2026-06-16T00:00:00Z
- First observed by NexusTechWire: 2026-10-01T15:54:33Z
- Original source: https://developers.cloudflare.com/changelog/post/2026-06-16-custom-spans/
- NexusTechWire record: https://nexustechwire.com/news/news-09b1b3abf7766a7733a0

## From the publisher

You can now create custom trace spans in your Workers code using tracing.enterSpan(). Custom spans appear alongside the automatic platform instrumentation (fetch calls, KV reads, D1 queries, and other platform operations) in your traces and OpenTelemetry exports, with correct parent-child nesting. The API is available via import \{ tracing \} from "cloudflare:workers" or through the handler context as ctx.tracing: import \{ tracing \} from "cloudflare:workers"; export default \{ async fetch(request, env, ctx) \{ return tracing.enterSpan("handleRequest", async (span) =\> \{ span.setAttribute("url.path", new URL(request.url).pathname); const data = await env.MY\_KV.get("key"); return new Response(data); \}); \}, \}; Spans nest automatically based on the JavaScript async context, and are auto-ended when the callback returns or its returned promise settles.

Source license: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Publisher excerpt shortened and converted to plain text. Original source license applies.

Read the full original: [Cloudflare Developers](https://developers.cloudflare.com/changelog/post/2026-06-16-custom-spans/)

This record does not reproduce the complete article or represent independent confirmation of every source claim.
