diff --git a/.changeset/fix-no-consumer-log-shape-handle.md b/.changeset/fix-no-consumer-log-shape-handle.md new file mode 100644 index 0000000000..3bd662b712 --- /dev/null +++ b/.changeset/fix-no-consumer-log-shape-handle.md @@ -0,0 +1,5 @@ +--- +'@core/sync-service': patch +--- + +Emit `shape_handle` as Logger metadata (instead of interpolating it into the message body) for the "No consumer process when waiting on initial snapshot creation" error. This keeps the message text static so Sentry can deduplicate these events properly during incidents. diff --git a/packages/sync-service/lib/electric/shape_cache.ex b/packages/sync-service/lib/electric/shape_cache.ex index e8d704bc69..6d37a61d2b 100644 --- a/packages/sync-service/lib/electric/shape_cache.ex +++ b/packages/sync-service/lib/electric/shape_cache.ex @@ -189,7 +189,8 @@ defmodule Electric.ShapeCache do ]) Logger.error( - "No consumer process when waiting on initial snapshot creation for #{shape_handle}" + "No consumer process when waiting on initial snapshot creation", + shape_handle: shape_handle ) {:error, :unknown} diff --git a/packages/sync-service/test/electric/shape_cache_test.exs b/packages/sync-service/test/electric/shape_cache_test.exs index 320bba5e29..b943b79709 100644 --- a/packages/sync-service/test/electric/shape_cache_test.exs +++ b/packages/sync-service/test/electric/shape_cache_test.exs @@ -1070,7 +1070,7 @@ defmodule Electric.ShapeCacheTest do assert String.contains?( log, - "[error] No consumer process when waiting on initial snapshot creation for #{shape_handle}" + "shape_handle=#{shape_handle} [error] No consumer process when waiting on initial snapshot creation" ) assert_receive {ShapeCache.ShapeCleaner, :cleanup, ^shape_handle}