@@ -23,7 +23,7 @@ To enable the routing rules engine, find the following lines in
2323
2424* Set ` rulesEngineEnabled ` to ` true ` , then ` rulesType ` as ` FILE ` or ` EXTERNAL ` .
2525* If you set ` rulesType: FILE ` , then set ` rulesConfigPath ` to the path to your
26- rules config file.
26+ rules config file.
2727* If you set ` rulesType: EXTERNAL ` , set ` rulesExternalConfiguration ` to the URL
2828 of an external service for routing rules processing.
2929* ` rulesType ` is by default ` FILE ` unless specified.
@@ -50,15 +50,30 @@ If there is error parsing the routing rules configuration file, an error is
5050logged, and requests are routed using the routing group header
5151` X-Trino-Routing-Group` as default.
5252
53+ # ## Configuring API Requests with HttpClient Config
54+
55+ Trino Gateway uses the Airlift HttpClient library when making HTTP requests.
56+ You can configure the HttpClient by adding the following configuration to
57+ the `serverConfig:` section with the `router` prefix.
58+
59+ ` ` ` yaml
60+ serverConfig:
61+ router.http-client.request-timeout: 1s
62+ ` ` `
63+
64+ Please refer to the [Trino HTTP Client properties](
65+ https://trino.io/docs/current/admin/properties-http-client.html)
66+ documentation for more.
67+
5368# ## Use an external service for routing rules
5469
5570You can use an external service for processing your routing by setting the
5671` rulesType` to `EXTERNAL` and configuring the `rulesExternalConfiguration`.
5772
58- Trino Gateway then sends all headers, other than those specified in
73+ Trino Gateway then sends all headers, other than those specified in
5974` excludeHeaders` , as a map in the body of a POST request to the external
6075service. If `requestAnalyzerConfig.analyzeRequest` is set to `true`,
61- ` TrinoRequestUser` and `TrinoQueryProperties` are also included.
76+ ` TrinoRequestUser` and `TrinoQueryProperties` are also included.
6277
6378Additionally, the following HTTP information is included :
6479
@@ -77,7 +92,7 @@ return a result with the following criteria:
7792* Response status code of OK (200)
7893* Message in JSON format
7994* Only one group can be returned
80- * If errors is not null, then query would route to default routing group adhoc
95+ * If errors is not null, then query would route to default routing group adhoc
8196
8297` ` ` json
8398{
@@ -120,8 +135,8 @@ object called `request`. Rules may also utilize
120135[trinoQueryProperties](#trinoqueryproperties)
121136objects, which provide information about the user and query respectively.
122137You must include an action of the form `result.put(\"routingGroup\", \"foo\")`
123- to trigger routing of a request that satisfies the condition to the specific
124- routing group. Without this action, the default adhoc group is used and the
138+ to trigger routing of a request that satisfies the condition to the specific
139+ routing group. Without this action, the default adhoc group is used and the
125140whole routing rule is redundant.
126141
127142The condition and actions are written in [MVEL](http://mvel.documentnode.com/),
@@ -146,7 +161,7 @@ group.
146161# ## TrinoStatus
147162
148163The `TrinoStatus` class attempts to track the current state of the configured
149- Trino clusters. The three possible states of these cluster are updated with
164+ Trino clusters. The three possible states of these cluster are updated with
150165every healthcheck :
151166
152167- `PENDING` : A Trino cluster shows this state when it is still starting up. It
@@ -169,7 +184,7 @@ request, in the following order:
1691843. `Authorization : Bearer` header. Requires configuring an OAuth2 User Info URL.
1701854. `Trino-UI-Token` or `__Secure-Trino-ID-Token` cookie.
171186
172- Kerberos and Certificate authentication are not currently supported. If the
187+ Kerberos and Certificate authentication are not currently supported. If the
173188request contains the `Authorization : Bearer` header, an attempt is made to treat
174189the token as a JWT and deserialize it. If this is successful, the value of the
175190claim named in `requestAnalyzerConfig.tokenUserField` is used as the username.
@@ -201,7 +216,7 @@ syntactic analysis is performed.
201216
202217If a query references a view, then that view is not expanded, and tables
203218referenced by the view are not recognized. Views and materialized views are
204- treated as tables and added to the list of tables in all contexts, including
219+ treated as tables and added to the list of tables in all contexts, including
205220statements such as `CREATE VIEW`.
206221
207222A routing rule can call the following methods on the `trinoQueryProperties`
@@ -210,7 +225,7 @@ object:
210225* `String errorMessage()`: the error message, only if there was any error while
211226 creating the `trinoQueryProperties` object.
212227* `boolean isNewQuerySubmission()`: boolean flag to indicate if the
213- request is a POST to the `v1/statement` query endpoint.
228+ request is a POST to the `v1/statement` query endpoint.
214229* `String getQueryType()`: the class name of the `Statement`, e.g. `ShowCreate`.
215230 Note that these are not mapped to the `ResourceGroup` query types. For a full
216231 list of potential query types, see the classes in
@@ -220,7 +235,7 @@ object:
220235 the Trino documentation](https://trino.io/docs/current/admin/resource-groups.html#selector-rules)
221236* `String getDefaultCatalog()`: the default catalog, if set. It may or may not
222237 be referenced in the actual SQL
223- * `String getDefaultSchema()`: the default schema, if set. It may or may not
238+ * `String getDefaultSchema()`: the default schema, if set. It may or may not
224239 be referenced in the actual SQL
225240* `Set<String> getCatalogs()`: the set of catalogs used in the query. Includes
226241 the default catalog if used by a non-fully qualified table reference
@@ -248,7 +263,7 @@ Set to `True` to make `trinoQueryProperties` and `trinoRequestUser` available.
248263`maxBodySize` :
249264
250265By default, the max body size is 1,000,000 characters. This can be modified by
251- configuring `maxBodySize`. If the request body is greater or equal to this
266+ configuring `maxBodySize`. If the request body is greater or equal to this
252267limit, Trino Gateway does not process the query. A buffer of length
253268` maxBodySize` is allocated per query. Reduce this value if you observe
254269excessive garbage collection at runtime. `maxBodySize` cannot be set to values
@@ -265,8 +280,8 @@ configuration.
265280`tokenUserField` :
266281
267282When extracting the user from a JWT token, this field is used as the username.
268- By default, the `email` claim is used.
269-
283+ By default, the `email` claim is used.
284+
270285`oauthTokenInfoUrl` :
271286
272287If configured, Trino Gateway attempts to retrieve the user info by exchanging
@@ -275,7 +290,7 @@ minutes to avoid triggering rate limits.
275290
276291# ## Execution of rules
277292
278- All rules whose conditions are satisfied fire. For example, in the "airflow"
293+ All rules whose conditions are satisfied fire. For example, in the "airflow"
279294and "airflow special" example rules from the following rule priority section, a
280295query with source `airflow` and label `special` satisfies both rules. The
281296` routingGroup` is set to `etl` and then to `etl-special` because of the order in
0 commit comments