@onebun/core 0.2.15 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onebun/core",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "Core package for OneBun framework - decorators, DI, modules, controllers",
5
5
  "license": "LGPL-3.0",
6
6
  "author": "RemRyahirev",
@@ -45,11 +45,11 @@
45
45
  "dependencies": {
46
46
  "effect": "^3.13.10",
47
47
  "arktype": "^2.0.0",
48
- "@onebun/logger": "^0.2.1",
48
+ "@onebun/logger": "^0.2.2",
49
49
  "@onebun/envs": "^0.2.2",
50
50
  "@onebun/metrics": "^0.2.2",
51
51
  "@onebun/requests": "^0.2.1",
52
- "@onebun/trace": "^0.2.1"
52
+ "@onebun/trace": "^0.2.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "bun-types": "^1.3.8",
@@ -20,6 +20,7 @@ import {
20
20
  LoggerService,
21
21
  makeLogger,
22
22
  makeLoggerFromOptions,
23
+ shutdownLogger,
23
24
  type SyncLogger,
24
25
  } from '@onebun/logger';
25
26
  import {
@@ -295,9 +296,26 @@ export class OneBunApplication<QA extends import('../queue/types').QueueAdapterC
295
296
 
296
297
  // Use provided logger layer, or create from options, or use default
297
298
  // Priority: loggerLayer > loggerOptions > env variables > NODE_ENV defaults
299
+ // Auto-populate OTLP resource attributes from tracing config if available
300
+ const loggerOptions = this.options.loggerOptions
301
+ ? {
302
+ ...this.options.loggerOptions,
303
+ otlpResourceAttributes: this.options.loggerOptions.otlpResourceAttributes ?? (
304
+ this.options.loggerOptions.otlpEndpoint && this.options.tracing
305
+ ? {
306
+ // eslint-disable-next-line @typescript-eslint/naming-convention
307
+ 'service.name': this.options.tracing.serviceName ?? 'onebun-service',
308
+ // eslint-disable-next-line @typescript-eslint/naming-convention
309
+ 'service.version': this.options.tracing.serviceVersion ?? '1.0.0',
310
+ }
311
+ : undefined
312
+ ),
313
+ }
314
+ : undefined;
315
+
298
316
  this.loggerLayer = this.options.loggerLayer
299
- ?? (this.options.loggerOptions
300
- ? makeLoggerFromOptions(this.options.loggerOptions)
317
+ ?? (loggerOptions
318
+ ? makeLoggerFromOptions(loggerOptions)
301
319
  : makeLogger());
302
320
 
303
321
  // Initialize logger with application class name as context
@@ -1744,6 +1762,12 @@ export class OneBunApplication<QA extends import('../queue/types').QueueAdapterC
1744
1762
  this.logger.debug('HTTP server stopped');
1745
1763
  }
1746
1764
 
1765
+ // Shutdown trace service — flush pending spans before module destroy
1766
+ if (this.traceService?.shutdown) {
1767
+ this.logger.debug('Shutting down trace service');
1768
+ await this.traceService.shutdown();
1769
+ }
1770
+
1747
1771
  // Call onModuleDestroy lifecycle hook
1748
1772
  if (this.rootModule?.callOnModuleDestroy) {
1749
1773
  this.logger.debug('Calling onModuleDestroy hooks');
@@ -1763,6 +1787,9 @@ export class OneBunApplication<QA extends import('../queue/types').QueueAdapterC
1763
1787
  }
1764
1788
 
1765
1789
  this.logger.info('OneBun application stopped');
1790
+
1791
+ // Shutdown logger transport LAST — flush OTLP log batches after final log message
1792
+ await shutdownLogger();
1766
1793
  }
1767
1794
 
1768
1795
  /**