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

Add option for custom v1/statement-like paths #326

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

willmostly
Copy link
Contributor

Description

Add an option to configure additional custom paths that should be treated like /v1/statement. This is required to support some features of Starburst Trino.

Additional context and related issues

The trino gateway checks if a request path starts with /v1/statement to decide if it should use query processing logic.

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( x) Release notes are required, with the following suggested text:
Add option for custom v1/statement-like paths

@cla-bot cla-bot bot added the cla-signed label Apr 25, 2024
@willmostly
Copy link
Contributor Author

The runtime changes introduced here are limited. However, QueryIdCachingProxyHandler units tests were expanded to cover instance methods, which required some significant refactoring. The functionality of RoutingManager and ProxyHandlerStats should not be changed, but interfaces were extracted so that testing versions of these classes could be introduced.

@willmostly willmostly force-pushed the will/additional-statement-paths branch 3 times, most recently from 2d93a73 to 377be60 Compare April 26, 2024 03:15
@ebyhr
Copy link
Member

ebyhr commented Apr 29, 2024

This is required to support some features of Starburst Trino.

Is it possible to test the feature with https://hub.docker.com/r/starburstdata/starburst-enterprise?

@willmostly willmostly force-pushed the will/additional-statement-paths branch from 377be60 to cf72670 Compare May 2, 2024 16:37
Copy link
Member

@mosabua mosabua left a comment

Choose a reason for hiding this comment

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

Just some initial feedback after taking a glance.

@@ -37,6 +37,7 @@ public class HaGatewayConfiguration
private List<String> extraWhitelistPaths = new ArrayList<>();
private OAuth2GatewayCookieConfiguration oauth2GatewayCookieConfiguration = new OAuth2GatewayCookieConfiguration();
private GatewayCookieConfiguration gatewayCookieConfiguration = new GatewayCookieConfiguration();
private List<String> customStatementPaths = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have a statementPaths setup and it defaults to v1/statement .. and users can override or expand to multiple paths


import com.codahale.metrics.Meter;
import io.airlift.stats.CounterStat;
import io.dropwizard.core.setup.Environment;
Copy link
Member

Choose a reason for hiding this comment

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

lets not add new Dropwizard dependencies in new PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry - I should have explained that this is a refactor of existing code to allow for testing.

This class was ProxyHandlerStats, which was a pain to use in unit tests because of the Dropwizard setup. So I made ProxyHandlerStats into an interface, made this class an implementation of it, and added the TestingProxyHandlerStats implementation.


import static java.util.Objects.requireNonNull;

public final class DropWizardProxyHandlerStats
Copy link
Member

Choose a reason for hiding this comment

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

rename to Jetty or airlift .. depending on how you change

@willmostly
Copy link
Contributor Author

This is required to support some features of Starburst Trino.

Is it possible to test the feature with https://hub.docker.com/r/starburstdata/starburst-enterprise?

It is not, the Insights IDE feature that exposes the non-standard statement endpoint requires a license

@willmostly willmostly force-pushed the will/additional-statement-paths branch from cf72670 to ac1c19e Compare May 23, 2024 19:44
@willmostly willmostly requested a review from mosabua May 23, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants