Skip to content

Add observability for safeDeferMessage failures in queue redelivery path #1056

Open

Description

Original author: Josh Duffney (@duffney)

Context

PR #1052 introduced safeDeferMessage in the queue-processor redelivery handler, which intentionally swallows errors (a stale pop receipt must never bubble into the base error path and false-fail a healthy in-flight run). This is correct behavior — if the defer fails, the message becomes visible again on its own schedule.

However, there's currently no structured observability for how often this happens. Frequent defer failures could indicate:

  • Visibility heartbeat ticking between stop() and updateMessage (a tight race)
  • Azurite/Azure Storage Queue issues
  • Systematic pop receipt staleness

Suggestion

Add a structured log field or metric counter when safeDeferMessage catches an error, e.g.:

} catch (error) {
  console.warn(`[${this.workerName}] Failed to re-defer queue message (will resurface on its own): ${error}`, {
    event: "defer_failed",
    messageId,
  });
}

This would make it easy to set up alerts or dashboards if defer failures spike, without changing the swallow-errors semantics.

Priority

Low — this is a nice-to-have for operational visibility, not a correctness issue. The current behavior is safe (message resurfaces on its own timeout).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: observabilityLogging, metrics, tracing, and operational visibility.type: enhancementNew functionality or improvements to existing behavior.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions