Open source


In March 2023, Grafana Labs acquired Pyroscope, the company behind the eponymous open source continuous profiling project. As a result, the Pyroscope and Grafana Phlare projects will be merged under the new name Grafana Pyroscope. To learn more, read our recent blog post about the news.

How to add NodeJS profiling to your application

To start profiling a NodeJS application, you need to include the npm module in your app:

npm install @pyroscope/nodejs

# or
yarn add @pyroscope/nodejs

Then add the following code to your application:

const Pyroscope = require('@pyroscope/nodejs');

  serverAddress: 'http://pyroscope:4040',
  appName: 'myNodeService'


How to add profiling labels to NodeJS applications

It is possible to add tags (labels) to the profiling data. These tags can be used to filter the data in the UI. Dynamic tagging isn’t supported yet

  serverAddress: 'http://pyroscope:4040',
  appName: 'myNodeService',
  tags: {
    region: ENV['region']


Pull Mode profiling for NodeJS

NodeJS integration also supports pull mode. For that to work you will need to make sure you have profiling routes (/debug/pprof/profile and /debug/pprof/heap) enabled in your http server. For that you may use our expressMiddleware or create endpoints yourself

const Pyroscope, { expressMiddleware } = require('@pyroscope/nodejs');



Note: you don’t need to .start() but you’ll need to .init()

Scrape configuration

You will need to add the following content to your pyroscope/server.yml Pyroscope config file. See the Server config documentation for more information on where this config is located by default on your system.

# A list of scrape configurations.
  # The job name assigned to scraped profiles by default.
  - job-name: pyroscope

    # The list of profiles to be scraped from the targets.
    enabled-profiles: [cpu, mem]

    # List of labeled statically configured targets for this job.
      - application: my-nodejsapp-name
        spy-name: nodespy 
          - hostname:6060
          env: dev


You may set DEBUG env to pyroscope and see debugging information which can help you understand if everything is OK.

DEBUG=pyroscope node index.js