Skip to content

fix(api): end telemetry spans when middleware throws - #1012

Open
wangjingshuiku wants to merge 1 commit into
Blobscan:mainfrom
wangjingshuiku:wangjingshuiku-maint-20260824
Open

fix(api): end telemetry spans when middleware throws#1012
wangjingshuiku wants to merge 1 commit into
Blobscan:mainfrom
wangjingshuiku:wangjingshuiku-maint-20260824

Conversation

@wangjingshuiku

Copy link
Copy Markdown

Checklist

  • My change requires a documentation update, and I have done it. (Not applicable: no public API or configuration changes.)
  • I have added tests to cover my changes. (No new test was added; the API package type-check passes.)
  • I have filled out the description and linked the related issues. (No related issue.)

Description

End the active middleware span from a finally block so it is closed on both successful requests and exceptions from downstream middleware. Return values and error propagation remain unchanged.

Motivation and Context (Optional)

The previous implementation called span.end() only after next() resolved. If next() threw, the function exited before ending the span, leaving incomplete telemetry.

Validation: pnpm --filter @blobscan/api type-check

Related Issue (Optional)

None.

Screenshots (if appropriate):

Not applicable.

Signed-off-by: wangjingshuiku <wangjingshuiku@163.com>
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0507cd0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant