Go Language Runtime Statistics and Profiling

Note: The information in this section is applicable for an app executable only.

Flogo allows you to gather runtime system statistics for a Flogo app that is running.

Warning: Your management port must be set for the Flogo app, to call the API to gather Go language runtime statistics. To set a different management port for your Flogo app, run FLOGO_HTTP_SERVICE_PORT=<port>./<app-name>/You can use curl to call this API.

To obtain the system statistics on your running app:

    Procedure
  1. From the folder in which your app binary resides, enable the HTTP service using the following command:
    FLOGO_HTTP_SERVICE_PORT=<port> ./<app_name>
  2. Run the following command:
    curl http://localhost:<port>/debug/vars

The command returns the following statistics:

System Metric Name Description
cmdline Command-line arguments passed to the app binary
cpus Number of logical CPUs usable by the current process
goroutines The number of Go routines that currently exist
memstats Memory statistics for the current process. See the Golang documentation for details.
processid System process ID
version Go language version used to build the app

Profiling your app runtime

You can collect and visualize runtime profiling data for Flogo apps using the pprof tool in Golang.

Endpoint Description
/debug/pprof List all profiles
/debug/pprof/profile Profile current CPU usage. By default, it is profiled for every 30 seconds. To change the profiling interval, set the seconds query parameter to a desired value. For example,
go tool pprof http://localhost:<port>/debug/pprof/profile?seconds=15
/debug/pprof/heap A sampling of memory allocations of live objects. For example,
go tool pprof http://localhost:<port>/debug/pprof/heap
/debug/pprof/goroutine Stack traces of all current Go routines. For example,
go tool pprof http://localhost:<port>/debug/pprof/goroutine
/debug/pprof/trace A trace of execution of the current program. For example,
go tool pprof http://localhost:<port>/debug/pprof/trace