-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fix Cloudwatch remote logging #48774
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
Merged
ashb
merged 1 commit into
apache:main
from
aws-mwaa:onikolas/cloudwatch_logging_remote_af3
Apr 4, 2025
Merged
Fix Cloudwatch remote logging #48774
ashb
merged 1 commit into
apache:main
from
aws-mwaa:onikolas/cloudwatch_logging_remote_af3
Apr 4, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There were three main issues: 1) A circular loop that eventually fails due to call depth exceeded. This is because the handler was lazily initted during the first log emission. But when the handler is created some code down stream tries to log, and since there is no handler yet (because we're in the middle of creating it), it tries to create another one, and we were spinning ad infinitum. 2) The stream name is not set on read, because we don't call set_context anywhere in the SDK path, and the processor doesn't have access to the TI anyway (which is used for the stream name). So a 0 byte stream name was being used and was causing a failure in Watchtower. 3) read is also failing because it is using the relative_path as the stream name, which is almost right, but the name isn't sanitized (there are some characters that cloudwatch doesn't allow in a stream name). set_context used to sanitize the name and set it, but it isn't called in the SDK path.
o-nikolas
commented
Apr 3, 2025
providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py
Show resolved
Hide resolved
eladkal
approved these changes
Apr 4, 2025
rawwar
reviewed
Apr 4, 2025
providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py
Show resolved
Hide resolved
ashb
approved these changes
Apr 4, 2025
Member
ashb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this
nailo2c
pushed a commit
to nailo2c/airflow
that referenced
this pull request
Apr 4, 2025
There were three main issues: 1) A circular loop that eventually fails due to call depth exceeded. This is because the handler was lazily initted during the first log emission. But when the handler is created some code down stream tries to log, and since there is no handler yet (because we're in the middle of creating it), it tries to create another one, and we were spinning ad infinitum. 2) The stream name is not set on read, because we don't call set_context anywhere in the SDK path, and the processor doesn't have access to the TI anyway (which is used for the stream name). So a 0 byte stream name was being used and was causing a failure in Watchtower. 3) read is also failing because it is using the relative_path as the stream name, which is almost right, but the name isn't sanitized (there are some characters that cloudwatch doesn't allow in a stream name). set_context used to sanitize the name and set it, but it isn't called in the SDK path.
diogotrodrigues
pushed a commit
to diogotrodrigues/airflow
that referenced
this pull request
Apr 6, 2025
There were three main issues: 1) A circular loop that eventually fails due to call depth exceeded. This is because the handler was lazily initted during the first log emission. But when the handler is created some code down stream tries to log, and since there is no handler yet (because we're in the middle of creating it), it tries to create another one, and we were spinning ad infinitum. 2) The stream name is not set on read, because we don't call set_context anywhere in the SDK path, and the processor doesn't have access to the TI anyway (which is used for the stream name). So a 0 byte stream name was being used and was causing a failure in Watchtower. 3) read is also failing because it is using the relative_path as the stream name, which is almost right, but the name isn't sanitized (there are some characters that cloudwatch doesn't allow in a stream name). set_context used to sanitize the name and set it, but it isn't called in the SDK path.
simonprydden
pushed a commit
to simonprydden/airflow
that referenced
this pull request
Apr 8, 2025
There were three main issues: 1) A circular loop that eventually fails due to call depth exceeded. This is because the handler was lazily initted during the first log emission. But when the handler is created some code down stream tries to log, and since there is no handler yet (because we're in the middle of creating it), it tries to create another one, and we were spinning ad infinitum. 2) The stream name is not set on read, because we don't call set_context anywhere in the SDK path, and the processor doesn't have access to the TI anyway (which is used for the stream name). So a 0 byte stream name was being used and was causing a failure in Watchtower. 3) read is also failing because it is using the relative_path as the stream name, which is almost right, but the name isn't sanitized (there are some characters that cloudwatch doesn't allow in a stream name). set_context used to sanitize the name and set it, but it isn't called in the SDK path.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There were three main issues:
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.