Skip to content

fix: handled non-promise return from instrumented pg call#2335

Open
abhilash-sivan wants to merge 2 commits intomainfrom
fix-pg-promise-handling
Open

fix: handled non-promise return from instrumented pg call#2335
abhilash-sivan wants to merge 2 commits intomainfrom
fix-pg-promise-handling

Conversation

@abhilash-sivan
Copy link
Contributor

@abhilash-sivan abhilash-sivan commented Feb 12, 2026

refs https://jsw.ibm.com/browse/INSTA-70534

This PR is an extension of the following case: #2249

This is a split part of the following PR: #2283

@abhilash-sivan abhilash-sivan changed the title fix: handled pg where instrumented promise is not returned fix: handled non-promise return from instrumented pg call Feb 12, 2026
@abhilash-sivan abhilash-sivan marked this pull request as ready for review February 12, 2026 15:36
@abhilash-sivan abhilash-sivan requested a review from a team as a code owner February 12, 2026 15:36
spanName,
operationContext
) {
if (typeof returnValue?.then === 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is not required; we are only calling this function if the return value does not have a then property. I will remove this

}

// Case: This is the unexpected case where returnValue is not a promise
logger.debug(
Copy link
Contributor

@kirrg001 kirrg001 Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to suggest to keep this simpler for now.

  1. We only log the debug once. Even in debug mode, we do not want to flood the logs.
  2. No custom tagging. This not really a tag. We don't have a field for warnings, but this case is too special to add anything other than one debug log and the handling.

We can also discuss tmrw 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree with not adding labels to this case, as this is only edge cases, and we don't want our collector to throw type errors at the end.
+1 for debug log only. I will update the logic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you just need to figure out how to log it only once.

@abhilash-sivan abhilash-sivan force-pushed the fix-pg-promise-handling branch from 557336a to ed42573 Compare February 13, 2026 06:44
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

2 participants