UNPKG

@sentry/node

Version:
50 lines (43 loc) 1.37 kB
Object.defineProperty(exports, '__esModule', { value: true }); const core = require('@sentry/core'); const os = require('os'); const util = require('util'); /** * The Sentry Node SDK Client. * * @see NodeClientOptions for documentation on configuration options. * @see SentryClient for usage documentation. */ class NodeClient extends core.ServerRuntimeClient { /** * Creates a new Node SDK instance. * @param options Configuration options for this SDK. */ constructor(options) { options._metadata = options._metadata || {}; options._metadata.sdk = options._metadata.sdk || { name: 'sentry.javascript.node', packages: [ { name: 'npm:@sentry/node', version: core.SDK_VERSION, }, ], version: core.SDK_VERSION, }; // Until node supports global TextEncoder in all versions we support, we are forced to pass it from util options.transportOptions = { textEncoder: new util.TextEncoder(), ...options.transportOptions, }; const clientOptions = { ...options, platform: 'node', runtime: { name: 'node', version: global.process.version }, serverName: options.serverName || global.process.env.SENTRY_NAME || os.hostname(), }; super(clientOptions); } } exports.NodeClient = NodeClient; //# sourceMappingURL=client.js.map