-
Notifications
You must be signed in to change notification settings - Fork 238
Relay metrics #938
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
Relay metrics #938
Conversation
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
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.
lgtm, just few comments
relay/cache/cache_accessor.go
Outdated
@@ -47,6 +48,9 @@ type cacheAccessor[K comparable, V any] struct { | |||
// cache is the underlying cache that this wrapper manages. | |||
cache Cache[K, V] | |||
|
|||
// weightCalculator is the function used to calculate the weight of a key-value pair. | |||
calculator WeightCalculator[K, V] |
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.
What is this calculator or the weight used for?
I feel like abstractions like this make the code bit harder to read
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.
It's used to calculate the size of each individual item in the cache. Things like blobs are straight forward, you just take the length of the byte array. Chunks are much less straight forward, since they are stored in a more complex data structure.
I agree that these types of abstractions add complexity. I'm just not sure how to make the cache sufficiently generic as to work with both blobs and chunks without it.
Signed-off-by: Cody Littley <[email protected]>
relay/metrics.go
Outdated
} | ||
|
||
// NewRelayMetrics creates a new RelayMetrics instance, which encapsulates all metrics related to the relay. | ||
func NewRelayMetrics(logger logging.Logger, port int) (*RelayMetrics, error) { |
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.
It looks the metric wrapper doesn't make it much concise, especially considering the amount of code added
Signed-off-by: Cody Littley <[email protected]>
Why are these changes needed?
Adds metrics to the relay server.
Checks