Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Navigation
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
    • Development
  • CLI & API

    • Sourcegraph CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
  1. Docs
  2. dev
  3. how-to
  4. profiling_continuous

How to enable continuous profiling in production

GCP supports continuous CPU and heap profiling. We already have it enabled for some services; you can see some flamegraphs in the GCP profiler dashboard. Turning it for another service requires two small steps:

  1. Initialize the profiler in the service. (example PR)
  2. Set the SOURCEGRAPHDOTCOM_MODE environment variable in the production config to "true". (example PR)

Once the new configuration is deployed to production, you should be able to access profiles for your service in the dashboard.

Other resources:

  • GCP profiler documentation
  • How to do one-off profiling for dogfood and production using pprof

On this page

  1. How to enable continuous profiling in production