-
Notifications
You must be signed in to change notification settings - Fork 670
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
Add describe_log_streams and filter_log_events to the CloudWatch module #1785
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi @KhueNgocDang looks like we are getting a test failure on the change.
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@malachi-constant |
Hey, I've added the permission to the policy and re-ran the CodeBuild. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@malachi-constant @LeonLuttenberger I encountered a bug in CloudWatch's 'test_query' while debugging the pull request in 5e7b568. This did not happen to the other commits. |
Hey, Yes, that's a transient error in our testing suite. It's not consistent, and re-running the job usually gets rid of it. We haven't gotten around to addressing the root cause of the error yet sadly. But, the good news is that it's not an issue with your code :) Cheers, |
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.
Looks good overrall, I just found a few issues which I described in the comments.
awswrangler/cloudwatch.py
Outdated
log_stream_names = describe_log_streams( | ||
log_group_name=log_group_name, log_stream_name_prefix=log_stream_name_prefix, boto3_session=boto3_session | ||
)["logStreamName"].tolist() | ||
assert log_stream_names is not None |
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.
I don't think we use assert
anywhere in this codebase apart from the unit tests. It would be better to expicitely throw an error here.
However, can thus value even be None
in this caqse? If describe_log_streams
doesn't return any results, then wouldn't log_stream_names
just be an empty list?
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.
I used assert
to prevent mypy
from raising Argument 1 to "len" has incompatible type "Optional[List[str]]"; expected "Sized"
. There are some cases like mine in the codebase (lines 407 and 410 in postgresql.py) that used # type: ignore
to bypass the errors. but I don't like that approach, so I used assert
instead.
I'll replace the assert
with a one-liner if statement
at line 434 that assigns an empty list to log_stream_names If describe_log_streams doesn't return any results.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Feature
Detail
describe_log_streams
to CloudWatch module for getting log streams' details from specified log group.filter_log_events
to CloudWatch module for returning filtered log events from specified log group's log streams.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.