Skip to content

Commit c16a965

Browse files
committed
typecheck
1 parent ac592d1 commit c16a965

File tree

3 files changed

+4585
-133
lines changed

3 files changed

+4585
-133
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// @ts-expect-error not a dependency
2-
import { defineConfig } from '@graphql-hive/gateway';
3-
// @ts-expect-error not a dependency
1+
import { defineConfig, Logger } from '@graphql-hive/gateway';
42
import { hiveTracingSetup } from '@graphql-hive/plugin-opentelemetry/setup';
53
import type { Context } from '@opentelemetry/api';
64
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
@@ -69,6 +67,11 @@ if (
6967
// Noop is only there to not raise an exception in case we do not hive console tracing.
7068
target: process.env['HIVE_HIVE_TARGET'] ?? 'noop',
7169
contextManager: new AsyncLocalStorageContextManager(),
70+
resource: {
71+
serviceName: 'public-graphql-api-gateway',
72+
serviceVersion: '0.0.0', // TODO: use actual version
73+
},
74+
// @ts-expect-error types are incorrect?
7275
processor: new MultiSpanProcessor([
7376
...(process.env['HIVE_HIVE_TRACE_ACCESS_TOKEN'] &&
7477
process.env['HIVE_HIVE_TRACE_ENDPOINT'] &&
@@ -103,16 +106,19 @@ const defaultQuery = `#
103106
#
104107
`;
105108

109+
const log = new Logger();
110+
106111
export const gatewayConfig = defineConfig({
112+
logging: log,
107113
transportEntries: {
108114
graphql: {
109115
location: process.env['GRAPHQL_SERVICE_ENDPOINT'],
110116
},
111117
},
112118
supergraph: {
113119
type: 'hive',
114-
endpoint: process.env['SUPERGRAPH_ENDPOINT'],
115-
key: process.env['HIVE_CDN_ACCESS_TOKEN'],
120+
endpoint: process.env['SUPERGRAPH_ENDPOINT'] || '',
121+
key: process.env['HIVE_CDN_ACCESS_TOKEN'] || '',
116122
},
117123
graphiql: {
118124
title: 'Hive Console - GraphQL API',
@@ -127,12 +133,16 @@ export const gatewayConfig = defineConfig({
127133
},
128134
},
129135
disableWebsockets: true,
130-
prometheus: true,
136+
prometheus: {
137+
log,
138+
metrics: {
139+
// use defaults
140+
},
141+
},
131142
openTelemetry:
132143
process.env['OPENTELEMETRY_COLLECTOR_ENDPOINT'] || process.env['HIVE_HIVE_TRACE_ACCESS_TOKEN']
133144
? {
134145
traces: true,
135-
serviceName: 'public-graphql-api-gateway',
136146
}
137147
: undefined,
138148
demandControl: {

deployment/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"prettier": "3.4.2"
2222
},
2323
"devDependencies": {
24+
"@graphql-hive/gateway": "^2.1.17",
2425
"@types/js-yaml": "4.0.9",
2526
"@types/mime-types": "2.1.4",
2627
"@types/node": "22.10.5",

0 commit comments

Comments
 (0)