cabol / nebulex_redis_adapter

Nebulex adapter for Redis

Home Page:https://hexdocs.pm/nebulex_redis_adapter/NebulexRedisAdapter.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NebulexRedisAdapter does not implement `c:stats/0`

simoncocking opened this issue · comments

Given:

defmodule MyCache do
  use Nebulex.Cache,
    otp_app: :nebulex,
    adapter: NebulexRedisAdapter
end

then

iex> MyCache.stats()
** (UndefinedFunctionError) function MyCache.stats/0 is undefined or private, but the behaviour Nebulex.Cache expects it to be present
    (my_app 0.1.0) MyCache.stats()

This leaves us unable to obtain Telemetry metrics for this cache.

Yeah, the adapter does not implement the Nebulex.Adapter.Stats behaviour, this will be supported soon. Now that it emits the Telemetry span events, it is easy to implement stats similar to the Nebulex.Adapters.Local by using the provided Telemetry handler Nebulex.Telemetry.StatsHandler.