File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/web/docs/src/content/gateway/other-features Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,32 @@ export const gateway = createGatewayRuntime({
7575
7676</Tabs >
7777
78+ ## Exposing the Query Plan
79+
80+ To view the generated query plan when using the Rust Query Planner, you can use the ` useQueryPlan `
81+ plugin from ` @graphql-hive/router-runtime ` as follows:
82+
83+ ``` ts filename="gateway.config.ts"
84+ import { defineConfig } from ' @graphql-hive/gateway'
85+ import { unifiedGraphHandler , useQueryPlan } from ' @graphql-hive/router-runtime'
86+
87+ export const gatewayConfig = defineConfig ({
88+ unifiedGraphHandler ,
89+ plugins : ({ log }) => [
90+ useQueryPlan ({
91+ // Query plan available callback
92+ onQueryPlan(queryPlan ) {
93+ log .debug ({ queryPlan }, ' Generated Query Plan' )
94+ },
95+ // Expose the query plan in the graphql result extensions
96+ expose: true ,
97+ // or expose based on request.
98+ expose : req => req .headers .get (' hive-expose-query-plan' ) === ' true'
99+ })
100+ ]
101+ })
102+ ```
103+
78104## Compared to JavaScript Query Planner
79105
80106Hive Gateway uses the [ JavaScript Query Planner] ( https://the-guild.dev/graphql/stitching ) by
You can’t perform that action at this time.
0 commit comments