Skip to content

Conversation

@Jonas-Isr
Copy link
Member

BLI:

Prerequisite:

Context

This is a feature that we already merged at one point and then later removed again because we found problems that we were not able to fix and test before release. (The underlying problem we found and wanted to fix first is in the PR linked above.)

This PR prepends an additional check to tryGetDestination: when a single destination is called, it is first checked whether this destination appears in the result of a get all destination call. If the destination is not present, no call to the destination is made. The goal of this feature is to improve the circuit breaker, as the circuit breaker now does not open unnecessarily when non-existing destination(s) are called multiple times.

Feature scope:

  • add new lookup to DestinationService.tryGetDestination
  • add tests

Definition of Done

@Jonas-Isr Jonas-Isr self-assigned this Jan 5, 2026
@Jonas-Isr
Copy link
Member Author

Regarding a test showing the failure we saw in the e2e tests in December:

I added an additional test that is green in the current implementation but will fail if the retrieval strategy is not correctly forwarded in the pre-lookup check of the DestinationService. In that case the destination is not found even though it exists, because the a different retrieval strategy is used for the pre-lookup check than was specified in the DestinationOptions.

To see this, simply delete retrievalStrategy in line 397 of DestinationService and the test will fail. This is what happened in the previous implementation we merged to main in December.

Comment on lines 129 to 130
final String msg = "Destination %s was not found among the destinations of the current tenant.";
return Try.failure(new DestinationNotFoundException(destinationName, String.format(msg, destinationName)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor)
I found the hard-coded "destinations of current tenant" misleading for cases like "always-provider". Therefore I moved the code around a little and introduced the notion of "validating destination lookup". Maybe "intercept" would've been a better word(?)

@newtork newtork enabled auto-merge (squash) January 9, 2026 13:37
Comment on lines +951 to +957
final String[] featureNames =
{
DestinationServiceOptionsAugmenter.X_FRAGMENT_KEY,
DestinationServiceOptionsAugmenter.CROSS_LEVEL_SETTING_KEY,
DestinationServiceOptionsAugmenter.CUSTOM_HEADER_KEY };
final Set<String> keys = options.getOptionKeys();
return keys.stream().anyMatch(s -> Arrays.stream(featureNames).anyMatch(s::equalsIgnoreCase));
return keys.stream().anyMatch(s -> Arrays.stream(featureNames).anyMatch(s::startsWith));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment)

I replaced my incorrectly changed "equalsIgnoreCase" back to your original "startsWith". Unit tests now cover this difference.

Also referenced the options-augmenter directly, in case we'll refine it later.

@newtork newtork merged commit 9fdb944 into main Jan 9, 2026
15 checks passed
@newtork newtork deleted the add-preLookup-Check branch January 9, 2026 13:41
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.

3 participants