Skip to main content

App Environment Metrics Time Series API

The App Environment Metrics Time Series API allows you to retrieve historical metrics data from Prometheus for an app environment in Quave Cloud. Unlike the Metrics API, which returns a current snapshot, this endpoint returns time-series data that can be used for trend analysis, charting, and performance monitoring over time.

Make sure to read the Get Started document to understand how the API works.

Note: This API endpoint accepts only user tokens (not environment tokens).

Get App Environment Metrics Time Series

To retrieve historical metrics for an app environment, send a GET request to the /api/public/v1/app-env/metrics-series endpoint.

Required Parameters

ParameterTypeRequiredDescription
appEnvId or envNameStringYesEnvironment identifier (provide one or the other)
metricStringYesMetric type to query (see Metric Types below)

Optional Parameters

ParameterTypeDefaultDescription
fromString1 hour agoStart time (ISO 8601 format)
toStringnowEnd time (ISO 8601 format)
stepStringautoResolution/interval (1m, 5m, 15m, 1h)
isLiveBooleanfalseIf true, returns last 30 minutes ignoring from/to

Metric Types

ValueDescriptionUnit
cpu_usageCPU usage across all containersmillicores
memory_usageMemory usage across all containersMB
cpu_percentCPU usage as percentage of allocated limitpercent
memory_percentMemory usage as percentage of allocated limitpercent

Step Resolution

The step parameter controls the granularity of data points. If not specified, it's automatically calculated based on the time range:

Time RangeDefault StepDescription
Under 1 hour1mFine granularity for recent data
1-6 hours5mGood for short-term analysis
6-24 hours15mGood for daily analysis
Over 24 hours1hBest for multi-day trends

Response Structure

The response is a JSON object with the following fields:

FieldTypeDescription
appEnvIdStringThe app environment ID
metricStringThe metric type that was queried
fromStringStart time of the data (ISO 8601)
toStringEnd time of the data (ISO 8601)
stepStringResolution used for data points
unitStringUnit of measurement (millicores, MB, or percent)
seriesArrayArray of data points (see below)
summaryObjectStatistical summary (see below)

Series Data Points

Each item in the series array contains:

{
"time": "2024-01-15T10:00:00.000Z",
"value": 250.5
}

Summary Object

The summary object provides statistics for the time range:

FieldTypeDescription
minNumberMinimum value in the series
maxNumberMaximum value in the series
avgNumberAverage value across all data points
currentNumberMost recent value
dataPointsNumberTotal number of data points returned

Examples

Get CPU Usage for Last Hour

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=cpu_usage'

Get Memory Usage for Last 24 Hours

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=memory_usage&from=2024-01-14T10:00:00.000Z&to=2024-01-15T10:00:00.000Z'

Get Live CPU Percentage (Last 30 Minutes)

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?envName=production&metric=cpu_percent&isLive=true'

Get Memory with Custom Step Resolution

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=memory_percent&from=2024-01-15T00:00:00.000Z&to=2024-01-15T12:00:00.000Z&step=15m'

Example Response

{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7b",
"metric": "cpu_usage",
"from": "2024-01-15T09:00:00.000Z",
"to": "2024-01-15T10:00:00.000Z",
"step": "5m",
"unit": "millicores",
"series": [
{ "time": "2024-01-15T09:00:00.000Z", "value": 250.5 },
{ "time": "2024-01-15T09:05:00.000Z", "value": 275.2 },
{ "time": "2024-01-15T09:10:00.000Z", "value": 320.8 },
{ "time": "2024-01-15T09:15:00.000Z", "value": 290.1 },
{ "time": "2024-01-15T09:20:00.000Z", "value": 265.7 },
{ "time": "2024-01-15T09:25:00.000Z", "value": 280.3 },
{ "time": "2024-01-15T09:30:00.000Z", "value": 310.5 },
{ "time": "2024-01-15T09:35:00.000Z", "value": 295.2 },
{ "time": "2024-01-15T09:40:00.000Z", "value": 270.8 },
{ "time": "2024-01-15T09:45:00.000Z", "value": 255.4 },
{ "time": "2024-01-15T09:50:00.000Z", "value": 285.6 },
{ "time": "2024-01-15T09:55:00.000Z", "value": 300.1 }
],
"summary": {
"min": 250.5,
"max": 320.8,
"avg": 283.35,
"current": 300.1,
"dataPoints": 12
}
}

Use Cases

1. Performance Trend Analysis

Query CPU and memory over the last 24 hours to identify patterns:

# Get CPU trends for the last 24 hours
curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=cpu_percent&from=2024-01-14T10:00:00.000Z&to=2024-01-15T10:00:00.000Z&step=1h'

2. Incident Investigation

Check what happened during a specific time window:

# High-resolution data for a 2-hour incident window
curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=memory_usage&from=2024-01-15T14:00:00.000Z&to=2024-01-15T16:00:00.000Z&step=1m'

3. Capacity Planning

Analyze peak usage over a week to plan resource allocation:

# Weekly memory trends
curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=memory_percent&from=2024-01-08T00:00:00.000Z&to=2024-01-15T00:00:00.000Z&step=1h'

4. Real-time Monitoring Dashboard

Get live data for a monitoring dashboard:

# Live CPU usage (last 30 minutes, 1-minute resolution)
curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env/metrics-series?appEnvId=xxx&metric=cpu_usage&isLive=true&step=1m'

Limits and Constraints

ConstraintValueDescription
Maximum time range7 daysQueries longer than 7 days are truncated
Default time range1 hourUsed when from/to not specified
Live mode range30 minutesFixed range when isLive=true
Maximum data pointsDepends on step and rangeMore data points with smaller steps

Error Responses

StatusDescription
400Invalid parameters (missing metric, invalid step, etc.)
401User not authenticated
403User doesn't have permission to access this app environment
404App environment not found
500Prometheus query error (check server logs)

Example Error Response

{
"error": "Invalid metric type: invalid_metric. Valid values are: cpu_usage, memory_usage, cpu_percent, memory_percent"
}

Understanding the Metrics

CPU Usage (millicores)

  • 1000 millicores = 1 CPU core
  • Value of 500 means half a CPU core is being used
  • Compare with your allocated CPU to understand utilization

Memory Usage (MB)

  • Memory in megabytes currently in use
  • Includes working set (actively used memory)
  • Compare with allocated memory to understand utilization

CPU Percent

  • Calculated as: (CPU in use / CPU limit) * 100
  • Values over 100% indicate throttling may occur
  • Sustained high values suggest need for more resources

Memory Percent

  • Calculated as: (Memory in use / Memory limit) * 100
  • Values approaching 100% risk OOM (Out of Memory) kills
  • Monitor trends to predict when scaling is needed

Comparison with Metrics API

FeatureMetrics API (/metrics)Metrics Series API (/metrics-series)
Data typeCurrent snapshotHistorical time series
Time navigationNoYes (from/to/isLive)
Data sourceCached in databaseLive from Prometheus
Use caseCurrent statusTrend analysis, debugging
Response sizeSmall (single values)Larger (array of data points)
Refresh rate~30-60 secondsReal-time from Prometheus

Use the Metrics API for quick status checks and the Metrics Series API for detailed analysis and charting.