Get metric history

Retrieve the historical records for a specific metric.

Description

This endpoint enables the retrieval of historical data for a specified metric key, covering a period of up to 7 days. It grants access to recent data points for the targeted metric. When a granularity parameter is specified, the endpoint returns the average values of the data points, aggregated over the specified time intervals.

Endpoint

GET https://sentry.aleno.ai/metrics/records/range

Query parameters

NameRequiredTypeDescription

key

Required

string

Target metric keys for which to retrieve current value. (each metric is defined with a unique key).

fromTimestamp

Optional

number

Unix timestamp indicating the earliest record to fetch from the data source

toTimestamp

Optional

number

Unix timestamp indicating the latest record to fetch from the data source.

granularity

Optional

string

A string that specifies the time intervals over which data points should be averaged. This parameter allows for the aggregation of data points into specified time buckets, facilitating the analysis of trends over different intervals.

Valid Granularity Values

  • 4h - Data points are averaged over four-hour intervals.

  • 1h - Data points are averaged over one-hour intervals.

  • 15m - Data points are averaged over fifteen-minute intervals.

  • 5m - Data points are averaged over five-minute intervals.

  • 1m - Data points are averaged over one-minute intervals.

Payload

No payload.

CURL example

curl -X GET \
  'https://sentry.aleno.ai/metrics/records/range?key=eth_token_total_tvl_0xb8b295df2cd735b15be5eb419517aa626fc43cd5' \
  -H 'Authorization: YOUR_API_KEY'

Result

Returns the key of the required metric and the list of requested points as

NameTypeDescription

key

string

Target metric key

point

Point list

A list of values and timestamps representing the records for the specified key.

{
    "data": {
        "key": "eth_token_total_tvl_0xb8b295df2cd735b15be5eb419517aa626fc43cd5",
        "points": [
            {
                "timestamp": 1712831063,
                "value": 51226.835228591495
            },
            {
                "timestamp": 1712931575,
                "value": 56257.67581756109
            },
            {
                "timestamp": 1712937071,
                "value": 56257.67581756109
            },
            {
                "timestamp": 1712938523,
                "value": 56257.67581756109
            },
            {
                "timestamp": 1713173831,
                "value": 56273.21091641807
            }
        ]
    }
}

Last updated