Skip to content

Commit

Permalink
fix(api): only start cloud profiler for test instance (google#2941)
Browse files Browse the repository at this point in the history
Only start the cloud profiler for test instance so that we can continue
our investigation on this without interrupting production release.
  • Loading branch information
cuixq authored Nov 29, 2024
1 parent 5c57348 commit 93a4ca7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gcp/api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,12 +1397,13 @@ def main():
setup_gcp_logging('api-backend')
logging.getLogger().addFilter(trace_filter)

# Profiler initialization. It starts a daemon thread which continuously
# collects and uploads profiles. Best done as early as possible.
try:
googlecloudprofiler.start(service="osv-api-profiler")
except (ValueError, NotImplementedError) as e:
logging.error(e)
if get_gcp_project() == _TEST_INSTANCE:
# Profiler initialization. It starts a daemon thread which continuously
# collects and uploads profiles. Best done as early as possible.
try:
googlecloudprofiler.start(service="osv-api-profiler")
except (ValueError, NotImplementedError) as e:
logging.error(e)

logging.getLogger().setLevel(logging.INFO)

Expand Down

0 comments on commit 93a4ca7

Please sign in to comment.