client.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const os = require('os');
  3. const util = require('util');
  4. const core = require('@sentry/core');
  5. /**
  6. * The Sentry Node SDK Client.
  7. *
  8. * @see NodeClientOptions for documentation on configuration options.
  9. * @see SentryClient for usage documentation.
  10. */
  11. class NodeClient extends core.ServerRuntimeClient {
  12. /**
  13. * Creates a new Node SDK instance.
  14. * @param options Configuration options for this SDK.
  15. */
  16. constructor(options) {
  17. core.applySdkMetadata(options, 'node');
  18. // Until node supports global TextEncoder in all versions we support, we are forced to pass it from util
  19. options.transportOptions = {
  20. textEncoder: new util.TextEncoder(),
  21. ...options.transportOptions,
  22. };
  23. const clientOptions = {
  24. ...options,
  25. platform: 'node',
  26. runtime: { name: 'node', version: global.process.version },
  27. serverName: options.serverName || global.process.env.SENTRY_NAME || os.hostname(),
  28. };
  29. super(clientOptions);
  30. }
  31. }
  32. exports.NodeClient = NodeClient;
  33. //# sourceMappingURL=client.js.map