-
Notifications
You must be signed in to change notification settings - Fork 107
Route registry enhancements #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Route registry enhancements #478
Conversation
f58bd8f
to
09dd5ac
Compare
We've validated this in one of our environments and the metrics now show up with the "refreshed" tag. As expected, the number of route messages labeled as "updated" went down a lot as those are now "refreshed". The logs also behave as expected with the refresh logs (which have a high volume) being not emitted if you set the log level to info. We also ran the routing-release test suite for gorouter and it passes. |
} | ||
|
||
func (r *RouteRegistry) unregister(uri route.Uri, endpoint *route.Endpoint) { | ||
func (r *RouteRegistry) unregister(uri route.Uri, endpoint *route.Endpoint) (endpointRemoved, routeRemoved bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pleadse have proper types for endpointRemoved
and routeRemoved
, similar to the poolPutResult
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well these are just bools... I'd rather not introduce aliases for true
and false
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not, still better than having
return true, false
return false, false
return true, true
in the code, where you need to read function signatures to understand the meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @hoffmaen. The coding would be more readable. But your call.
One more thing: We log the registration of new routes very deep in the code (in |
dc96907
to
b49cabf
Compare
Resolves: cloudfoundry#468 Co-Authored-By: Clemens Hoffmann <[email protected]>
b98740e
to
1fea46d
Compare
src/code.cloudfoundry.org/gorouter/metrics/metricsreporter_test.go
Outdated
Show resolved
Hide resolved
src/code.cloudfoundry.org/gorouter/metrics/metricsreporter_test.go
Outdated
Show resolved
Hide resolved
@@ -88,32 +88,42 @@ func (r *RouteRegistry) Register(uri route.Uri, endpoint *route.Endpoint) { | |||
return | |||
} | |||
|
|||
endpointAdded := r.register(uri, endpoint) | |||
poolPutResult, routeAdded := r.register(uri, endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe routePoolAdded instead of routeAdded? It is clearer then.
Resolves: cloudfoundry#468 Co-Authored-By: Clemens Hoffmann <[email protected]>
Co-Authored-By: Clemens Hoffmann <[email protected]> Co-Authored-By: Soha Alboghdady <[email protected]>
Co-Authored-By: Clemens Hoffmann <[email protected]> Co-Authored-By: Soha Alboghdady <[email protected]>
1fea46d
to
0eb9044
Compare
e1bf949
to
e648904
Compare
Summary
Rework some of the route registry logic to reduce nested ifs and align some of the logic.
Backward Compatibility
Breaking Change? No