diff --git a/googlecloudprofiler/__init__.py b/googlecloudprofiler/__init__.py index 51628f4..e0dd910 100644 --- a/googlecloudprofiler/__init__.py +++ b/googlecloudprofiler/__init__.py @@ -45,7 +45,7 @@ def start(service=None, project. The string should be the same across different replicas of your service so that the globally constant profiling rate is maintained. Do not put things like PID or unique pod ID in the name. The string must match - the regular expression '^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$'. When not + the regular expression '^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$'. When not specified, the value of GAE_SERVICE environment variable will be used, which is set for applications running on Google App Engine; if GAE_SERVICE is not set,the value of K_VERSION environment variable, which is set on @@ -78,10 +78,10 @@ def start(service=None, signal module. It only profiles the main thread. The start function must be called from the main thread if wall time profiling is enabled. Using SIGALRM signal after starting the profiler will cause problems: - registering a handler for SIGALRM will prevent the profiler from - working. SIGALRM will be trigger by the profiler at unpredictable time. - Wall profiling has some other limitations as documented in the - pythonprofiler module. + registering a handler for SIGALRM will prevent the profiler from + working. SIGALRM will be trigger by the profiler at unpredictable time. + Wall profiling has some other limitations as documented in the + pythonprofiler module. period_ms: An optional integer specifying the sampling interval in milliseconds. Applies to both CPU profiling and wall profiling. Defaults to 10. @@ -92,7 +92,7 @@ def start(service=None, Raises: ValueError: If arguments are invalid or if necessary information can't be determined from the environment and arguments. Or if service name doesn't - match '^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$'. Or if called from + match '^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$'. Or if called from a non-main thread when Wall time profiling is enabled. Or if no profiling mode is enabled. NotImplementedError: If not run on Linux or Mac. diff --git a/googlecloudprofiler/client.py b/googlecloudprofiler/client.py index 07ba618..59cd7ea 100644 --- a/googlecloudprofiler/client.py +++ b/googlecloudprofiler/client.py @@ -75,7 +75,7 @@ def retrieve_gce_metadata(metadata_key): metadata_key: A string specifying the metadata key, e.g 'project/project-id'. See https://cloud.google.com/compute/docs/storing-retrieving-metadata for the - list of keys. + list of keys. Returns: A string representing the metadata value, or None if not found. @@ -158,7 +158,7 @@ def config(self, project_id, service, service_version, disable_cpu_profiling, Raises: ValueError: If the project ID or service can't be determined from the environment and arguments. Or if service name doesn't match - '^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$'. Or if no profiling mode is + '^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$'. Or if no profiling mode is enabled. """ self._profilers = {} @@ -178,7 +178,7 @@ def config(self, project_id, service, service_version, disable_cpu_profiling, if not service: raise ValueError('Service name must be provided via configuration or ' 'GAE_SERVICE environment variable.') - service_re = re.compile('^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$') + service_re = re.compile('^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$') if not service_re.match(service): raise ValueError('Service name "%s" does not match regular expression ' '"%s"' % (service, service_re.pattern))