(options: NodeClientOptions)
| 30 | private _logOnExitFlushListener: (() => void) | undefined; |
| 31 | |
| 32 | public constructor(options: NodeClientOptions) { |
| 33 | const serverName = |
| 34 | options.includeServerName === false |
| 35 | ? undefined |
| 36 | : options.serverName || global.process.env.SENTRY_NAME || os.hostname(); |
| 37 | |
| 38 | const clientOptions: ServerRuntimeClientOptions = { |
| 39 | ...options, |
| 40 | platform: 'node', |
| 41 | // Use provided runtime or default to 'node' with current process version |
| 42 | runtime: options.runtime || { name: 'node', version: global.process.version }, |
| 43 | serverName, |
| 44 | }; |
| 45 | |
| 46 | if (options.openTelemetryInstrumentations) { |
| 47 | registerInstrumentations({ |
| 48 | instrumentations: options.openTelemetryInstrumentations, |
| 49 | }); |
| 50 | } |
| 51 | |
| 52 | applySdkMetadata(clientOptions, 'node'); |
| 53 | |
| 54 | debug.log(`Initializing Sentry: process: ${process.pid}, thread: ${isMainThread ? 'main' : `worker-${threadId}`}.`); |
| 55 | |
| 56 | super(clientOptions); |
| 57 | |
| 58 | if (this.getOptions().enableLogs) { |
| 59 | this._logOnExitFlushListener = () => { |
| 60 | _INTERNAL_flushLogsBuffer(this); |
| 61 | }; |
| 62 | |
| 63 | if (serverName) { |
| 64 | this.on('beforeCaptureLog', log => { |
| 65 | log.attributes = { |
| 66 | ...log.attributes, |
| 67 | 'server.address': serverName, |
| 68 | }; |
| 69 | }); |
| 70 | } |
| 71 | |
| 72 | process.on('beforeExit', this._logOnExitFlushListener); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** Get the OTEL tracer. */ |
| 77 | public get tracer(): Tracer { |
nothing calls this directly
no test coverage detected