Prometheus Notes

1 min read

Notes for reading the result of a protocol: prometheus external call. All notes accept the map injected under .external.<name> by the Prometheus client.

Reference

NoteDescription
promValueReturns the canonical scalar value from a Prometheus instant query result.
promSumSums all series values in a vector result.
promMaxReturns the maximum value across all series in a vector result.
promAboveThresholdReturns "true" when the first-series value is strictly greater than the threshold, "false" otherwise.
promBelowThresholdReturns "true" when the first-series value is strictly less than the threshold, "false" otherwise.
promSeriesCountReturns the number of series in a vector result as a string.
promLabelValuesReturns a comma-separated string of the given label’s values across all series.

Examples

# promValue
# value: "{{ promValue .external.goroutines }}"

# promSum
# value: "{{ promSum .external.requestsTotal }}"

# promMax
# value: "{{ promMax .external.cpuUsage }}"

# promAboveThreshold
# value: "{{ promAboveThreshold .external.queueDepth 1000 }}"

# promBelowThreshold
# value: "{{ promBelowThreshold .external.errorRate 0.01 }}"

# promSeriesCount
# value: "{{ promSeriesCount .external.activePods }}"

# promLabelValues
# value: "{{ promLabelValues .external.pods \"namespace\" }}"