Code-Level Go Monitoring

Monitoring is a critical component of literally any application stack. Without the ability to see how Go applications perform and get notified in case of an availability or performance problem, it would be impossible to take timely action. Any downtime or performance regression can have a significant impact on the business.

Traditional monitoring systems notify about the problems and provide high-level information about application state (e.g. CPU load and used memory size). However, this isn’t usually enough for developers to fix performance problems. This topic is discussed in more detail in the blog post Why Monitoring Isn’t Enough for Modern Applications .

To fix performance problems, developers need tools such as profilers that are able to provide the required code-level statistics (e.g. CPU, memory allocation or blocking call hot spots). This means, that after an issue is detected, developers need to try to reproduce the issue locally in order to proceed with root case analysis. Reproducing a production issue in a development or test environment is a challenge by itself.

But what if a monitoring tool could continuously provide code-level insights? That would make root cause analysis and performance optimization work an order of magnitude shorter.

That’s what StackImpact Profiler does! It continuously and automatically profiles applications and reports various performance profiles. Read more about this concept in the blog post Continuous Performance Profiling. Under the hood, the StackImpact Golang agent relies on pprof, the built-in Go profiler toolset.

A screenshot is worth a thousand words, so here is what continuous profiling looks like in the StackImpact Dashboard.

Screenshot

Adding the StackImpact Go agent to the application is very simple. Just import the stackimpact Go package and add the following code to your application.

stackimpact.Start(stackimpact.Options{
    AgentKey: "your agent key here",
    AppName: "MyGoApp",
})

See setup instructions for more options.

Besides the CPU profiles shown in the screenshot, the following profiles and metrics are automatically available in the Dashboard:

  • Memory allocation profiles
  • Blocking call profiles
  • Errors and panics
  • Health metrics

The included anomaly detection constantly monitors profiles. Email alerts and URL web hooks can be set up to notify on detected anomalies.