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

Improve logging in python worker #637

Merged
merged 4 commits into from
Mar 23, 2020
Merged

Improve logging in python worker #637

merged 4 commits into from
Mar 23, 2020

Conversation

Hazhzeng
Copy link
Contributor

@Hazhzeng Hazhzeng commented Mar 19, 2020

Fixes

resolves: #635
resolves: #634
resolves: #580

Context

  1. Remove console logger when gRPC channel is established.
  2. Use gRPC channel for every log entries once it is established.
  3. Emit info "Function is async" if the entrypoint is marked with "async" keyword
  4. Emit info "Function is sync" if the entrypoing is marked with "sync" keyword
  5. Ensure all the worker logs are sent via System log category

Miscellaneous

  1. Update protobuf file to v1.3.7

Copy link
Member

@pragnagopa pragnagopa left a comment

Choose a reason for hiding this comment

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

Looks good. Please do test E2E via private site extension and verify logs in kusto to ensure we see expected logs

logging_handler = AsyncLoggingHandler()
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
root_logger.addHandler(logging_handler)

# Since gRPC channel is established, should use it for logging
disable_console_logging()
Copy link
Member

Choose a reason for hiding this comment

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

What happens to console logs from user code? We still need to flow them as console logs. Can you please test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I thought the host will log all messages coming from gRPC channel. For sure, I will test it

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Host logs RpcLog messages coming via gRpc. Just to be safe test with a function that logs to console

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pragnagopa Testing on my local dev environment, console log (e.g. print()) flows through.

Synchronous Function Logging
image

Asynchronous Function Logging
image

azure_functions_worker/dispatcher.py Show resolved Hide resolved
Copy link
Member

@pragnagopa pragnagopa left a comment

Choose a reason for hiding this comment

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

👍

@Hazhzeng Hazhzeng merged commit 7c9bcc4 into dev Mar 23, 2020
@Hazhzeng Hazhzeng deleted the hazeng/fix-logging branch April 29, 2020 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants