Skip to content
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

refactor(telemetry): add functionality to @withTelemetryContext #5816

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nkomonen-amazon
Copy link
Contributor

@nkomonen-amazon nkomonen-amazon commented Oct 19, 2024

See each commit for the specific change. But this has multiple improvements to the @withTelemetryContext decorator.

The main change to note:

  • Adding the @withTelemetryContext decorator to a method can wrap thrown errors with context about that function. This helps us to build some sort of stack trace in the reasonDesc of our telemetry when errors are thrown.
  • The decorator allows for minimal diffs to the code. It is replacing this previous code which would cause a diff in the column indentation since all the method code needed to be in a callback

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@nkomonen-amazon nkomonen-amazon requested a review from a team as a code owner October 19, 2024 03:16
@nkomonen-amazon nkomonen-amazon force-pushed the addErrorContext branch 2 times, most recently from 7d2d5c1 to b2cbc3f Compare October 21, 2024 18:09
The withTelemetryContext() decorator adds context to telemetry
but not thrown errors.

Solution:

Adding this decorator to a method will add context to any thrown exceptions.
This is helpful in telemetry as it will provide information about the caller.

Signed-off-by: nkomonen-amazon <[email protected]>
Now the @withTelemetryContext decorator can have a method emit when called
and will also add the `source` field automatically.

By default it does not emit.

Signed-off-by: nkomonen-amazon <[email protected]>
Signed-off-by: nkomonen-amazon <[email protected]>
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