In distributed cloud applications, there are inherently many points of failure. They can stem from frequent code changes to the dynamic nature of applications running on clouds, their components and interactions between them. To get on top of these failures, developers and SREs are instrumenting their code for metrics, one of the best methods for ensuring the overall health of cloud-native application environments.
Wavefront is a hosted observability platform designed to couple with code instrumentation. It can handle the massive amount of metrics, histograms, and traces generated from code running in production. One of many reasons why developers and SREs adopt Wavefront is its wide support for open source metric libraries and SDKs.
In this blog, I’ll summarize 5 proven tips for instrumenting application code with open-source metrics libraries. These proven tips were culled from the research I conducted with multiple Wavefront customers when writing the eBook, Wavefront’s Guide to Code Instrumentation. If you want to go beyond this blog, including step throughs for how to instrument your code, download this eBook by clicking on the download button below.
1. Monitor the Platform and the Code Running on It
Developers and SREs need both historical and real-time performance metrics to understand the application and system environment. Historical data allows baseline comparison, forecasting, and impact assessment. Real-time information is critical for alerting on performance anomalies and troubleshooting of application code in production. For continuous application delivery and the fast pace of application releases to production clouds, these data should be in-depth and granular.
Metrics efficiently capture changes over time with up to one-second granularity. Combining custom application streaming metrics with metrics from the rest of the cloud stack empowers developers across different teams to observe, search, analyze and collaborate while troubleshooting or optimizing end-to-end application performance.
In the Micrometer-based dashboard below, REST API calls are tracked by custom GET and PUT metrics data and monitored for assuring reliable service. Developers with no stats and algorithm knowledge can see real-time, automatically-detected anomalies with Wavefront AI Genie. Also, with Wavefront distributing tracing, they can easily search for traces containing the selected API and quickly find ones with errors and longer response times.
Figure 1: REST API Monitoring with Wavefront Custom Metric Dashboard
2. Emphasize Custom-Measurements for Real-time Insights Into Your Application Performance and Behavior
The easiest way to deeply track your application performance and behavior is to instrument your application with standard and custom metrics. Standard metrics include host, OS, CPU, memory, storage, network and any pre-defined metrics provided by libraries. Besides standard metrics, developers should also collect custom metrics. They are specific and unique to a particular cloud application and its environment. Also, they significantly help in assessing the health of the business and the customer experience.
You can embed metrics endpoints into your application code, and a collector will scrape and forward them to Wavefront for charts, dashboards, and alerts at regular intervals. For flexibility, you can use a wide variety of metric types – counters, gauges, timers, deltas, histograms –packaged as a lightweight metrics library, or SDK, for your programming language. Sample code for reporting cache-evictions metrics to Wavefront proxy every 5 seconds with app-1.company.com as a source and dc and service as point tags for fine-grained filtering is given below.
Figure 2: Code Snippet for Reporting Metrics to Wavefront
3. Identify First the Key Metrics You Want to Gather About Your Application
There are popular methodologies for identifying key metrics known as the Golden Signals defined in Google SRE book. The following table summarizes these popular methods (Google SRE, USE, RED) and what they collect. You can collect, store, analyze, visualize, manipulate and alert upon them all in Wavefront.
Table 1: Application Code Instrumentation Key Metrics
Wavefront makes it easy for SREs and developers to monitor modern microservices-based applications – with the built-in support for RED metrics and distributed tracing. With minimal code change, developers can now visualize, monitor and analyze key health performance metrics and distributed traces of Java, Python and .Net applications built on common frameworks such as Dropwizard and gRPC. To learn more about Wavefront distributed tracing, please refer to this blog.
4. Use Open-Source Metric SDKs for High-Performance, Low-Cost Application Performance Data Collection
Developers embrace open source metrics libraries and SDKs for instrumenting their code because those libraries are lightweight and cost-efficient. The following table compares them to more traditional APM agents.
Note: In addition to wide support for open source metric libraries and SDKs, Wavefront also provides a lightweight agentless SDK – an Observability SDK for metrics, histograms, and traces – for all-in-one-SDK monitoring of microservices.
Table 2: Open-Source Metrics Libraries vs. APM Agents
For the programming language of your choice, you can choose from many excellent open source metric libraries: StatsD, Dropwizard metrics, Micrometer, OpenCensus, AppMetrics, Jiffy and client libraries from Prometheus. Application Code instrumentation requires some effort because you potentially need to modify some code or write and add a wrapper, and you need to test the embedded metric endpoints. However, the proactive effort of linking an instrumentation library to your application is rewarded with visibility when incidents occur in production. To read more about how to implement application code instrumentation with StatsD, Micrometer, and Dropwizard metrics style check Guide to Code Instrumentation.
5. Let Wavefront Do the Heavy Lifting for Your Application Code Instrumentation
Modern cloud application systems can emit thousands and millions of metrics, and you want a monitoring platform that can collect them all. Wavefront is full-stack, high reliability, high-scale with lightning-fast performance and maintenance free metric-based monitoring and analytics platform. Click on the 8×8 case study to check how Wavefront provides everything 8×8, Inc’s DevOps team needs around full stack observability. For example, the system health dashboard below they use often is highlighted below.
Figure 3: 8×8 Inc. System Health Dashboard
Wavefront keeps all your application, container, serverless, cloud and infrastructure metrics in one place, so it is your single source of truth that will empower you to assess and troubleshoot your software at any phase of application delivery. Wavefront also includes an advanced analytics engine, query language, and query builder – so you can search and filter your data and drive smarter alerts and dashboards.
Try Wavefront to find out why so many SaaS leaders use Wavefront for application code instrumentation and depend on Wavefront to run their cloud business.
Get Started with Wavefront Follow @nesgor Follow @WavefrontHQ
The post 5 Proven Tips for Instrumenting Your Application Code with Open-Source Metrics Libraries and SDKs appeared first on Wavefront by VMware.