Skip to content
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

[athena] fixing logger format string and using lambda alias for invocation #810

Merged
merged 1 commit into from
Aug 21, 2018

Conversation

ryandeivert
Copy link
Contributor

@ryandeivert ryandeivert commented Aug 21, 2018

to: @austinbyers
cc: @airbnb/streamalert-maintainers
size: small
related to: #806

Background

@austinbyers observed the following stack trace:

%d format: a number is required, not unicode: TypeError
Traceback (most recent call last):
File "/var/task/stream_alert/athena_partition_refresh/main.py", line 212, in handler
AthenaRefresher().run(event)
File "/var/task/stream_alert/athena_partition_refresh/main.py", line 180, in run
sqs_rec['attributes']['SentTimestamp'])
File "/usr/lib64/python2.7/logging/__init__.py", line 1155, in debug
self._log(DEBUG, msg, args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1286, in _log
self.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1296, in handle
self.callHandlers(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1336, in callHandlers
hdlr.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 759, in handle
self.emit(record)
File "/var/runtime/awslambda/bootstrap.py", line 446, in emit
msg = self.format(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 734, in format
return fmt.format(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 465, in format
record.message = record.getMessage()
File "/usr/lib64/python2.7/logging/__init__.py", line 329, in getMessage
msg = msg % self.args
TypeError: %d format: a number is required, not unicode

Changes

  • Fixing above error by using %s format string
  • Updating event source mapping to invoke production alias instead of $LATEST

Testing

Deployed in test account

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.961% when pulling 549dc7c on ryandeivert-athena-logger into b0612e5 on master.

Copy link
Contributor

@austinbyers austinbyers left a comment

Choose a reason for hiding this comment

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

🙌

@ryandeivert ryandeivert merged commit 5811030 into master Aug 21, 2018
@ryandeivert ryandeivert deleted the ryandeivert-athena-logger branch August 21, 2018 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants