You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The emitTrafficManagerProfileStatusMetric function is called within a deferred function, but it doesn't guarantee that the metric will be emitted before the function returns. This could lead to race conditions where the metric is not yet emitted when the function exits.
// TODO: replace the following with defaulter wehbook
The emitTrafficManagerProfileStatusMetric function calls meta.FindStatusCondition, but it doesn't check if the condition is nil before accessing its fields. This could cause a panic if the condition is nil.
-defer emitTrafficManagerProfileStatusMetric(profile)+defer func() {+ if err := emitTrafficManagerProfileStatusMetric(profile); err != nil {+ klog.ErrorS(err, "Failed to emit traffic manager profile status metric", "trafficManagerProfile", profileKRef)+ }+}()
Suggestion importance[1-10]: 7
__
Why: The suggestion improves the robustness of the code by adding error handling for the metric emission logic, which is important for maintaining the reliability of the application.
Why: This suggestion ensures that the metric emission logic only runs if there are status conditions present, preventing unnecessary metric emissions when the profile status hasn't changed.
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.
What type of PR is this?
/kind feature
add status metrics,
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Requirements:
make reviewablefor basic local testHow has this code been tested
added integration tests
e2e tests are green, https://github.com/Azure/fleet-networking/actions/runs/14467440679
Special notes for your reviewer