Skip to content

refactor(controller): fold compare_target_graphs metrics into get_changed_targets#242

Open
xytan0056 wants to merge 1 commit into
mainfrom
chore/consolidate-compare-op
Open

refactor(controller): fold compare_target_graphs metrics into get_changed_targets#242
xytan0056 wants to merge 1 commit into
mainfrom
chore/consolidate-compare-op

Conversation

@xytan0056

@xytan0056 xytan0056 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Route compareTargetGraphs's metrics under opGetChangedTargets (it's a private sub-step of GetChangedTargets, not its own RPC) and replace its Begin/Complete lifecycle with a single compare_duration histogram, since a failure there already surfaces on get_changed_targets.finish and was being double-counted. Breaking: controller.compare_target_graphs.* is removed; use controller.get_changed_targets.{compare_duration,decode_duration,diff_duration} instead.

…nged_targets

compareTargetGraphs is a private sub-step of GetChangedTargets, not its
own RPC, so it should not carry a separate op. Route its phase metrics
(decode_duration, diff_duration) under opGetChangedTargets, matching the
other helpers (cache_read_duration, graph_fetch_duration, target_count).

Replace the Begin/Complete lifecycle with a single compare_duration
histogram: an error in this step already surfaces on
get_changed_targets.finish, so the sub-op finish histogram was
double-counting the same failure under a second op name. Total step
latency is preserved via compare_duration.

BREAKING CHANGE: the controller.compare_target_graphs.* metrics
(start, finish, decode_duration, diff_duration) are removed. Use
controller.get_changed_targets.{compare_duration,decode_duration,diff_duration}
instead.
@xytan0056
xytan0056 requested review from a team as code owners July 25, 2026 04:03
defer func() { op.Complete(retErr) }()
func (c *controller) compareTargetGraphs(ctx context.Context, e *metrics.Emitter, logger *zap.Logger, firstGraph, secondGraph []entity.GetTargetGraphResponse, maxDist int32) ([]entity.GetChangedTargetsResponse, error) {
compareStart := time.Now()
defer func() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not using Begin/Complete cause the error retruned will be emitted in top controller.GetChangedTargets

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.

2 participants