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

Revisit the Stats hook to ensure that we're correctly representing operations #5

Closed
whitfin opened this issue Apr 7, 2016 · 2 comments
Assignees

Comments

@whitfin
Copy link
Owner

whitfin commented Apr 7, 2016

Right now we just track get/set and a couple of other things. It would be better if the Stats hook were modified into tracking all CRUD groups (at least).

Perhaps it would be nice to track the count of results in some form. We could keep track of results on a per-action basis (this is just noted for my memory).

%{
  "clear" => 500,
  "exists?" => %{
    "true" => 10,
    "false" => 20
  },
  "get" => %{
    "ok" => 10,
    "missing" => 20,
    "loaded" => 15
  }
}

Maybe then we could support stats retrieval on a per-command basis which allows us to provide additional info about that stat.

Cachex.stats(:my_cache)                 # very high level stats (op count, etc)
Cachex.stats(:my_cache, :get)           # include things like hit rate using info in the `:get` key
Cachex.stats(:my_cache, [ :get, :set ]) # same as above but for both actions
Cachex.stats(:my_cache, :raw)           # everything we have collected (the struct above)
@whitfin whitfin self-assigned this Apr 7, 2016
@whitfin
Copy link
Owner Author

whitfin commented Apr 8, 2016

Been thinking on this more and I like the above. Although I think there should also be a :global entry which is very general statistics (similar to those tracked currently). Easy to get a high-level overview of your cache usage that way.

If we default to using :global, it has the benefit of keeping the API compatible for anyone relying on the current formats.

@whitfin
Copy link
Owner Author

whitfin commented Apr 9, 2016

Slight tweaks to the initial notes on how to specify different stat retrieval.

It would become the below instead. This is to avoid any change in the public API, and because it's just an option rather than a requirement.

Cachex.stats(:my_cache, for: :get)

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

No branches or pull requests

1 participant