From ab470a6301392ef91b1a744366804244059e95c3 Mon Sep 17 00:00:00 2001 From: Kevin De Porre Date: Tue, 26 Nov 2024 17:03:30 +0100 Subject: [PATCH 1/2] Add replication lag to current span --- packages/sync-service/lib/electric/shapes/consumer.ex | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/sync-service/lib/electric/shapes/consumer.ex b/packages/sync-service/lib/electric/shapes/consumer.ex index 0b4796b0f2..d0761f54df 100644 --- a/packages/sync-service/lib/electric/shapes/consumer.ex +++ b/packages/sync-service/lib/electric/shapes/consumer.ex @@ -434,12 +434,6 @@ defmodule Electric.Shapes.Consumer do now = DateTime.utc_now() lag = Kernel.max(0, DateTime.diff(now, commit_timestamp, :millisecond)) - OpenTelemetry.with_span( - "shape_write.consumer.do_handle_txn.report_replication_lag", - [lag: lag], - fn -> - lag - end - ) + OpenTelemetry.add_span_attributes(lag: lag) end end From 43b905495eb49e89715d2e1519f13d8567266a20 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 26 Nov 2024 17:30:15 +0100 Subject: [PATCH 2/2] Update OTEL attribute name for replication lag Co-authored-by: Kyle Mathews --- packages/sync-service/lib/electric/shapes/consumer.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sync-service/lib/electric/shapes/consumer.ex b/packages/sync-service/lib/electric/shapes/consumer.ex index d0761f54df..7e694eba33 100644 --- a/packages/sync-service/lib/electric/shapes/consumer.ex +++ b/packages/sync-service/lib/electric/shapes/consumer.ex @@ -434,6 +434,6 @@ defmodule Electric.Shapes.Consumer do now = DateTime.utc_now() lag = Kernel.max(0, DateTime.diff(now, commit_timestamp, :millisecond)) - OpenTelemetry.add_span_attributes(lag: lag) + OpenTelemetry.add_span_attributes(replication_lag: lag) end end