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' ;
42import { hiveTracingSetup } from '@graphql-hive/plugin-opentelemetry/setup' ;
53import type { Context } from '@opentelemetry/api' ;
64import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks' ;
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+
106111export 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 : {
0 commit comments