@@ -136,8 +136,7 @@ We recommend to place your OpenTelemetry setup in a `telemetry.ts` file that wil
136136import in your ` gateway.config.ts ` file . This allow instrumentations to be registered (if any )
137137before any other packages are imported .
138138
139- For ease of configuration , we provide a ` openTelemetrySetup ` function from
140- ` @graphql-hive/plugin-opentelemetry/setup ` module, with sensible default and straightforward API
139+ For ease of configuration , we provide a ` openTelemetrySetup ` function , with sensible default and straightforward API
141140compatible with all runtimes .
142141
143142But this utility is not mandatory , you can use any setup relevant to your specific use case and
@@ -168,8 +167,18 @@ supports `AsyncLocalStorage` API), and a trace exporter depending on your traces
168167npm i @opentelemetry/context-async-hooks @opentelemetry/exporter-trace-otlp-http
169168```
170169
170+ Depending on your usage, you will have to import ` openTelemetrySetup ` from a different module:
171+
172+ - CLI usage: ` @graphql-hive/gateway/opentelemetry/setup `
173+ - Programmatic usage : ` @graphql-hive/plugin-opentelemetry/setup `
174+
171175``` ts filename="telemetry.ts"
176+ // For CLI usage
172177import { openTelemetrySetup } from ' @graphql-hive/gateway/opentelemetry/setup'
178+
179+ // For Programmatic usage
180+ import { openTelemetrySetup } from ' @graphql-hive/plugin-opentelemetry/setup'
181+
173182import { AsyncLocalStorageContextManager } from ' @opentelemetry/context-async-hooks'
174183import { OTLPTraceExporter } from ' @opentelemetry/exporter-trace-otlp-http'
175184
@@ -2100,9 +2109,9 @@ to get the proper context.
21002109
21012110``` ts filename="gateway.config.ts"
21022111import { defineConfig } from ' @graphql-hive/gateway'
2103- import { openTelemetrySetup } from ' @graphql-hive/plugin- opentelemetry/setup'
2112+ import { openTelemetrySetup } from ' @graphql-hive/gateway/ opentelemetry/setup'
21042113// This package re-export official @opentelemetry/api package for ease of use
2105- import { trace , hive } from ' @graphql-hive/plugin- opentelemetry/api'
2114+ import { trace , hive } from ' @graphql-hive/gateway/ opentelemetry/api'
21062115
21072116openTelemetrySetup ({
21082117 contextManager: null , // Don't register any context manager
@@ -2184,11 +2193,15 @@ environment variable on your gateway process/runtime.
21842193
21852194In addition, you can use the stdout exporter to log the traces to the console:
21862195
2187- <Tabs items = { [" CLI " , ' Programmatic Usage ' ]} >
2196+ <Tabs items = { [< div >Hive Gateway < code >openTelemetrySetup()</ code > (recommended)</ div >, < div >OpenTelemetry < code >NodeSDK</ code ></ div > ]} >
21882197
21892198<Tabs.Tab >
21902199
21912200``` ts filename="telemetry.ts"
2201+ // For CLI usage
2202+ import { openTelemetrySetup } from ' @graphql-hive/plugin-opentelemetry/setup'
2203+
2204+ // For Programmatic usage
21922205import { openTelemetrySetup } from ' @graphql-hive/plugin-opentelemetry/setup'
21932206import { AsyncLocalStorageContextManager } from ' @opentelemetry/context-async-hooks'
21942207
0 commit comments