File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { getOtelConfig } from "./otel/config" ;
2+
13export async function register ( ) {
24 if ( process . env . NEXT_RUNTIME === "nodejs" ) {
5+ const otelConfig = getOtelConfig ( ) ;
6+
37 // NOTE: Explicitly initialize the logger here.
48 const { logger } = await import ( "./utils/logger" ) ;
59 logger . info ( { message : "logger initialized" } ) ;
610
711 await import ( "./otel/lifecycle" ) . then ( ( { initializeOtel } ) =>
8- initializeOtel ( )
12+ initializeOtel ( otelConfig )
913 ) ;
1014 }
1115}
Original file line number Diff line number Diff line change @@ -5,18 +5,16 @@ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
55import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs" ;
66import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics" ;
77import { NodeSDK } from "@opentelemetry/sdk-node" ;
8- import { getOtelConfig } from "./config" ;
8+ import type { OtelConfig } from "./config" ;
99
1010let isInitialized = false ;
1111
12- export function initializeOtel ( ) {
12+ export function initializeOtel ( config : OtelConfig ) {
1313 if ( isInitialized ) {
1414 return ;
1515 }
1616
1717 try {
18- const config = getOtelConfig ( ) ;
19-
2018 if ( ! config ) {
2119 console . log (
2220 "OpenTelemetry configuration not found, skipping initialization"
You can’t perform that action at this time.
0 commit comments