Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record cache statistics #19

Open
dimo414 opened this issue Nov 3, 2022 · 0 comments
Open

Record cache statistics #19

dimo414 opened this issue Nov 3, 2022 · 0 comments

Comments

@dimo414
Copy link
Owner

dimo414 commented Nov 3, 2022

It would be nice to log statistics about cached invocations, such as execution durations and hits vs. misses. This could be used to optimize TTLs and observe unexpected cache misses.

Any such logging should be opt-in at the call site - e.g. behind a --log_statistics flag - and ideally also gated by a Cargo feature (though the feature could be enabled by default as long as it doesn't incur too much overhead).

I'm envisioning writing to an append-only file in the cache directory and using a simple schema such as a TSV. Columns might include:

  • Timestamp
  • Scope
  • Command name (i.e. argv-0)
  • Full command line
  • cwd
  • Parent PID
  • Hit / miss / force / refresh (i.e. executed asynchronously via --warm or --stale)
  • Exit status
  • Execution time (0 for hits)
  • Remaining TTL (0 for misses)
  • Remaining TTStale (0 for misses)

It would be nice to find some prior art of other CLI tools that log local statistics like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant