Skip to content

Commit 01c8b4a

Browse files
committed
add tracer configuration
1 parent 7cb4701 commit 01c8b4a

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

packages/web/docs/src/content/gateway/monitoring-tracing.mdx

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,6 @@ import { defineConfig } from '@graphql-hive/gateway'
11401140

11411141
export const gatewayConfig = defineConfig({
11421142
openTelemetry: {
1143-
...ctx,
11441143
// Use the default DiagLogger, which outputs logs directly to stdout
11451144
configureDiagLogger: false
11461145
}
@@ -1190,7 +1189,6 @@ import { defineConfig } from '@graphql-hive/gateway'
11901189

11911190
export const gatewayConfig = defineConfig({
11921191
openTelemetry: {
1193-
...ctx,
11941192
// Disable the auto-flush on shutdown
11951193
flushOnDispose: false,
11961194
// or call a custom method
@@ -1225,6 +1223,54 @@ export const gateway = createGatewayRuntime({
12251223

12261224
</Tabs>
12271225

1226+
1227+
#### Tracer
1228+
1229+
By default, Hive Gateway will create a tracer named `gateway`. You can provide your own tracer if needed.
1230+
1231+
<Tabs items={[<div>Hive Gateway <code>opentelemetrySetup()</code> (recommended)</div>, <div>OpenTelemetry <code>NodeSDK</code></div>]}>
1232+
1233+
<Tabs.Tab>
1234+
1235+
```ts filename="gateway.config.ts"
1236+
import './telemetry.ts'
1237+
import { defineConfig } from '@graphql-hive/gateway'
1238+
import { trace } from '@opentelemetry/api'
1239+
1240+
export const gatewayConfig = defineConfig({
1241+
openTelemetry: {
1242+
traces: {
1243+
tracer: trace.getTracer('my-custom-tracer')
1244+
}
1245+
}
1246+
})
1247+
```
1248+
1249+
</Tabs.Tab>
1250+
1251+
<Tabs.Tab>
1252+
1253+
```ts filename="gateway.config.ts"
1254+
import './telemetry.ts'
1255+
import { createGatewayRuntime } from '@graphql-hive/gateway-runtime'
1256+
import { useOpenTelemetry } from '@graphql-mesh/plugin-opentelemetry'
1257+
1258+
export const gateway = createGatewayRuntime({
1259+
plugins: ctx => [
1260+
useOpenTelemetry({
1261+
...ctx,
1262+
traces: {
1263+
tracer: trace.getTracer('my-custom-tracer')
1264+
}
1265+
})
1266+
]
1267+
})
1268+
```
1269+
1270+
</Tabs.Tab>
1271+
1272+
</Tabs>
1273+
12281274
### Reported Spans
12291275

12301276
The plugin exports the following OpenTelemetry Spans:

0 commit comments

Comments
 (0)