Metric view

Metric views provide time series data from ingested metrics suitable for inclusion in rendered charts. A single view may contain multiple related series.

Part of the API reference collection

This page is part of the Crunchy Bridge API reference, and primarily meant to act as an exhaustive guide for technical integrations which are already in progress. To understand the basics of using the API, see API concepts and getting started.

Get metric view

Get a metric view.

GET /metric-views/{name}

Request

Path parameters

  • name: Identifying name of the metric view.

Query parameters

NameRequiredTypeDescription
beginstring

Begin time of the window with which to return metric results over. Should be a timestamp formatted as RFC3339.

start/end are an alternative to using the simpler period parameter which can be used to specify a custom window.

A window must be at least one minute.

cluster_idstring

The ID of the cluster to retrieve metrics for.

endstring

End time of the window with which to return metric results over. Should be a timestamp formatted as RFC3339. Must be greater than End.

start/end are an alternative to using the simpler period parameter which can be used to specify a custom window.

periodstring

Specifies the duration of a window of time to return, starting from the present time and going backwards in time. For example, a value 15m indicates that metrics for the last 15 minutes should be returned.

Enum 12h, 15m, 1d, 1h, 1w, 24h, 30d, 3h, 60m, 6h, or 7d.

resolution_multiplierinteger

A resolution multipler to apply so that more points are returned as part of each series. Each period gets a default "resolution", which is a number of points that are returned with it, and which fit evenly into its total duration. The default resolution multipler is 1, but a larger one can be specified to get more points returned. This may be useful for when a chart is being expanded to be displayed on a larger screen for example.

Available resolutions are a coarse "order of magnitude" sequence, so only values of 1, 2, 4, and 8 are currently supported.

Enum 1, 2, 4, or 8.

cURL example

curl -X GET https://api.crunchybridge.com/metric-views/{name}
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 200

Response containing a metric view.

Content type: application/json

NameNullableTypeDescription
nameenum string

Identifying name of the metric view.

Enum cpu, disk-usage, iops, load-average, memory, or postgres-connections.

seriesarray of array

Time series data included in this view. Views may have one or more series depending on the view. Each series has a name a number of associated data points. If there are multiple series, they'll always have the same number of data points at the same timestamps.

Example

{
    "events": [
        {
            "created_at": "2021-07-11T01:03:03Z",
            "kind": "cluster.failover_started"
        },
        {
            "created_at": "2021-07-11T01:05:03Z",
            "kind": "cluster.failover_finished"
        }
    ],
    "name": "postgres-connections",
    "series": [
        {
            "is_empty": false,
            "max": null,
            "min": null,
            "name": "postgres-connections",
            "points": [
                {
                    "period_begin": "2021-07-11T01:02:03Z",
                    "period_end": "2021-07-11T01:03:03Z",
                    "time": "2021-07-11T01:02:03Z",
                    "value": 100
                },
                {
                    "period_begin": "2021-07-11T01:03:03Z",
                    "period_end": "2021-07-11T01:04:03Z",
                    "time": "2021-07-11T01:03:03Z",
                    "value": 105
                },
                {
                    "period_begin": "2021-07-11T01:04:03Z",
                    "period_end": "2021-07-11T01:05:03Z",
                    "time": "2021-07-11T01:04:03Z",
                    "value": 110
                },
                {
                    "period_begin": "2021-07-11T01:05:03Z",
                    "period_end": "2021-07-11T01:06:03Z",
                    "time": "2021-07-11T01:05:03Z",
                    "value": 115
                },
                {
                    "period_begin": "2021-07-11T01:06:03Z",
                    "period_end": "2021-07-11T01:07:03Z",
                    "time": "2021-07-11T01:06:03Z",
                    "value": 120
                }
            ],
            "title": "Number of connected Postgres clients",
            "unit": null
        }
    ]
}