Skip to content

Improve debuggability of SQS, Lambda, EC2, and RDS hooks#64661

Open
shivaam wants to merge 1 commit intoapache:mainfrom
shivaam:fix/aws-hooks-debug-logging-exception-handling
Open

Improve debuggability of SQS, Lambda, EC2, and RDS hooks#64661
shivaam wants to merge 1 commit intoapache:mainfrom
shivaam:fix/aws-hooks-debug-logging-exception-handling

Conversation

@shivaam
Copy link
Copy Markdown
Contributor

@shivaam shivaam commented Apr 3, 2026

Follow-up to #64629 (DynamoDB hook), applying the same debug logging
and exception handling pattern to four more AWS provider hooks.

Debug logging — adds self.log.debug() before/after API calls,
following the Airbyte provider pattern (#51503):

Hook Methods
SQS create_queue, send_message, asend_message
Lambda invoke_lambda, create_lambda
EC2 get_instance, stop/start/terminate_instances, get_instance_state_async, wait_for_state
RDS All 6 get_*_state methods

All logs are at DEBUG level — no-ops unless explicitly enabled.

Exception handling (RDS only):

  • Add from e exception chaining to all 6 raise AirflowNotFoundException(e)
    to preserve __cause__ in tracebacks
  • Replace raise e with bare raise in get_export_task_state and
    get_event_subscription_state to avoid adding a misleading extra
    frame to the traceback

Testing: All 53 existing tests across the four hook test files
pass unchanged.

Part of the Debugging Improvements — Airflow 3 initiative.

related: #64629, #51503


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 4.6)

Generated-by: Claude Code (Claude Opus 4.6) following the guidelines

- Add debug logging before/after API calls in all four hooks,
  following the pattern from the Airbyte provider (apache#51503) and
  DynamoDB hook (apache#64629)
- Fix `raise e` → bare `raise` in RDS hook (get_export_task_state,
  get_event_subscription_state) to avoid misleading extra traceback
  frames
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Apr 3, 2026
@shivaam shivaam marked this pull request as ready for review April 3, 2026 07:30
@shivaam shivaam requested a review from o-nikolas as a code owner April 3, 2026 07:30

return self.conn.stop_instances(InstanceIds=instance_ids)
result = self.conn.stop_instances(InstanceIds=instance_ids)
self.log.debug("stop_instances response: %s", result.get("StoppingInstances"))
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.

To be honest I think adding log.debug everywhere has very little value if any.
To leverage this users must change the logging configuration in the Airflow cluster. I don't know if anyone is actually doing it in production. It cary risks and interruption for other jobs, also logs becomes so spammy that it's very hard to figure out what you actually need.

I think that the improve debuggability track should be about finding a way to change a specific DAG logging level without affecting the whole cluster - then, PRs like this one has real value.

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.

But regardless of my above comment happy to accept it.

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

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants