Skip to content

feat: use Hive Router for public GraphQL API, along side Hive Gateway#7689

Open
dotansimha wants to merge 3 commits intomainfrom
router
Open

feat: use Hive Router for public GraphQL API, along side Hive Gateway#7689
dotansimha wants to merge 3 commits intomainfrom
router

Conversation

@dotansimha
Copy link
Member

Hive Router now supports everything we do in Hive Gateway today. Including:

  • Use public API using contract from Hive CDN
  • Export Hive Traces
  • Export internal OTEL trace
  • Security plugins / operation complexity?

In addition, this PR extends the deployment code with a new option for weighted deployments that can split the traffic across different pods.

  • Add deployment for Hive Router 0.0.39
  • Add Hive Router config file mount
  • Extend deployment code with the ability to run multiple services and split traffic
  • Configure public api to use 50/50 traffic between Hive Router and Hive Gateway

Testing:

  • test locally
  • test on dev/staging

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dotansimha, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the public GraphQL API infrastructure by integrating the Hive Router alongside the existing Hive Gateway. The primary goal is to enable advanced traffic management capabilities, allowing for a gradual rollout or A/B testing of new services. This change introduces the necessary deployment configurations and proxy logic to facilitate weighted traffic splitting, enhancing the system's flexibility and resilience.

Highlights

  • Hive Router Integration: Introduced Hive Router (v0.0.39) to handle public GraphQL API traffic, leveraging its capabilities for contract consumption from Hive CDN and exporting traces.
  • Weighted Traffic Splitting: Implemented a new deployment mechanism that allows for weighted traffic distribution between multiple services, specifically configuring a 50/50 split between the existing Hive Gateway and the new Hive Router for the public GraphQL API.
  • Deployment Code Extension: Extended the deployment infrastructure to support the new Hive Router service, including its configuration, environment variables, and integration into the overall proxy setup.
Changelog
  • deployment/config/public-graphql-api-gateway/gateway.config.ts
    • Renamed the configuration file and its directory to deployment/config/public-graphql-api/gateway.config.ts.
  • deployment/config/public-graphql-api/router.config.yaml
    • Added a new YAML configuration file for the Hive Router, defining subgraph URL overrides and telemetry settings for Hive and OpenTelemetry.
  • deployment/index.ts
    • Imported the deployPublicGraphQLAPIRouter function.
    • Instantiated the publicGraphQLAPIRouter deployment.
    • Passed the publicGraphQLAPIRouter output to the deployProxy function.
  • deployment/services/proxy.ts
    • Imported the PublicGraphQLAPIRouter type.
    • Added publicGraphQLAPIRouter as an argument to the deployProxy function.
    • Removed the old single service registration for public-graphql-api.
    • Modified the public-graphql-api service registration to use weighted traffic splitting (50/50) between publicGraphQLAPIGateway and publicGraphQLAPIRouter.
  • deployment/services/public-graphql-api-gateway.ts
    • Adjusted the gatewayConfigDirectory path to a more general public-graphql-api directory.
  • deployment/services/public-graphql-api-router.ts
    • Added a new service deployment for the Hive Router.
    • Configured the router with environment variables, secrets, and volume mounts for its configuration file.
    • Set up readiness, liveness, and startup probes for the router service.
  • deployment/utils/reverse-proxy.ts
    • Introduced SingleUpstream and WeightBasedUpstream types.
    • Added an isWeightBasedUpstream type guard function.
    • Updated the service property in routes to accept either a single service or an array of weighted services.
    • Modified the services array generation logic to correctly handle weighted upstreams for Contour's HTTPProxy.
Activity
  • No specific activity (comments, reviews, or progress updates) was provided in the context for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-hive/yoga 0.47.3-alpha-20260212133922-f6daaf12c5dca1e7c5e6b222a55325f646f9bab2 npm ↗︎ unpkg ↗︎
hive 9.4.0-alpha-20260212133922-f6daaf12c5dca1e7c5e6b222a55325f646f9bab2 npm ↗︎ unpkg ↗︎

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the Hive Router to handle traffic for the public GraphQL API, splitting the load with the existing Hive Gateway. The changes to the proxy configuration to enable weighted traffic splitting are well-implemented. My main feedback is to consider a more conservative traffic split for the initial rollout to mitigate potential risks, as detailed in the specific comment.

Comment on lines +128 to +129
{ upstream: publicGraphQLAPIGateway.service, weight: 50 },
{ upstream: publicGraphQLAPIRouter.service, weight: 50 },
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Starting with a 50/50 traffic split for a new service is quite aggressive, especially as testing on dev/staging is not yet complete. It would be safer to start with a much smaller percentage for the new Hive Router, for example 5% or 10%, and then gradually increase it. This canary release approach would minimize the potential impact if any issues arise with the new router.

Suggested change
{ upstream: publicGraphQLAPIGateway.service, weight: 50 },
{ upstream: publicGraphQLAPIRouter.service, weight: 50 },
{ upstream: publicGraphQLAPIGateway.service, weight: 95 },
{ upstream: publicGraphQLAPIRouter.service, weight: 5 },

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

💻 Website Preview

The latest changes are available as preview in: https://pr-7689.hive-landing-page.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tag: f6daaf12c5dca1e7c5e6b222a55325f646f9bab2

@dotansimha
Copy link
Member Author

@n1ru4l thoughts on what security plugins should we enable? https://the-guild.dev/graphql/hive/docs/router/security/operation-complexity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant