Skip to content

feat(metrics): emit hit/miss/error counters for the Redis GitHub-response cache #2073

Description

@JSONbored

The Redis GitHub GET-response cache (src/selfhost/redis-response-cache.ts) emits zero Prometheus metrics, unlike the in-isolate GitHub HTTP cache which records hit/miss/set/coalesced via recordGitHubCacheMetric (src/github/client.ts:127). Operators have no way to see whether GITHUB_CACHE_TTL_SECONDS is actually saving REST budget. Add a gittensory_redis_gh_response_cache_total{result} counter (hit on get()-returns-value, miss on get()-returns-null, set on set()) incremented inside createRedisResponseCache.

Deliverables

  • Import incr from ../selfhost/metrics into src/selfhost/redis-response-cache.ts
  • Increment gittensory_redis_gh_response_cache_total{result="hit"|"miss"} in get() (hit = replayable parse succeeds, miss = raw null OR unparseable)
  • Increment {result="set"} in set()
  • Match the existing label style in src/selfhost/metrics.ts (small fixed label set, no repo label)
  • Unit tests covering hit, miss (null raw), miss (malformed JSON), and set — both branches of the parse guard

References

  • src/selfhost/redis-response-cache.ts:21
  • src/selfhost/redis-response-cache.ts:43
  • src/github/client.ts:127
  • 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