-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow non-constant endpoints to opt-in to timings #2366
Conversation
Generate changelog in
|
if (ChannelToEndpointChannel.isConstant(endpoint) | ||
|| endpoint.tags().contains("dialogue-enable-endpoint-timing")) { |
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 suppose we could probably update ChannelToEndpointChannel
to use a caffeine cache with weak keys, and get rid of the isConstant
check altogether once the feign client implementation reuses endpoint values -- worst case is weakref churn and metric fanout, but we don't expect these things to be entirely unbounded. When Endpoints aren't reused, this method is called for every request, so looking up the timers in a large TaggedMetricRegistry can be nontrivial, but code that expects decent performance shouldn't stray far from the standard path.
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 think I'm in favor of this proposal for a couple reasons:
- Even in the current implementation, a poorly implemented client with unbounded service/endpoint names could blow up this
ChannelToEndpointChannel
cache. Using a Caffeine cache would allow to avoid this by use weak keys and/or bounding the cache. ChannelToEndpointChannel
assumes that non-constant endpoints are uniquely identified by(service, endpoint)
, but this isn't correct, for the reasons mentioned in Cache Feign endpoints conjure-java-runtime#2973 (comment). It would probably be good to switch to a cache for this reason alone.
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've put up #2367. Let me know if this isn't what you were imagining.
Closing in favor of #2367 |
Related to #1414
Motivated by palantir/conjure-java-runtime#2973 (comment)
There may be
Endpoint
implementation that are not constant, but whose cardinality is bounded through other means. This allows thoseEndpoint
implementation to opt-in to timing metrics.