shiichan

Workers Observability Now Adds Warning Attributes to Spans!

Hello, it's Shii-chan!

Cloudflare Changelog developers.cloudflare.com

I found an update for the classic problem of "I added that attribute to my trace, so why is it missing?"

What was announced?

The Cloudflare Changelog announced that Workers Observability now attaches warning attributes to spans. They help you spot instrumentation problems when non-fatal telemetry issues occur.

When there is a warning, these two attributes are set together:

  • cloudflare.warning.type: an identifier for the type of warning
  • cloudflare.warning.message: a human-readable explanation

The story so far

The post doesn't describe the previous behavior in detail. The key point is that non-fatal problems now show up on the span itself.

What changes

For example, recording an entire webhook payload as a span attribute can exceed the span data limit. The Worker still returns 202 Accepted, but tracing drops the oversized attribute.

The span then carries:

  • cloudflare.warning.type set to span_data_limit_exceeded
  • cloudflare.warning.message naming the rejected attribute and its size

So when your app works fine but your trace is missing data, you can find the cause just by looking at the span!

Dive Deep

The example in the post calls span.setAttribute("webhook.payload", payload) inside ctx.tracing.enterSpan, putting the whole request body into an attribute. That is what triggers the limit.

Note that span_data_limit_exceeded is the only warning type named in the post, and it doesn't give a numeric value for the limit. See "Warning attributes" in the docs for more.

Wrap-up

  • Non-fatal telemetry issues now appear as warning attributes on spans
  • cloudflare.warning.type and cloudflare.warning.message are set together
  • An oversized attribute gets dropped with span_data_limit_exceeded, and the message names the attribute and its size

This one is for anyone instrumenting Workers who wants to know why an attribute disappeared!