refactor(controller): fold compare_target_graphs metrics into get_changed_targets#242
Open
xytan0056 wants to merge 1 commit into
Open
refactor(controller): fold compare_target_graphs metrics into get_changed_targets#242xytan0056 wants to merge 1 commit into
xytan0056 wants to merge 1 commit into
Conversation
…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
commented
Jul 25, 2026
| 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() { |
Contributor
Author
There was a problem hiding this comment.
not using Begin/Complete cause the error retruned will be emitted in top controller.GetChangedTargets
sywhang
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Route
compareTargetGraphs's metrics underopGetChangedTargets(it's a private sub-step of GetChangedTargets, not its own RPC) and replace its Begin/Complete lifecycle with a singlecompare_durationhistogram, since a failure there already surfaces onget_changed_targets.finishand was being double-counted. Breaking:controller.compare_target_graphs.*is removed; usecontroller.get_changed_targets.{compare_duration,decode_duration,diff_duration}instead.