Hooking Up Fly Metrics

We’ve written a bit, for a general audience, about how Fly collects and manages metrics. If you’re just sort of generally interested in metrics and observability, go read that first. Meanwhile, if you’re a Fly user, or considering becoming such a us

Thomas Ptacek
10 min readadvanced
--
View Original

Overview

The article discusses how to integrate Fly Metrics with Prometheus for monitoring performance, creating alerts, and exporting custom metrics. It provides a step-by-step guide on setting up Grafana to visualize these metrics and emphasizes the importance of custom metrics for effective observability.

What You'll Learn

1

How to set up Prometheus metrics for your Fly application

2

How to visualize Fly metrics in Grafana

3

How to export custom metrics from your application to Fly

Prerequisites & Requirements

  • Basic understanding of Prometheus and Grafana
  • Access to a Fly account and Grafana instance

Key Questions Answered

How can I integrate Fly Metrics with Grafana?
To integrate Fly Metrics with Grafana, first set up a Grafana instance and retrieve a Fly token using the command 'flyctl auth token'. Then, add a Prometheus data source in Grafana with the URL for Fly's Prometheus endpoint, and include the authorization token in the custom header.
What types of metrics does Fly provide?
Fly provides built-in Prometheus metrics including counters for HTTP responses, gauges for real-time data, and histograms for response times. These metrics can be automatically tracked and custom metrics can also be exported from applications.
What is the purpose of custom metrics in Fly?
Custom metrics allow users to track specific application performance indicators that are not covered by the default metrics. This enhances observability and enables tailored monitoring for unique application needs.
How do I create a basic dashboard in Grafana for Fly Metrics?
To create a basic dashboard in Grafana for Fly Metrics, go to 'Manage Dashboards', click 'Import', and paste the JSON from the provided GitHub link. This will set up a dashboard with various graphs visualizing the metrics.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Utilize built-in Prometheus metrics to monitor your Fly applications effectively.
By leveraging the automatic metrics provided by Fly, you can gain immediate insights into application performance without additional setup.
2
Export custom metrics to enhance your monitoring capabilities.
Custom metrics allow you to track specific events or performance indicators relevant to your application, providing a more comprehensive view of its health.
3
Integrate Grafana for visualizing metrics to improve observability.
Grafana's powerful visualization capabilities can help you make sense of complex metric data, enabling better decision-making based on real-time insights.

Common Pitfalls

1
Failing to configure the Prometheus data source correctly in Grafana.
This can lead to no metrics being displayed. Ensure that the URL and authorization token are correctly set up to avoid this issue.
2
Not exporting custom metrics from your application.
Relying solely on built-in metrics may not provide a complete picture of your application's performance. Custom metrics are essential for tracking specific behaviors and performance indicators.

Related Concepts

Prometheus Metrics
Grafana Dashboards
Custom Metrics In Observability