Skip to content

feat(aws-sdk): add exception hook #2398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

project0
Copy link

Which problem is this PR solving?

Short description of the changes

  • Adds a additional hook for aws sdk exceptions

@project0 project0 requested a review from a team August 22, 2024 13:16
@project0 project0 force-pushed the feat/aws-sdk-exception branch 3 times, most recently from dd9b3b3 to 117d248 Compare August 22, 2024 19:51
@david-luna
Copy link
Contributor

Ping to component owners
@jj22ee @blumamir

@project0 project0 force-pushed the feat/aws-sdk-exception branch from 117d248 to 8de2ca6 Compare November 26, 2024 09:42
@project0 project0 requested a review from a team as a code owner November 26, 2024 09:42
@project0 project0 force-pushed the feat/aws-sdk-exception branch from 8de2ca6 to 8fe1574 Compare December 5, 2024 16:32
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.80%. Comparing base (5d60689) to head (8fe1574).
Report is 73 commits behind head on main.

Files with missing lines Patch % Lines
...entelemetry-instrumentation-aws-sdk/src/aws-sdk.ts 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2398      +/-   ##
==========================================
- Coverage   90.80%   90.80%   -0.01%     
==========================================
  Files         169      169              
  Lines        8026     8036      +10     
  Branches     1635     1637       +2     
==========================================
+ Hits         7288     7297       +9     
- Misses        738      739       +1     
Files with missing lines Coverage Δ
...entelemetry-instrumentation-aws-sdk/src/aws-sdk.ts 94.86% <90.00%> (-0.21%) ⬇️

@project0
Copy link
Author

@blumamir @jj22ee @trivikr any chance we can move forward? Its already a couple of months without any review...

@project0 project0 force-pushed the feat/aws-sdk-exception branch from 8fe1574 to 29b9dd2 Compare February 18, 2025 10:04
@dyladan
Copy link
Member

dyladan commented May 14, 2025

@jj22ee can you please take a look at this? I know it was opened before you were made a component owner but it's been sitting for quite a while.

@dyladan
Copy link
Member

dyladan commented May 14, 2025

I think this feature looks reasonable. The package already has similar hooks defined and it is well documented/tested. If it gets rebased I think we can move forward with it. @jj22ee please comment if you disagree otherwise this will get my 👍

@jj22ee
Copy link
Contributor

jj22ee commented May 15, 2025

Hey, sorry for not taking a look at this, thanks @dyladan for the ping.
This provides useful custom span configuration by user in the event of an exception, so this change looks good.

@project0 I suppose this solves #1765 indirectly for you because this allows you to update Span status or unrecord the Span exception via the new exceptionHook?

Copy link
Contributor

@jj22ee jj22ee left a comment

Choose a reason for hiding this comment

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

Just a bit of cleanup. After you resolve the conflicts + merge/rebase with main I'll approve.

@@ -53,6 +53,7 @@ aws-sdk instrumentation has few options available to choose from. You can set th
| ----------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `preRequestHook` | `AwsSdkRequestCustomAttributeFunction` | Hook called before request send, which allow to add custom attributes to span. |
| `responseHook` | `AwsSdkResponseCustomAttributeFunction` | Hook for adding custom attributes when response is received from aws. |
| `exceptionHook` | `AwsSdkExceptionCustomAttributeFunction` | Hook for adding custom attributes when exception is received from aws. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `exceptionHook` | `AwsSdkExceptionCustomAttributeFunction` | Hook for adding custom attributes when exception is received from aws. |
| `exceptionHook` | `AwsSdkExceptionCustomAttributeFunction` | Hook for adding custom attributes when exception is received from aws. |

);
span.setAttribute('error.from.exception.hook', err.name);
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@dyladan
Copy link
Member

dyladan commented Jul 9, 2025

Please resolve the conflicts and we can get this merged

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

Successfully merging this pull request may close these issues.

6 participants