Skip to content

feat(metrics): emit hit/miss counters for the Redis installation-token cache #2074

Description

@JSONbored

The Redis installation-token cache (src/selfhost/redis-token-cache.ts) that lets warm tokens survive restarts emits no metrics, so operators can't see cold-start re-mint rate (the whole point of #perf). Add a gittensory_redis_token_cache_total{result="hit"|"miss"} counter in get(): hit when a valid {token,expiresAtMs} is returned, miss when raw is null OR the parsed shape is invalid.

Deliverables

  • Import incr from ./metrics into src/selfhost/redis-token-cache.ts
  • Increment gittensory_redis_token_cache_total{result="hit"} on a valid parse and {result="miss"} on null raw and on invalid shape (both nullish arms)
  • Do NOT log the token value in any metric label
  • Unit tests: hit, miss-on-null, miss-on-malformed-JSON, miss-on-wrong-types

References

  • src/selfhost/redis-token-cache.ts:15
  • src/selfhost/redis-token-cache.ts:31
  • src/selfhost/metrics.ts:48

size: S · gittensor:feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions