alert when claude usage runs ahead of the clock, per account
This commit is contained in:
parent
dab7768869
commit
319dd6a808
1 changed files with 191 additions and 28 deletions
|
|
@ -1782,6 +1782,29 @@ in
|
|||
for = "10m";
|
||||
summary = "the store client certificate {{ $labels.cert }} (hive {{ $labels.hive }}, agent {{ $labels.agent }}) is past 80% of its validity";
|
||||
})
|
||||
# Usage share ahead of the clock share, per claude account and
|
||||
# window: percent used minus the percent of the window already
|
||||
# elapsed, so above zero means ahead. The window length comes
|
||||
# from the `window` label (`seven_day`, `five_hour`); other
|
||||
# windows are not selected. `account` is stamped by hive-agent
|
||||
# (`claude_usage_watch`); series without it (older agent builds)
|
||||
# are not selected. `max by` collapses the agents that share an
|
||||
# account. A `resets_at` in the past makes the elapsed share
|
||||
# exceed 100, so a stale series cannot fire.
|
||||
(metricThresholdRule {
|
||||
uid = "hh-claude-usage-ahead-of-clock";
|
||||
title = "claude usage ahead of the clock";
|
||||
expr =
|
||||
let
|
||||
ahead =
|
||||
window: seconds:
|
||||
''max by (account, window) (last_over_time({__name__="hyperhive.agent.claude_usage.percent", window="${window}", account!=""}[15m])) - 100 * (1 - (max by (account, window) (last_over_time({__name__="hyperhive.agent.claude_usage.resets_at", window="${window}", account!=""}[15m])) - time()) / ${toString seconds})'';
|
||||
in
|
||||
"(${ahead "seven_day" 604800}) or (${ahead "five_hour" 18000})";
|
||||
threshold = 0;
|
||||
for = "1h";
|
||||
summary = "claude account {{ $labels.account }} has used more of its {{ $labels.window }} usage window than the window has elapsed";
|
||||
})
|
||||
]
|
||||
# One rule per declared hive rather than one grouped by
|
||||
# `hive`, so a hive that sends nothing at all still has
|
||||
|
|
|
|||
Loading…
Reference in a new issue