CCloud Releases
Home
Following

Cloud Releases

Service catalogues and updates come from each provider's public product listing and announcements.

Explore

  • Home
  • Latest updates
  • Following

About

  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Providers

  • Amazon Web Services
  • Microsoft Azure
  • Google Cloud
  • Cloudflare

Not affiliated with any cloud provider. Product names and logos belong to their owners.

  1. Providers
  2. ›Cloudflare
  3. ›Workers
  4. ›Update

Feature•Sep 25, 2026

Workers tracing — new getActiveSpan(), recordException(), startSpan(), and setAttributes() APIs

WorkersCloudflare · Developer platform

Custom spans in Workers now support more of the OpenTelemetry span API, so you can instrument more of your code and record errors directly on your spans.

  • tracing.startSpan(name) creates a span without making it the active span, and returns it. Other spans do not nest under it. Call span.end() when the operation is complete.
  • tracing.getActiveSpan() returns the currently active span. Use it to annotate the current span from helper functions and libraries without passing the span object through your code. Outside any custom span, it returns the invocation's root span.
  • span.recordException(exception) records an exception event on a span. It accepts an Error, a string, or an object with a code, name, or message.
  • span.setAttributes(attributes) sets multiple attributes at once. setAttribute() and setAttributes() now return the span, so you can chain calls.

src/index.js

import { tracing } from "cloudflare:workers"; export default { async fetch(request, env) { const user = await authenticate(request, env); // Annotate the invocation's root span tracing.getActiveSpan()?.setAttributes({ "user.id": user.id, "user.plan": user.plan, }); const span = tracing.startSpan("load-profile"); try { return Response.json(await loadProfile(env, user.id)); } catch (err) { span.recordException(err); throw err; } finally { span.end(); } }, };

src/index.ts

import { tracing } from "cloudflare:workers"; export default { async fetch(request: Request, env: Env): Promise<Response> { const user = await authenticate(request, env); // Annotate the invocation's root span tracing.getActiveSpan()?.setAttributes({ "user.id": user.id, "user.plan": user.plan, }); const span = tracing.startSpan("load-profile"); try { return Response.json(await loadProfile(env, user.id)); } catch (err) { span.recordException(err as Error); throw err; } finally { span.end(); } }, };

For more details, refer to the custom spans documentation.

Read the original announcement↗

More from Workers

All Workers updates →
  1. Workers subrequests now preserve context for BYOIP destinations

    Cloudflare now preserves Workers context when a subrequest targets a Cloudflare-proxied hostname using Bring Your Own IP (BYOIP). These requests are identified as Cloudflare-to-Cloudflare traffic instead of external Internet traffic.

    Workers•Feature•Oct 13, 2026
  2. Cloudflare API MCP server sends Workers Issues as MCP Events

    Workers Issues provides built-in error monitoring for Cloudflare Workers. It detects production failures and groups related failures into issues without an SDK or application wrapper.

    Workers•Feature•Oct 13, 2026
  3. Workers Builds now posts preview URLs in seconds

    Workers Builds now consistently posts preview URLs to GitHub pull requests and GitLab merge requests within a few seconds of a build completing, so you can start testing and reviewing your changes sooner. Previously, posting preview URLs could often take minutes.

    Workers•Preview•Oct 12, 2026
  4. More time for requests to finish during Workers runtime updates

    Pending requests and connections to Workers now have a grace period of up to 20 minutes during Workers runtime updates. Previously, the grace period was up to 30 seconds.

    Workers•Feature•Oct 12, 2026
  5. Run OpenCode 2.0 on Cloudflare with the Agents SDK

    The Agents SDK now supports OpenCode 2.0 through the experimental OpenCodeHarness. Run OpenCode inside a plain Durable Object, with sessions stored in SQLite and Lifecycle jobs that wake interrupted work after eviction.

    Workers•Feature•Oct 12, 2026