|
| 1 | +--- |
| 2 | +title: 'Hive Gateway v2: Next-Generation GraphQL Federation Features' |
| 3 | +tags: [platform, graphql, graphql-federation, graphql-hive, hive-gateway] |
| 4 | +authors: enisdenjo |
| 5 | +date: 2025-09-04 |
| 6 | +description: |
| 7 | + "Discover Hive Gateway v2's next-generation features: enhanced OpenTelemetry integration, advanced |
| 8 | + structured logging, distributed subscription architecture, and intelligent request deduplication. |
| 9 | + Built on v1's proven foundation with production feedback-driven improvements." |
| 10 | +featured: true |
| 11 | +--- |
| 12 | + |
| 13 | +We're excited to announce Hive Gateway v2 – a major release that builds on v1's proven production |
| 14 | +success with advanced observability, performance optimizations, and distributed systems |
| 15 | +capabilities. Based on extensive feedback from companies running Hive Gateway v1 in production, v2 |
| 16 | +delivers the next generation of features that take GraphQL federation to the next level. |
| 17 | + |
| 18 | +## What's New: The Big Four |
| 19 | + |
| 20 | +### 🔍 Enhanced OpenTelemetry Integration |
| 21 | + |
| 22 | +Based on feedback from production teams using v1, we've completely rebuilt our OpenTelemetry |
| 23 | +integration from the ground up, following official OpenTelemetry best practices and conventions. |
| 24 | + |
| 25 | +- **Proper span hierarchy**: Every GraphQL operation now gets its own span, correctly nested under |
| 26 | + HTTP request spans |
| 27 | +- **Complete trace coverage**: From initial request to subgraph execution, every step is traced |
| 28 | +- **Flexible SDK setup**: Bring your own OpenTelemetry SDK version – we don't force dependencies |
| 29 | +- **Rich contextual data**: Spans include GraphQL context, HTTP request details, and upstream |
| 30 | + execution information |
| 31 | +- **CLI-first configuration**: Set up tracing with a single `--opentelemetry` flag |
| 32 | + |
| 33 | +The new integration uses the standard OpenTelemetry Context API, meaning your custom spans will |
| 34 | +automatically parent correctly without extra configuration. This addresses one of the most requested |
| 35 | +improvements from v1 production users. |
| 36 | + |
| 37 | +**[New OpenTelemetry integration in Hive Gateway v2 →](/blog/opentelemetry-gateway-v2)** |
| 38 | + |
| 39 | +**[Migration guide for OpenTelemetry →](/docs/migration-guides/gateway-v1-v2#opentelemetry)** |
| 40 | + |
| 41 | +### 📊 Advanced Structured Logging |
| 42 | + |
| 43 | +Production teams running v1 deserved better request tracing capabilities across concurrent |
| 44 | +operations. v2 introduces a completely new logging architecture that solves this observability |
| 45 | +challenge. |
| 46 | + |
| 47 | +**The game-changer: Child loggers with inherited metadata** |
| 48 | + |
| 49 | +Every log entry now carries contextual metadata like request IDs, subgraph names, and execution |
| 50 | +phases. This means you can filter your logs by a specific request and see its entire journey through |
| 51 | +your gateway: |
| 52 | + |
| 53 | +``` |
| 54 | +2025-04-10T14:00:00.000Z INF Executing... |
| 55 | + requestId: "0b1dce69-5eb0-4d7b-97d8-1337535a620e" |
| 56 | +2025-04-10T14:00:00.000Z INF Creating delegation plan... |
| 57 | + requestId: "0b1dce69-5eb0-4d7b-97d8-1337535a620e" |
| 58 | + subgraph: "accounts" |
| 59 | +2025-04-10T14:00:00.000Z INF Executing on subgraph... |
| 60 | + requestId: "0b1dce69-5eb0-4d7b-97d8-1337535a620e" |
| 61 | + subgraph: "accounts" |
| 62 | +``` |
| 63 | + |
| 64 | +**Dynamic log levels in production** |
| 65 | + |
| 66 | +Here's where it gets really powerful: you can now change log levels at runtime without restarting |
| 67 | +your gateway. Facing a production issue? Switch to debug mode instantly, investigate, then switch |
| 68 | +back to info level – all without downtime. |
| 69 | + |
| 70 | +The new logger also supports: |
| 71 | + |
| 72 | +- **Extensible writers**: Plug in Pino, Winston, or your custom logging solution |
| 73 | +- **Structured JSON output**: Perfect for log aggregation systems |
| 74 | +- **Performance optimizations**: Lazy evaluation and efficient metadata propagation |
| 75 | + |
| 76 | +**[Migration guide for logging →](/docs/migration-guides/gateway-v1-v2#hive-logger)** |
| 77 | + |
| 78 | +### 🚀 Distributed Subscription Architecture |
| 79 | + |
| 80 | +Teams running federated GraphQL at scale identified subscription distribution as a key area for |
| 81 | +enhancement. v2 introduces a completely rewritten PubSub interface that enables true distributed |
| 82 | +subscriptions across your federation. |
| 83 | + |
| 84 | +**Why teams requested this enhancement:** |
| 85 | + |
| 86 | +The previous interface was purely synchronous and in-memory only. This meant: |
| 87 | + |
| 88 | +- No error handling for external pub/sub systems |
| 89 | +- No support for distributed subscription systems |
| 90 | +- Limited to single-instance deployments |
| 91 | + |
| 92 | +**What's possible now:** |
| 93 | + |
| 94 | +The new async PubSub interface supports: |
| 95 | + |
| 96 | +- **Asynchronous operations**: Await publish confirmation from external systems |
| 97 | +- **Proper error handling**: Handle network failures and service unavailability gracefully |
| 98 | +- **Distributed subscriptions**: Connect multiple gateway instances through external message brokers |
| 99 | +- **Resource management**: Follows modern patterns like |
| 100 | + [Explicit Resource Management](https://v8.dev/features/explicit-resource-management) |
| 101 | + |
| 102 | +This unlocks |
| 103 | +[Event-Driven Federated Subscriptions (EDFS)](https://wundergraph.com/blog/distributed_graphql_subscriptions_with_nats_and_event_driven_architecture) |
| 104 | +– a pattern where your subscriptions can scale horizontally and survive individual service failures. |
| 105 | + |
| 106 | +**Built-in adapters for production**: Hive Gateway v2 ships with ready-to-use adapters for Redis and |
| 107 | +NATS, making EDFS integration straightforward. No need to build custom pub/sub implementations – |
| 108 | +just configure your preferred message broker and you're ready for distributed subscriptions. |
| 109 | + |
| 110 | +**[Migration guide for PubSub →](/docs/migration-guides/gateway-v1-v2#new-hive-pubsub-interface)** |
| 111 | + |
| 112 | +### ⚡ Intelligent Request Deduplication |
| 113 | + |
| 114 | +Here's a performance optimization that emerged from analyzing real-world usage patterns: intelligent |
| 115 | +request deduplication at the subgraph level. |
| 116 | + |
| 117 | +**The opportunity**: In busy federated systems, identical requests to subgraphs often happen |
| 118 | +simultaneously. Production teams noticed that gateways might receive multiple queries that require |
| 119 | +the same data from the same subgraph at nearly the same time. Each request traditionally triggers |
| 120 | +its own subgraph call, creating optimization opportunities. |
| 121 | + |
| 122 | +**The solution**: v2 automatically detects when multiple in-flight requests target the same subgraph |
| 123 | +with identical parameters (request body + headers + all request parameters). Instead of making |
| 124 | +duplicate network calls, the gateway waits for the first request to complete and shares the result |
| 125 | +with all waiting requests. |
| 126 | + |
| 127 | +**Real-world impact**: |
| 128 | + |
| 129 | +- **Reduced network calls**: Eliminate redundant requests to your subgraphs |
| 130 | +- **Lower latency**: Subsequent requests don't wait for their own network round-trip |
| 131 | +- **Better resource utilization**: Your subgraphs handle fewer duplicate operations |
| 132 | +- **Cost savings**: Fewer compute cycles and network transfers across your federation |
| 133 | + |
| 134 | +This optimization is completely transparent – your application logic doesn't change, but your |
| 135 | +performance metrics will thank you. It's especially powerful during traffic spikes when identical |
| 136 | +queries are most likely to overlap. |
| 137 | + |
| 138 | +## Enhanced Production Defaults |
| 139 | + |
| 140 | +### Configurable Worker Forking |
| 141 | + |
| 142 | +v1's automatic worker forking was designed to help, but production feedback showed it often impacted |
| 143 | +performance. Here's why: if you have a 12-core processor, spawning 12 Node.js workers isn't optimal |
| 144 | +– it's usually slower due to: |
| 145 | + |
| 146 | +- Context switching overhead between processes |
| 147 | +- Inter-process communication (IPC) latency |
| 148 | +- Memory consumption from process duplication |
| 149 | +- Garbage collection pauses across multiple processes |
| 150 | +- Load balancer coordination overhead |
| 151 | + |
| 152 | +Real-world example: on a 24-core CPU, the optimal fork count is often just 3 workers, not 24. v2 |
| 153 | +gives advanced users full control over this decision based on their specific workload and |
| 154 | +infrastructure. |
| 155 | + |
| 156 | +**[Read more about the configurable forking →](/docs/migration-guides/gateway-v1-v2#disabled-automatic-forking)** |
| 157 | + |
| 158 | +### Secure-by-Default Multipart Handling |
| 159 | + |
| 160 | +Based on security findings in the ecosystem, |
| 161 | +[like this vulnerability](https://medium.com/@lclrobert2020_38117/exposed-the-critical-multer-bug-that-can-bring-your-server-down-robert-li-dev-space-86df9b020257), |
| 162 | +and GraphQL conventions, file uploads through GraphQL multipart requests are now disabled by |
| 163 | +default. While convenient, they can pose security considerations and go against GraphQL's design |
| 164 | +principles. If you need file uploads, you can explicitly enable them – but we recommend dedicated |
| 165 | +file upload services instead. |
| 166 | + |
| 167 | +**[Read more about the multipart requests default →](/docs/migration-guides/gateway-v1-v2#multipart-requests-are-disabled-by-default)** |
| 168 | + |
| 169 | +## Modern Foundation: Node.js v20+ |
| 170 | + |
| 171 | +v2 requires Node.js v20 or higher, ensuring you get the latest security patches, performance |
| 172 | +improvements, and language features. Node.js v18 reached end-of-life on April 30, 2025, and |
| 173 | +continuing support would mean missing critical security updates. |
| 174 | + |
| 175 | +All our dependencies have been updated to their latest versions, giving you access to the newest |
| 176 | +features and bug fixes across the entire GraphQL ecosystem. |
| 177 | + |
| 178 | +## Start Building with Hive Gateway v2 |
| 179 | + |
| 180 | +Hive Gateway v2 represents the next major evolution of GraphQL federation, building on v1's proven |
| 181 | +foundation with advanced capabilities requested by production teams. Whether you're already running |
| 182 | +v1 successfully or evaluating GraphQL gateway solutions, v2 delivers the enhanced observability, |
| 183 | +performance, and reliability features that scale with your growing federation. |
| 184 | + |
| 185 | +**For existing v1 users**: We've created a comprehensive migration guide that walks through each |
| 186 | +breaking change with clear before/after examples. |
| 187 | + |
| 188 | +**For teams evaluating GraphQL gateways**: v2 is the perfect foundation for your federated |
| 189 | +architecture, with advanced observability and performance optimizations built-in from day one. |
| 190 | + |
| 191 | +Hive Gateway v2 is available now. Check out our [documentation](/docs/gateway) to get started or the |
| 192 | +[complete migration guide](/docs/migration-guides/gateway-v1-v2) to get going with the new release! |
0 commit comments