Skip to content

Commit

Permalink
fix(electric): Fix a couple of issues in sync service's telemetry (#1314
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alco committed Jun 4, 2024
1 parent e77296d commit fdc9a75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components/electric/lib/electric/telemetry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion components/electric/lib/electric/telemetry/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]`
Expand Down

0 comments on commit fdc9a75

Please sign in to comment.