Skip to content

Add latency metric for backfilling replication history events#10918

Open
xwduan wants to merge 3 commits into
mainfrom
will/add_backfill_events_latency_metric
Open

Add latency metric for backfilling replication history events#10918
xwduan wants to merge 3 commits into
mainfrom
will/add_backfill_events_latency_metric

Conversation

@xwduan

@xwduan xwduan commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What

Adds a timer metric replication_backfill_events_latency that measures how long bringLocalEventsUpToSourceCurrentBranch takes to execute during workflow state replication (backfilling history events).

The metric is recorded via a defer so it captures every return path (including early returns and errors) and is tagged with the namespace name.

Why

We currently have no visibility into how long backfilling replication history events takes. This metric surfaces that latency per-namespace.

🤖 Generated with Claude Code

Measure the time taken by bringLocalEventsUpToSourceCurrentBranch,
tagged by namespace, via replication_backfill_events_latency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xwduan xwduan requested review from a team as code owners July 3, 2026 21:31
xwduan and others added 2 commits July 3, 2026 14:41
Resolve the namespace once at the top for the latency metric tag and
reuse it, removing the redundant second lookup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep namespace lookup on the append path (as before) and capture the
name for the metric tag via a variable, so early-return paths don't
trigger unexpected mock calls. Add GetMetricsHandler expectations to
the bringLocalEvents shard mocks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant