Metrics and Monitoring
Learn how to monitor your applications' performance and health.
The Andasy platform includes a fully-managed metrics solution to help you monitor your applications' performance and health. Metrics are numerical measurements collected over time that describe your application's behavior and performance, such as CPU usage, memory consumption, request rates, and error counts.
Unlike logs (which are text messages), metrics are structured data points that can be:
- Aggregated - Combined across multiple machines or time periods
- Graphed - Visualized as charts and dashboards
- Alerted on - Used to trigger alerts when thresholds are exceeded
- Queried - Analyzed using query languages like PromQL
Andasy automatically collects metrics from every application you deploy, so you can monitor performance without additional instrumentation.
Metrics Components
The Andasy metrics solution includes:
- Metrics viewer - A web-based interface at metrics.andasy.io for viewing and querying metrics
- Prometheus-compatible storage - Managed time-series database that stores your metrics
- Automatic collection - Metrics are automatically sent from every Andasy app you deploy
- Standard labels - All metrics include labels like
app_name,org_id, andmachine_idfor filtering and grouping
Prometheus on Andasy.io
Prometheus is a popular open-source monitoring system used to store and query metrics efficiently. Andasy provides a fully-managed Prometheus-compatible service, so you get the power of Prometheus without managing the infrastructure yourself.
What is Prometheus?
Prometheus is a time-series database designed for monitoring. It:
- Stores metrics as time-series data (values over time)
- Provides a powerful query language (PromQL) for analyzing metrics
- Offers a stable HTTP API for querying and integration
- Is widely supported by monitoring tools and dashboards
Prometheus on Andasy.io is a fully-managed service that supports most common Prometheus querying API endpoints:
/api/v1/query/api/v1/query_range/api/v1/series/api/v1/labels/api/v1/label/<label_name>/values/api/v1/status/tsdb/federate
Note that remote read (/api/v1/read) and remote storage integration
are not supported.
MetricsQL
Prometheus queries are typically based on the PromQL query language. Prometheus on Andasy.io queries use PromQL.
Querying Metrics
Queries can be sent to the following endpoint:
https://metrics.andasy.io/
Authentication: You'll need to authenticate using an Access Token sent in the standard Bearer Token format. Include it as an HTTP header: Authorization: Bearer <TOKEN>. You can only query metrics for applications in your organizations.
Getting an Access Token: Use andasy auth token to get your access token.
Manually
Get an access token
TOKEN=$(andasy auth token)
Test it out!
curl https://metrics.andasy.io/api/v1/query \
--data-urlencode 'query=sum(increase(cpu_seconds_total)) by (app_name, org_id)' \
-H "Authorization: $TOKEN"
External or self-hosted Grafana
You can also configure your Prometheus endpoint with an existing Grafana installation like this:
- Add a Prometheus data source (Settings -> Data Sources -> Add data source -> Prometheus)
- Fill the form with the following:
- HTTP -> URL:
https://metrics.andasy.io - Custom HTTP Headers -> + Add Header:
- Header:
Authorization, Value:Bearer <token>
- Header:
You're all set.
Standard Labels
All published metrics include the following labels, which you can use to filter and group metrics:
app_name- The name of your applicationorg_id- Your organization ID (useful for multi-org accounts)machine_id- The ID of the specific machine (useful for comparing performance across machines)
These labels allow you to query metrics for specific applications, compare performance across machines, or aggregate metrics across your entire organization.
Common Use Cases
Monitor CPU Usage
TOKEN=$(andasy auth token)
curl https://metrics.andasy.io/api/v1/query \
--data-urlencode 'query=avg(cpu_usage_percent) by (app_name)' \
-H "Authorization: Bearer $TOKEN"
Track Request Rates
TOKEN=$(andasy auth token)
curl https://metrics.andasy.io/api/v1/query \
--data-urlencode 'query=rate(http_requests_total[5m]) by (app_name)' \
-H "Authorization: Bearer $TOKEN"
Monitor Memory Usage
TOKEN=$(andasy auth token)
curl https://metrics.andasy.io/api/v1/query \
--data-urlencode 'query=avg(memory_usage_bytes) by (app_name)' \
-H "Authorization: Bearer $TOKEN"
Related Documentation
- Logs - View application logs for detailed event information
- Apps - Manage your applications
- Prometheus Querying Basics - Learn PromQL for advanced queries