MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / constructor

Method constructor

packages/deno/src/client.ts:28–68  ·  view source on GitHub ↗

* Creates a new Deno SDK instance. * @param options Configuration options for this SDK.

(options: DenoClientOptions)

Source from the content-addressed store, hash-verified

26 * @param options Configuration options for this SDK.
27 */
28 public constructor(options: DenoClientOptions) {
29 options._metadata = options._metadata || {};
30 options._metadata.sdk = options._metadata.sdk || {
31 name: 'sentry.javascript.deno',
32 packages: [
33 {
34 name: 'denoland:sentry',
35 version: SDK_VERSION,
36 },
37 ],
38 version: SDK_VERSION,
39 };
40
41 const serverName = options.serverName || getHostName();
42
43 const clientOptions: ServerRuntimeClientOptions = {
44 ...options,
45 platform: 'javascript',
46 runtime: { name: 'deno', version: Deno.version.deno },
47 serverName,
48 };
49
50 super(clientOptions);
51
52 if (this.getOptions().enableLogs) {
53 this._logOnExitFlushListener = () => {
54 _INTERNAL_flushLogsBuffer(this);
55 };
56
57 if (serverName) {
58 this.on('beforeCaptureLog', log => {
59 log.attributes = {
60 ...log.attributes,
61 'server.address': serverName,
62 };
63 });
64 }
65
66 globalThis.addEventListener('unload', this._logOnExitFlushListener);
67 }
68 }
69
70 /** @inheritDoc */
71 // @ts-expect-error - PromiseLike is a subset of Promise

Callers

nothing calls this directly

Calls 5

getHostNameFunction · 0.85
getOptionsMethod · 0.65
onMethod · 0.65
addEventListenerMethod · 0.65

Tested by

no test coverage detected