-
Notifications
You must be signed in to change notification settings - Fork 107
Fix Route Registry Metrics to Report Correct Result #468
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
Comments
In general I approve making these changes, with a few additions...
❓ Do you think that the old metrics should be deprecated and removed eventually? |
The value is reported as a tag on the metric and only exists when using the prometheus metrics we only recently merged (it's ignored in the envelope logic). The part where a long-standing value would change is the log line: routing-release/src/code.cloudfoundry.org/gorouter/registry/registry.go Lines 99 to 112 in 426271f
So new / old metrics where we could have a feature flag are not a thing. And if we want a compatibility flag for the log statements we would also need to retain the old convoluted if-statements and couldn't clean that up (or at least not as much). |
@maxmoehl ❓ Can you explain more about what would change with the log lines? Is it when it logs? Or the main message that it logs? or the data included in the log message? |
I've taken a closer look at the code and a possible change would be this commit. I now better understand the intention of the old logic, it is something like this:
My main issue is with
I would propose to make The other log fields should not be affected by this. |
Gotcha. Thanks for that explanation @maxmoehl. I think that is a good idea, I won't consider this a breaking change. No need to add branching logic to do the old logs. |
PR is ready: #478 |
Resolves: cloudfoundry#468 Co-Authored-By: Clemens Hoffmann <[email protected]>
Resolves: cloudfoundry#468 Co-Authored-By: Clemens Hoffmann <[email protected]>
Resolves: cloudfoundry#468 Co-Authored-By: Clemens Hoffmann <[email protected]>
Proposed Change
We see an issue with the Route Registry code.
Register
Currently, Register() calls register(), which calls Pool.Put()
Put()
updates the pool if required, and returns thePoolPutResult
toregister()
:register()
creates the pool if required, sets the time of update and forwards thePoolPutResult
toRegister()
.Register()
receives and logs thePoolPutResult
, and ingests a generic route registry metric.Unregister
On the other hand, we have a similar functionality with Unregister(), which calls unregister(), which calls pool.Remove().
However, the structure is quite different here:
Remove()
returns a boolean value reflecting whether the route has been removed from the pool, or not.unregister()
however does some logging based on the result ofRemove()
, and removes the pool if required.Unregister()
finally unconditionally ingests a generic route unregistry metric.Issues
There are some problems with the current code:
pool.Put()
always returns statusUPDATED
when the route exists in the pool. Hence, the metric doesn't reflect whether a route has received an update, or if not (in case its attributes haven't changed).Unregister()
always ingests anUnregistryMessage
, independently of the result of pool.Remove(). Hence, the metric doesn't reflect whether a route has been removed or not.Register()
/Unregister()
.Register()
andUnregister()
functions and its related private functions should be refactored, e.g.Acceptance criteria
PoolPutResult
and aPoolRemoveResult
.CaptureRegistryMessage
andCaptureUnregistryMessage
.UPDATED
result in case of no-op registry update.Related links
The text was updated successfully, but these errors were encountered: