-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathclient.ts
40 lines (36 loc) · 1.13 KB
/
client.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { ServerRuntimeClientOptions } from '@sentry/core';
import { SDK_VERSION, ServerRuntimeClient } from '@sentry/core';
import * as os from 'os';
import type { BunClientOptions } from './types';
/**
* The Sentry Bun SDK Client.
*
* @see BunClientOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
export class BunClient extends ServerRuntimeClient<BunClientOptions> {
/**
* Creates a new Bun SDK instance.
* @param options Configuration options for this SDK.
*/
public constructor(options: BunClientOptions) {
options._metadata = options._metadata || {};
options._metadata.sdk = options._metadata.sdk || {
name: 'sentry.javascript.bun',
packages: [
{
name: 'npm:@sentry/bun',
version: SDK_VERSION,
},
],
version: SDK_VERSION,
};
const clientOptions: ServerRuntimeClientOptions = {
...options,
platform: 'bun',
runtime: { name: 'bun', version: Bun.version },
serverName: options.serverName || global.process.env.SENTRY_NAME || os.hostname(),
};
super(clientOptions);
}
}