Skip to content

Commit 061ab48

Browse files
authored
feat: upgrade hive gateway public api gateway (#7049)
1 parent 8c49615 commit 061ab48

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

deployment/config/public-graphql-api-gateway/gateway.config.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
// @ts-expect-error not a dependency
2-
import { createOtlpHttpExporter, defineConfig } from '@graphql-hive/gateway';
2+
import { defineConfig } from '@graphql-hive/gateway';
3+
// @ts-expect-error not a dependency
4+
import { openTelemetrySetup } from '@graphql-hive/gateway/opentelemetry/setup';
5+
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
6+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
7+
8+
openTelemetrySetup({
9+
// Mandatory: It depends on the available API in your runtime.
10+
// We recommend AsyncLocalStorage based manager when possible.
11+
// `@opentelemetry/context-zone` is also available for other runtimes.
12+
// Pass `false` to disable context manager usage.
13+
contextManager: new AsyncLocalStorageContextManager(),
14+
15+
traces: {
16+
// Define your exporter, most of the time the OTLP HTTP one. Traces are batched by default.
17+
exporter: new OTLPTraceExporter({ url: process.env['OPENTELEMETRY_COLLECTOR_ENDPOINT']! }),
18+
// You can easily enable a console exporter for quick debug
19+
console: process.env['DEBUG_TRACES'] === '1',
20+
},
21+
});
322

423
const defaultQuery = `#
524
# Welcome to the Hive Console GraphQL API.
@@ -34,11 +53,6 @@ export const gatewayConfig = defineConfig({
3453
openTelemetry: process.env['OPENTELEMETRY_COLLECTOR_ENDPOINT']
3554
? {
3655
serviceName: 'public-graphql-api-gateway',
37-
exporters: [
38-
createOtlpHttpExporter({
39-
url: process.env['OPENTELEMETRY_COLLECTOR_ENDPOINT'],
40-
}),
41-
],
4256
}
4357
: false,
4458
demandControl: {

deployment/services/public-graphql-api-gateway.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ import { type Observability } from './observability';
1414
* Hive Gateway Docker Image Version
1515
* Bump this to update the used gateway version.
1616
*/
17-
const dockerImage = 'ghcr.io/graphql-hive/gateway:1.13.6';
17+
const dockerImage = 'ghcr.io/graphql-hive/gateway:2.1.7';
1818

1919
const gatewayConfigDirectory = path.resolve(
2020
__dirname,
2121
'..',
2222
'config',
2323
'public-graphql-api-gateway',
2424
);
25-
const gatewayConfigPath = path.join(gatewayConfigDirectory, 'gateway.config.ts');
25+
2626
// On global scope to fail early in case of a read error
27+
const gatewayConfigPath = path.join(gatewayConfigDirectory, 'gateway.config.ts');
2728
const gwConfigFile = fs.readFileSync(gatewayConfigPath, 'utf-8');
2829

2930
export function deployPublicGraphQLAPIGateway(args: {

0 commit comments

Comments
 (0)