Skip to content

Maintenance: Add Error Handling Decorator to Telemetry Client Functions #755

@AWS-Samuel

Description

@AWS-Samuel

Description

We need to implement a try/catch decorator for all functions in the TelemetryClient class to ensure robust error handling and prevent any telemetry-related issues from affecting the main application flow.

Current Behavior:

Some functions in the TelemetryClient class have basic error handling, for example, the initialize() method silently catches all exceptions.

However, other methods may throw uncaught exceptions that could impact the application

Proposed Changes:

Create a decorator that will:

  • Catch all exceptions
  • Log errors appropriately
  • Prevent exceptions from propagating to calling code
  • Maintain the telemetry client's non-blocking nature

Functions requiring the decorator:

  • set_opt_out()
  • initialize()
  • _get_prefixed_endpoint()
  • _get_telemetry_identifier()
  • _start_threads()
  • _get_system_metadata()
  • _exit_cleanly()
  • _send_request()

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersmaintenanceChanges to builds, tests, processes, or code that does not directly affect functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions