Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

pkoenig10
Copy link
Member

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 those Endpoint implementation to opt-in to timing metrics.

@changelog-app
Copy link

changelog-app bot commented Sep 30, 2024

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Non-constant endpoints can opt-in to timings by using the dialogue-enable-endpoint-timing tag.

Check the box to generate changelog(s)

  • Generate changelog entry

Comment on lines +256 to +257
if (ChannelToEndpointChannel.isConstant(endpoint)
|| endpoint.tags().contains("dialogue-enable-endpoint-timing")) {
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@carterkozak
Copy link
Contributor

Closing in favor of #2367

@carterkozak carterkozak closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants