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
experimental/szager/collated-output
maruel@chromium.org 14 years ago
parent 403a0f9f5a
commit 28924253a1

@ -7,7 +7,7 @@
Sends a notification when a process stops on an exception. Sends a notification when a process stops on an exception.
It is only enabled when all these conditions are met: 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' 2. main module name doesn't contain the word 'test'
3. no NO_BREAKPAD environment variable is defined 3. no NO_BREAKPAD environment variable is defined
""" """
@ -26,10 +26,13 @@ import urllib2
# Configure these values. # Configure these values.
DEFAULT_URL = 'https://chromium-status.appspot.com' DEFAULT_URL = 'https://chromium-status.appspot.com'
# Global variable to prevent double registration.
_REGISTERED = False _REGISTERED = False
_TIME_STARTED = time.time() _TIME_STARTED = time.time()
_HOST_NAME = socket.getfqdn()
def post(url, params): def post(url, params):
"""HTTP POST with timeout when it's supported.""" """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], 'stack': stack[0:4096],
'user': getpass.getuser(), 'user': getpass.getuser(),
'exception': FormatException(last_tb), 'exception': FormatException(last_tb),
'host': socket.getfqdn(), 'host': _HOST_NAME,
'cwd': os.getcwd(), 'cwd': os.getcwd(),
'version': sys.version, 'version': sys.version,
} }
@ -99,6 +102,8 @@ def SendProfiling(url=None):
url = DEFAULT_URL + '/profiling' url = DEFAULT_URL + '/profiling'
params = { params = {
'argv': ' '.join(sys.argv), 'argv': ' '.join(sys.argv),
# Strip the hostname.
'domain': _HOST_NAME.split('.', 1)[-1],
'duration': time.time() - _TIME_STARTED, 'duration': time.time() - _TIME_STARTED,
'platform': sys.platform, 'platform': sys.platform,
} }
@ -131,8 +136,8 @@ def Register():
# Skip unit tests and we don't want anything from non-googler. # Skip unit tests and we don't want anything from non-googler.
if (not 'test' in sys.modules['__main__'].__file__ and if (not 'test' in sys.modules['__main__'].__file__ and
not 'NO_BREAKPAD' in os.environ and not 'NO_BREAKPAD' in os.environ and
(socket.getfqdn().endswith('.google.com') or (_HOST_NAME.endswith('.google.com') or
socket.getfqdn().endswith('.chromium.org'))): _HOST_NAME.endswith('.chromium.org'))):
Register() Register()
# Uncomment this line if you want to test it out. # Uncomment this line if you want to test it out.

Loading…
Cancel
Save