File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,12 @@ if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
3131 } ) ;
3232 } ;
3333
34- const logRecordProcessor = new BatchLogRecordProcessor ( logExporter ) ;
34+ // Configure batch processor with shorter intervals for testing
35+ const logRecordProcessor = new BatchLogRecordProcessor ( logExporter , {
36+ maxExportBatchSize : 30 , // Export when we have 30 logs
37+ maxQueueSize : 100 ,
38+ scheduledDelayMillis : 5000 , // Export every 5 seconds (default is 30s)
39+ } ) ;
3540
3641 const loggerProvider = new LoggerProvider ( {
3742 resource,
@@ -41,4 +46,14 @@ if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
4146 logs . setGlobalLoggerProvider ( loggerProvider ) ;
4247
4348 console . log ( "✅ OpenTelemetry logs configured" ) ;
49+
50+ // Test: emit a log immediately to verify OTLP connection
51+ const testLogger = loggerProvider . getLogger ( "test-logger" ) ;
52+ testLogger . emit ( {
53+ severityNumber : 9 , // INFO
54+ severityText : "INFO" ,
55+ body : "🧪 Test log - OTLP connection verification" ,
56+ attributes : { test : true } ,
57+ } ) ;
58+ console . log ( "🧪 Test log emitted - should export in ~5 seconds" ) ;
4459}
You can’t perform that action at this time.
0 commit comments