Skip to content

Enhance logging#67

Open
sfc-gh-nlele wants to merge 31 commits intomainfrom
enhance_logging
Open

Enhance logging#67
sfc-gh-nlele wants to merge 31 commits intomainfrom
enhance_logging

Conversation

@sfc-gh-nlele
Copy link
Contributor

@sfc-gh-nlele sfc-gh-nlele commented Mar 15, 2023

This PR—

  1. Adds more logging for secret accesses, request and response sizes etc.
  2. Modifies the logging levels of the existing logging statements and makes debug logs to be logged depending upon if the environment is dev.

Related TF resources: Snowflake-Labs/terraform-snowflake-api-integration-with-geff-aws#78

@sfc-gh-nlele sfc-gh-nlele marked this pull request as ready for review April 5, 2023 17:13
Copy link
Contributor Author

Choose a reason for hiding this comment

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

debug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't seem to print anything important it seems -- the req object has no special __repr__ or __str__, and it only ends up printing the class and the memory address of the object.

Something like <urllib.request.Request object at 0x7fe94f185310>. This could be removed maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hash for comparing two requests

Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 6, 2023

Choose a reason for hiding this comment

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

Made this change so that this line actually gets the bytes, instead of the string.

{
'body': response_body,
'headers': response_headers,
'status': response_status,
Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 6, 2023

Choose a reason for hiding this comment

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

Added status code returned for the request too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calculating the driver invocation time.

Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 12, 2023

Choose a reason for hiding this comment

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

Replace bucket with uri here.
Writing result of row "%s" of batch "%s" to URI "%s".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make this similar to L95

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Body instead of headers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move up to the req, auth host comparison, log both of them

Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 12, 2023

Choose a reason for hiding this comment

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

md5 and call it an etag

LOG.info(
'Got the response with status code: %d and body size: %d bytes, for URL: %s.',
response_status,
len(res_body),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

use res.body/similar instead

Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 18, 2023

Choose a reason for hiding this comment

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

It doesn't seem like the result object has an attribute like that

Copy link
Collaborator

Choose a reason for hiding this comment

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

we should also include how long the request took into a separate info log

we should also respond with the time the request / response took into the metadata returned when the user turns verbose option on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep debug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep as debug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

similar as above, call tree can be debug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use quotes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe skip, since specifc to htttps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let the S3 logging be inside the driver.

Driver agnostic, say storage.

Copy link
Contributor Author

@sfc-gh-nlele sfc-gh-nlele Apr 12, 2023

Choose a reason for hiding this comment

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

Just the time and the size of the metadata to be returned, since it's not necessarily a write.

response_length,
)
else:
data_dumps = dumps({'data': res_data}, default=str)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

log pre gzip size too, and use len of bite array instead of string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implicit, delete

elif method == 'POST':
LOG.info('Invocation: synchronous.')
return sync_flow(event, context)
elif method == 'GET':
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add log for polling, too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be .error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.error

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments