metric

A metric parameter describes a specific metric or collection of metrics within a family.

Parameters

  • family: The name of the metric family.

  • [optional] labels: An array of key/value maps describing the specific metrics to retrieve. If not set, all metrics in the family will be returned.

Example

This metric parameter is looking for specific metrics within family query_seconds. These metrics may have labels for “operation” and “suboperation”, but one or both labels may be absent.

"metric": {
    "family": "query_seconds",
    "labels": [
        # get the metric for this specific operation and suboperation
        {"operation": "process_query", "suboperation": "pmgd"},

        # get the metric for operation "send_response" without a specific suboperation
        {"operation": "send_response"},

        # get the metric with neither an operation nor a suboperation
        {},

        # there is no operation "post_to_social_media", so this will not return a metric
        {"operation": "post_to_social_media"}
    ]
}

The result includes the metric values from family query_seconds that match the requested labels.

"families": [{
    "name": "query_seconds",
    "type": "Histogram",
    "help": "Time taken per query, in seconds",
    "metrics": [{
        "labels": {},
        "buckets": [ ... ],
        "count": 1234,
        "sum": "100.0"
    },{
        "labels": { "operation": "process_query", "suboperation": "pmgd" },
        "buckets": [ ... ],
        "count": 1234,
        "sum": "10.0"
    },{
        "labels": { "operation": "send_response" },
        "buckets": [ ... ],
        "count": 1234,
        "sum": "5.0"
    }]
}]