diff --git a/components/electric/lib/electric/telemetry.ex b/components/electric/lib/electric/telemetry.ex index 93c2cc8cf3..e1d445843e 100644 --- a/components/electric/lib/electric/telemetry.ex +++ b/components/electric/lib/electric/telemetry.ex @@ -75,7 +75,8 @@ defmodule Electric.Telemetry do wal_cache_memory: last_value("electric.resources.wal_cache.cache_memory_total", unit: :byte), wal_transactions: last_value("electric.resources.wal_cache.transaction_count"), - oldest_wal_time: last_value("electric.resources.wal_cache.oldest_transaction_timestamp") + oldest_wal_time: last_value("electric.resources.wal_cache.oldest_transaction_timestamp"), + wal_cache_size: last_value("electric.resources.wal_cache.max_cache_size", unit: :byte) ], usage: [ concurrent_clients: summary("electric.resources.clients.connected"), diff --git a/components/electric/lib/electric/telemetry/call_home_reporter.ex b/components/electric/lib/electric/telemetry/call_home_reporter.ex index 48f5dc4d24..a3cf00e9ef 100644 --- a/components/electric/lib/electric/telemetry/call_home_reporter.ex +++ b/components/electric/lib/electric/telemetry/call_home_reporter.ex @@ -207,7 +207,9 @@ defmodule Electric.Telemetry.CallHomeReporter do mode: mode(items) } rescue - ArgumentError -> + [ArgumentError, Enum.EmptyError, ArithmeticError] -> + # Enum.EmptyError may be raised when there are no elements in the ETS table under the key `path` + # ArithmeticError may be raised when an element in the ETS table is `nil` @empty_summary end diff --git a/components/electric/lib/electric/telemetry/metrics.ex b/components/electric/lib/electric/telemetry/metrics.ex index 777ae37996..b481a3c5ac 100644 --- a/components/electric/lib/electric/telemetry/metrics.ex +++ b/components/electric/lib/electric/telemetry/metrics.ex @@ -14,8 +14,8 @@ defmodule Electric.Telemetry.Metrics do This event contains the following measurements: - `transaction_count`: Number of transactions currently in cache - - `max_transaction_count`: Maximum number of transactions the cache will store - `oldest_transaction_timestamp`: `DateTime` timestamp of the oldest transaction currently in cache + - `max_cache_size`: Maximum total size of the cached transactions - `cache_memory_total`: Current estimated memory usage by the WAL cache, in bytes - `[:electric, :resources, :clients]`