Beautiful Dashboards and Alerts: Using New Relic to bring understanding and peace of mind to your Golang applications

By Kris Vincent

Elevator Pitch

Go apps benefit greatly from performance visibility and multi-perspective debugging tools. New Relic delivers rich, insightful dashboards and monitoring through APM and infrastructure data, providing a new level of visibility into how your go applications are used and performing.

Description

This session will walk attendees through implementing New Relic APM tracking using the Go SDK they provide. Using the Gin-Gonic framework, we will describe how users can implement a gin middleware for their functions to leverage transaction monitoring throughout their application.

Using real-world examples, we will dive into how to generate dashboards based on this APM data; highlighting how it can provide developers a new level of visibility into how their specific functions are performing. NRQL (New Relic’s Query Language) provides a robust level of flexibility for interacting with and displaying your data in unique and informative ways. This session will provide real examples of NRQL queries you can use to understand your apps better.

New Relic infrastructure provides the same quality of metric tracking and monitoring for our underlying Docker Infrastructure. Running your go apps on Docker requires infrastructure visibility to fully understand your application’s health. Follow along as we describe how New Relic’s Infrastructure product has changed the way we observe and monitor our Kubernetes clusters.

Finally, we will cover New Relic’s Alerting system which can be triggered from any of New Relic’s sources. Leveraging this combination of application and infrastructure data helps teams get smarter about who to alert and when.

Notes

I’m Kris Vincent, at Gannett, owners of USA Today and 120+ Local News Markets across the country. I work on the Platform as a Service team, where we support 30+ development teams, using a variety of languages, running their applications in an autonomous manner. Specifically, I am part of a feature team within the PaaS team that is responsible for writing Golang APIs on top of the infrastructure our team implements. Since Summer of 2016, our team has developed 12 go applications; 6 of which are services, 2 are slackbots, and one is our custom CI Pipeline that does everything from building Docker containers, to running unit, integration, and load tests, to pushing our artifacts and deploying our application to staging servers. Each of our apps leverage New Relic, which allows us to see how users are interacting with our system, how our go code is performing, and even how our Kubernetes clusters are performing for our Docker containers.

Implementing the New Relic GoSDK

So let’s get started from the beginning of our journey and look at Transaction tracking. We implemented the GoSDK that New Relic maintains, and we’ve had great results using it. You can find out more info or download the GoSDK at https://docs.newrelic.com/docs/agents/go-agent/get-started/get-new-relic-go.

  • I will talk about how we created a utility package for quickly implementing New Relic transaction tracking in all our go applications. (paas-api-utils)
    • I will describe how that package sets up the New Relic application, transaction tracking, and transaction decorating.
  • I will describe and show the code for how we implemented a Gin middleware that we use with all our transactions.
  • I will discuss how we get runtime metrics for our functions by deferring monitoring until the processing is done in our Gin routes

Insights + APM: Letting us understand our applications and their users better through beautiful real-time dashboards.

Using this transactional data, we can create a rich, insightful, and real-time dashboard that shows us how our users are interacting with our system and how our system is handling those interactions. As you can see in the dashboard here (see below - http://imgur.com/Kgts13N), we’re able to take those specific transaction calls and create a graph that shows us which of those calls is being used, which teams are using the system, how long these calls take to respond, and which environments are handling those calls.

alt text

  • I will show some of the NRQL Queries we’re using for these dashboards so that the audience can see the underlying code for how we built these tiles.
  • I will highlight certain tiles and explain how their content has helped us circumvent a problem, for example:
    • “Production Deployment Actions by Region” shows us which environments are taking requests. There was a situation where we had shifted our application traffic to 100% east, and had forgotten to set it back to 50:50. When I was on the dashboard looking at how our app was doing, I noticed that we were only accepting calls in the east region, and proceeded to get traffic set back to 50:50. Without New Relic, we may have continued to run un-utilized servers in production while our team was unaware.

New Relic Infrastructure – Systems Level Metrics Same Great Dashboards!

Transactional data is one metric that we pull in, but we’re also pulling in Infrastructure metrics to build system health dashboards. New Relic Infrastructure is a product that allows customers to collect, view, graph, and alert on real-time health metrics for all your systems. We can see in real time how our Kubernetes clusters are preforming while handling the many Docker containers our team runs. Infrastructure allows us to see container counts, CPU, memory, disk usage by container, the number of running workers on a container, and so much more! (See Below - http://imgur.com/BUVO9en)

alt text

  • I will discuss how New Relic Infrastructure is Deployed.
  • I plan to talk about how this dashboard helped provide us invaluable visibility in some specific high traffic situations.
    • Our Industry has events that have sudden bursts of traffic, this chart helps us stay vigilant during those events.

Don’t wake the boss! Alerting for the right reasons with New Relic’s Alerts

New Relic lets us setup alerts from a variety of data sources; meaning that you can act on data from APM, Infrastructure, Mobile, Synthetics, Plugins, and Browser to send alerts to your team.

New Relic Alerts ties directly into most alerting systems, like VictorOps, Nagios, or PagerDuty. The Alert dashboard allows users to tie these all together through Notification Channels, which can be customized to suit your team.

Here I will demonstrate how easy it is to set up your team’s first New Relic alert. I’m going to do this straight from the Infrastructure dashboard, by first filtering down to my application. Next, I’m going to click the cogwheel icon in the top right corner of any of my infrastructure graphs, and see that I can setup an alert based on this graph.

Clicking this brings you to the create alert form, where we can setup an alert…

  • Walk the group through how to setup an alert from Infrastructure
  • Talk about how this works within our Kubernetes environment
  • How we report on High CPU, High Memory, Low Disk, etc

Now I will demonstrate how to set up an alert from the Application side. Going into APM, we can see the applications we have added and can start to add alerts to them. Let’s setup an alert for Error percentage for our application being above 5% for at least 5 mins.

  • Walk the group through how to setup an Error Percentage alert
  • Attach it to a Notification Channel
  • Give some examples of what all you can alert on using APM data

As I mentioned before, New Relic’s Alerts work through their entire eco-system, so I encourage you to try out the alerting feature in New Relic if you haven’t already.

What does it all mean? What have we accomplished?

So, where does this leave us? Since we’ve implemented New Relic our team has managed to:

  • Consolidate multiple monitoring, alerting, and APM tools into a single ecosystem
  • Improved our understanding of how our customers are using our applications
  • Get a better understanding when our systems are struggling to keep up with our applications
  • Most Importantly its helped us develop better software.

Thank you for your time and I look forward to any question you guys may have!