Go Language Runtime Statistics and Profiling

TIBCO Cloud Integration- Flogo (PAYG) allows you to gather runtime system statistics for a Flogo App that is running.

Important: Your management port must be set for the , in order 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, do the following:
  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 application 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. Refer to https://golang.org/pkg/runtime/#MemStats for more details.
processid System process ID
version Go language version used to build the application

Profiling your application runtime

You can collect and visualize runtime profiling data for Flogo Apps using the pprof tool as explained in https://golang.org/pkg/runtime/pprof/.

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 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
Related reference