Skip to content

chore: ignore errors in telemetry handlers#1058

Merged
crowecawcaw merged 3 commits intoaws-deadline:mainlinefrom
crowecawcaw:telemetry-error-handling-decorator
Apr 7, 2026
Merged

chore: ignore errors in telemetry handlers#1058
crowecawcaw merged 3 commits intoaws-deadline:mainlinefrom
crowecawcaw:telemetry-error-handling-decorator

Conversation

@crowecawcaw
Copy link
Copy Markdown
Contributor

Fixes: #755

What was the problem/requirement? (What/Why)

Telemetry handlers could fail causing the library/CLI to not work correctly. Telemetry is never required to function though.\

What was the solution? (How)

Ignore any telemetry errors so it never breaks the main application.

What is the impact of this change?

Better resilience in the event of telemetry issues.

How was this change tested?

Unit tests

Was this change documented?

n/a

Does this PR introduce new dependencies?

No

Is this a breaking change?

No

Does this change impact security?

No


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions Bot added the waiting-on-maintainers Waiting on the maintainers to review. label Mar 18, 2026
@crowecawcaw crowecawcaw marked this pull request as ready for review March 18, 2026 20:36
@crowecawcaw crowecawcaw requested a review from a team as a code owner March 18, 2026 20:36
Comment thread src/deadline/client/api/_telemetry.py Outdated
def is_initialized(self) -> bool:
return self._initialized

@_swallow_exceptions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is a function like this really need the swallow exception decorator?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would think only the record functions should have ignore exceptions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks safe enough to me without it. Instead of looking at each method for risks, I just applied it everywhere that it wouldn't break something for completeness.

I can scale this back and just apply it to the heavier, top-level methods.

karthikbekalp
karthikbekalp previously approved these changes Apr 6, 2026
@karthikbekalp karthikbekalp removed the waiting-on-maintainers Waiting on the maintainers to review. label Apr 6, 2026
@karthikbekalp
Copy link
Copy Markdown
Contributor

Hmm, looks this PR needs to be rebased as there a few merge conflicts.

@crowecawcaw crowecawcaw force-pushed the telemetry-error-handling-decorator branch 2 times, most recently from fbfa483 to 17b2ba7 Compare April 6, 2026 22:31
Narrow _swallow_exceptions to root telemetry entry points
(set_opt_out, initialize, record_event, _exit_cleanly) instead of
every internal helper. Protect __init__ with targeted try/except
for _get_telemetry_identifier and _get_system_metadata.

Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
@crowecawcaw crowecawcaw force-pushed the telemetry-error-handling-decorator branch from 17b2ba7 to 9594ebd Compare April 6, 2026 22:50
@crowecawcaw crowecawcaw enabled auto-merge (squash) April 7, 2026 00:25
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

1 similar comment
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@crowecawcaw crowecawcaw merged commit ea54177 into aws-deadline:mainline Apr 7, 2026
59 checks passed
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.

Maintenance: Add Error Handling Decorator to Telemetry Client Functions

3 participants