mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Caches socket.getfqdn(), send 'domain' when profiling.
Otherwise it's hard to know what's generated from automated testing. R=chase@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/6902153 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@83673 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
13
breakpad.py
13
breakpad.py
@@ -7,7 +7,7 @@
|
||||
Sends a notification when a process stops on an exception.
|
||||
|
||||
It is only enabled when all these conditions are met:
|
||||
1. hostname finishes with '.google.com'
|
||||
1. hostname finishes with '.google.com' or 'chromium.org'
|
||||
2. main module name doesn't contain the word 'test'
|
||||
3. no NO_BREAKPAD environment variable is defined
|
||||
"""
|
||||
@@ -26,10 +26,13 @@ import urllib2
|
||||
# Configure these values.
|
||||
DEFAULT_URL = 'https://chromium-status.appspot.com'
|
||||
|
||||
# Global variable to prevent double registration.
|
||||
_REGISTERED = False
|
||||
|
||||
_TIME_STARTED = time.time()
|
||||
|
||||
_HOST_NAME = socket.getfqdn()
|
||||
|
||||
|
||||
def post(url, params):
|
||||
"""HTTP POST with timeout when it's supported."""
|
||||
@@ -81,7 +84,7 @@ def SendStack(last_tb, stack, url=None, maxlen=50):
|
||||
'stack': stack[0:4096],
|
||||
'user': getpass.getuser(),
|
||||
'exception': FormatException(last_tb),
|
||||
'host': socket.getfqdn(),
|
||||
'host': _HOST_NAME,
|
||||
'cwd': os.getcwd(),
|
||||
'version': sys.version,
|
||||
}
|
||||
@@ -99,6 +102,8 @@ def SendProfiling(url=None):
|
||||
url = DEFAULT_URL + '/profiling'
|
||||
params = {
|
||||
'argv': ' '.join(sys.argv),
|
||||
# Strip the hostname.
|
||||
'domain': _HOST_NAME.split('.', 1)[-1],
|
||||
'duration': time.time() - _TIME_STARTED,
|
||||
'platform': sys.platform,
|
||||
}
|
||||
@@ -131,8 +136,8 @@ def Register():
|
||||
# Skip unit tests and we don't want anything from non-googler.
|
||||
if (not 'test' in sys.modules['__main__'].__file__ and
|
||||
not 'NO_BREAKPAD' in os.environ and
|
||||
(socket.getfqdn().endswith('.google.com') or
|
||||
socket.getfqdn().endswith('.chromium.org'))):
|
||||
(_HOST_NAME.endswith('.google.com') or
|
||||
_HOST_NAME.endswith('.chromium.org'))):
|
||||
Register()
|
||||
|
||||
# Uncomment this line if you want to test it out.
|
||||
|
||||
Reference in New Issue
Block a user