Skip to content

Payment service: charge span leaks and misattributes exceptions on validation errors #3275

@ayoisaiah

Description

@ayoisaiah

Bug Report

Which version of the demo you are using? 0982a02

Symptom

The manually-created charge span in the payment service (charge.js) is not ended when some validation errors occur, which means the span is never exported. Exceptions are also recorded on the parent gRPC span.

Image

What is the expected behavior?

The charge span should always be ended, regardless of whether the charge succeeds or fails. Also, when an error occurs inside charge(), the exception and ERROR status should be recorded on the charge span where the failure originates. The parent span should reflect the failure via
setStatus() only, without duplicating the exception.

Image

What is the actual behavior?

The charge span is called at the top of the function, but three validation error paths throw without ever calling span.end().

Reproduce

Attempt to place an order with expired card. Change the Month and Year fields under Payment Method to January and 2026 respectively.

Observe in Jaeger that the charge span is not present for the corresponding trace and that the auto-instrumented parent gRPC span incorrectly owns the exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions