refactor: switch cachex stats to telemetry polling#3156
refactor: switch cachex stats to telemetry polling#3156Ziinc merged 13 commits intoLogflare:mainfrom
Conversation
| ["Logflare", context, "Cache"] = Module.split(cache) | ||
| {cache, context |> Macro.underscore() |> String.to_atom()} | ||
| end) | ||
|
|
There was a problem hiding this comment.
This evaluates to
[
{Logflare.TeamUsers.Cache, :team_users},
{Logflare.Partners.Cache, :partners},
{Logflare.Users.Cache, :users},
{Logflare.Backends.Cache, :backends},
{Logflare.Sources.Cache, :sources},
{Logflare.Billing.Cache, :billing},
{Logflare.SourceSchemas.Cache, :source_schemas},
{Logflare.Auth.Cache, :auth},
{Logflare.Endpoints.Cache, :endpoints},
{Logflare.Rules.Cache, :rules},
{Logflare.SavedSearches.Cache, :saved_searches}
]or should it be hardcoded?
There was a problem hiding this comment.
can you inverse the logic so that we can do list_contexts_to_cache() and in list_caches it will call list_contexts_to_cache/0 and concat the .Cache
There was a problem hiding this comment.
the module.split isn't very pretty 😆
There was a problem hiding this comment.
besides that, its fine with keeping it dynamic.
There was a problem hiding this comment.
I went into a slightly different direction and added
def list_caches_with_metrics do
[
{TeamUsers.Cache, :team_users},
{Partners.Cache, :partners},
{Users.Cache, :users},
{Backends.Cache, :backends},
{Sources.Cache, :sources},
{Billing.Cache, :billing},
{SourceSchemas.Cache, :source_schemas},
{Auth.Cache, :auth},
{Endpoints.Cache, :endpoints},
{Rules.Cache, :rules},
{KeyValues.Cache, :key_values},
{SavedSearches.Cache, :saved_searches}
]
endI think it's a bit safer for atoms to exist in the source code.
|
@Ziinc 👋 I think this is ready for review. |
Ziinc
left a comment
There was a problem hiding this comment.
just minor refactoring for cleaner code
| ["Logflare", context, "Cache"] = Module.split(cache) | ||
| {cache, context |> Macro.underscore() |> String.to_atom()} | ||
| end) | ||
|
|
There was a problem hiding this comment.
can you inverse the logic so that we can do list_contexts_to_cache() and in list_caches it will call list_contexts_to_cache/0 and concat the .Cache
| ["Logflare", context, "Cache"] = Module.split(cache) | ||
| {cache, context |> Macro.underscore() |> String.to_atom()} | ||
| end) | ||
|
|
There was a problem hiding this comment.
the module.split isn't very pretty 😆
| ["Logflare", context, "Cache"] = Module.split(cache) | ||
| {cache, context |> Macro.underscore() |> String.to_atom()} | ||
| end) | ||
|
|
There was a problem hiding this comment.
besides that, its fine with keeping it dynamic.
|
It appears to be working with local collector, no errors in It might be worth adding to Off-topic OTEL-related errorsNote that telemetry detaches all failed handlers permanently, no retries. So exporters probably should be able to handle expected errors without throws/exits/errors. |

ANL-1033
Removed log-based Cachex stats collection in favor of telemetry-based polling system.