Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Profiler code samples for App Engine #2028

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
merged 2 commits into from
Mar 6, 2019

Conversation

jqll
Copy link
Contributor

@jqll jqll commented Mar 5, 2019

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 5, 2019
@jqll
Copy link
Contributor Author

jqll commented Mar 5, 2019

@tswast @aalexand @kalyanac, could you take a look? It's a copy-paste of the appengine hello-world samples, with profiler initialization code added in all main.py. Tested that the samples can be deployed to appengine as is, and the profiles are collected as expected.

# on GCP.
googlecloudprofiler.start(verbose=3)
except (ValueError, NotImplementedError) as exc:
print(exc) # Handles errors here
Copy link

Choose a reason for hiding this comment

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

nit: handle not handles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# on GCP.
googlecloudprofiler.start(verbose=3)
except (ValueError, NotImplementedError) as exc:
print(exc) # Handles errors here
Copy link

Choose a reason for hiding this comment

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

nit: handle not handles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

entrypoint: gunicorn -b :$PORT main:app

runtime_config:
python_version: 3
Copy link

Choose a reason for hiding this comment

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

It would be helpful to add a comment here that using python_version 3, Python 3.7.x is used which supports both Wall & CPU profiling.
https://cloud.google.com/appengine/docs/flexible/python/runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kalyanac
Copy link

kalyanac commented Mar 5, 2019

@jqll do these simple apps generate any interesting profiles? Would it help to add a specific duration of CPU workload?

Copy link

@aalexand aalexand left a comment

Choose a reason for hiding this comment

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

This is a bit of a rubberstamp approval - the code makes sense but it's important to test the samples to make sure they actually work, I might easily miss something.

@jqll
Copy link
Contributor Author

jqll commented Mar 5, 2019

@jqll do these simple apps generate any interesting profiles? Would it help to add a specific duration of CPU workload?

The server keeps checking if there are requests, so we get some interesting profiles even if nobody sends requests. See the screenshot.
screenshot from 2019-03-05 11-08-42

@jqll
Copy link
Contributor Author

jqll commented Mar 5, 2019

This is a bit of a rubberstamp approval - the code makes sense but it's important to test the samples to make sure they actually work, I might easily miss something.

Tested that both samples can be deployed and we get profiles as expected.

@kalyanac
Copy link

kalyanac commented Mar 5, 2019

The server keeps checking if there are requests, so we get some interesting profiles even if nobody sends requests. See the screenshot.

thanks for the clarification. LGTM.

@tswast tswast merged commit 3e019f3 into GoogleCloudPlatform:master Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants