Code-Level Go Monitoring

February 28, 2018

Post

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 Instana’s AutoProfile™ 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, Instana’s Golang profiling agent relies on pprof, the built-in Go profiler toolset.

A screenshot is worth a thousand words, so here is what integrated continuous profiling looks like in Instana.

Turning on Go Profiling

Enabling this production grade Always-On profiling is simple. In fact, there are two different ways to do this

Activation from within the application code

To enable continuous profiling for your service provide EnableAutoProfile: true while initializing the sensor:

func main() {
	instana.InitSensor(&instana.Options{
		EnableAutoProfile: true,
		// ...other options
	})

	// ...
}

To temporarily turn AutoProfile™ on and off from your code, call autoprofile.Enable() and autoprofile.Disable().

Activation without code changes

To enable AutoProfile™ for an app without code changes, set INSTANA_AUTO_PROFILE=true env variable. Note that this value takes precedence and overrides any attempt to disable profiling from inside the application code.

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.

Play with Instana’s APM Observability Sandbox

Developer, Engineering
Everybody loves REST APIs. With such interfaces, developers can easily hook into external systems and exchange data, or trigger events. In this article, we will take a look into a mechanism that...
|
Announcement
As you may have already heard from us back in December 2019, Instana has acquired StackImpact. During the last few months, we were working hard integrating StackImpact’s continuous profiling functionality to Instana,...
|
Featured
Profiling is an essential part of application development, where optimizing performance and resource efficiency are important. It is also useful for troubleshooting performance and crash issues. Profilers provide details about code execution,...
|

Start your FREE TRIAL today!

As the leading provider of Automatic Application Performance Monitoring (APM) solutions for microservices, Instana has developed the automatic monitoring and AI-based analysis DevOps needs to manage the performance of modern applications. Instana is the only APM solution that automatically discovers, maps and visualizes microservice applications without continuous additional engineering. Customers using Instana achieve operational excellence and deliver better software faster. Visit https://www.instana.com to learn more.