Skip to main content

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.


[{
"GetMetrics": {
"metrics": [{
"family": "query_seconds",
"labels": [{
"operation": "process_query",
"suboperation": "graph"
}, {
"operation": "send_response"
}, {
"operation": "post_to_social_media"
}]
}]
}
}]

Successful response:


[{
"GetMetrics": {
"status": 0,
"values": {
"families": [{
"help": "Time taken per query, in seconds",
"metrics": [{
"buckets": [{
"count": 13,
"max": "0.0001"
}, {
"count": 13,
"max": "0.001"
}, {
"count": 13,
"max": "0.01"
}, {
"count": 13,
"max": "0.1"
}, {
"count": 13,
"max": "1"
}, {
"count": 13,
"max": "inf"
}],
"count": 13,
"labels": {
"operation": "send_response"
},
"sum": "0.0004799009999999999"
}, {
"buckets": [{
"count": 5,
"max": "0.0001"
}, {
"count": 6,
"max": "0.001"
}, {
"count": 14,
"max": "0.01"
}, {
"count": 14,
"max": "0.1"
}, {
"count": 14,
"max": "1"
}, {
"count": 14,
"max": "inf"
}],
"count": 14,
"labels": {
"operation": "process_query",
"suboperation": "graph"
},
"sum": "0.037046626"
}],
"name": "query_seconds",
"type": "Histogram"
}]
},
"version": "0.15.1"
}
}]

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