Skip to content

Commit 453d5a0

Browse files
AbhiPrasadonurtemizkan
authored andcommitted
Merge pull request #16109 from getsentry/softwarebyze/develop
chore: Improve docstrings for options and add defaults
1 parent a1c5a7a commit 453d5a0

File tree

1 file changed

+97
-26
lines changed

1 file changed

+97
-26
lines changed

packages/core/src/types-hoist/options.ts

+97-26
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,79 @@ import type { BaseTransportOptions, Transport } from './transport';
1212

1313
export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOptions> {
1414
/**
15-
* Enable debug functionality in the SDK itself
15+
* Enable debug functionality in the SDK itself. If `debug` is set to `true` the SDK will attempt
16+
* to print out useful debugging information about what the SDK is doing.
17+
*
18+
* @default false
1619
*/
1720
debug?: boolean;
1821

1922
/**
20-
* Specifies whether this SDK should send events to Sentry.
21-
* Defaults to true.
23+
* Specifies whether this SDK should send events to Sentry. Setting this to `enabled: false`
24+
* doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely,
25+
* depending on environment, call `Sentry.init conditionally.
26+
*
27+
* @default true
2228
*/
2329
enabled?: boolean;
2430

25-
/** Attaches stacktraces to pure capture message / log integrations */
31+
/**
32+
* When enabled, stack traces are automatically attached to all events captured with `Sentry.captureMessage`.
33+
*
34+
* Grouping in Sentry is different for events with stack traces and without. As a result, you will get
35+
* new groups as you enable or disable this flag for certain events.
36+
*
37+
* @default false
38+
*/
2639
attachStacktrace?: boolean;
2740

2841
/**
29-
* Send SDK Client Reports. When calling `Sentry.init()`, this option defaults to `true`.
42+
* Send SDK Client Reports, which are used to emit outcomes about events that the SDK dropped
43+
* or failed to capture.
44+
*
45+
* @default true
3046
*/
3147
sendClientReports?: boolean;
3248

3349
/**
34-
* The Dsn used to connect to Sentry and identify the project. If omitted, the
35-
* SDK will not send any data to Sentry.
50+
* The DSN tells the SDK where to send the events. If this is not set, the SDK will not send any events to Sentry.
51+
*
52+
* @default undefined
3653
*/
3754
dsn?: string;
3855

3956
/**
40-
* The release identifier used when uploading respective source maps. Specify
41-
* this value to allow Sentry to resolve the correct source maps when
42-
* processing events.
57+
* Sets the release. Release names are strings, but some formats are detected by Sentry and might be
58+
* rendered differently. Learn more about how to send release data so Sentry can tell you about
59+
* regressions between releases and identify the potential source in the
60+
* [releases documentation](https://docs.sentry.io/product/releases/)
61+
*
62+
* @default undefined
4363
*/
4464
release?: string;
4565

46-
/** The current environment of your application (e.g. "production"). */
66+
/**
67+
* The current environment of your application (e.g. "production").
68+
*
69+
* Environments are case-sensitive. The environment name can't contain newlines, spaces or forward slashes,
70+
* can't be the string "None", or exceed 64 characters. You can't delete environments, but you can hide them.
71+
*
72+
* @default "production"
73+
*/
4774
environment?: string;
4875

49-
/** Sets the distribution for all events */
76+
/**
77+
* Sets the distribution of the application. Distributions are used to disambiguate build or
78+
* deployment variants of the same release of an application.
79+
*
80+
* @default undefined
81+
*/
5082
dist?: string;
5183

5284
/**
5385
* List of integrations that should be installed after SDK was initialized.
86+
*
87+
* @default []
5488
*/
5589
integrations: Integration[];
5690

@@ -61,8 +95,7 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
6195
transport: (transportOptions: TO) => Transport;
6296

6397
/**
64-
* A stack parser implementation
65-
* By default, a stack parser is supplied for all supported platforms
98+
* A stack parser implementation. By default, a stack parser is supplied for all supported platforms.
6699
*/
67100
stackParser: StackParser;
68101

@@ -75,10 +108,12 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
75108
* Sample rate to determine trace sampling.
76109
*
77110
* 0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send
78-
* all traces)
111+
* all traces).
79112
*
80113
* Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
81-
* ignored.
114+
* ignored. Set this and `tracesSampler` to `undefined` to disable tracing.
115+
*
116+
* @default undefined
82117
*/
83118
tracesSampleRate?: number;
84119

@@ -97,24 +132,34 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
97132

98133
/**
99134
* Initial data to populate scope.
135+
*
136+
* @default undefined
100137
*/
101138
initialScope?: CaptureContext;
102139

103140
/**
104-
* The maximum number of breadcrumbs sent with events. Defaults to 100.
141+
* The maximum number of breadcrumbs sent with events.
105142
* Sentry has a maximum payload size of 1MB and any events exceeding that payload size will be dropped.
143+
*
144+
* @default 100
106145
*/
107146
maxBreadcrumbs?: number;
108147

109148
/**
110-
* A global sample rate to apply to all events.
149+
* A global sample rate to apply to all error events.
111150
*
112151
* 0.0 = 0% chance of a given event being sent (send no events) 1.0 = 100% chance of a given event being sent (send
113152
* all events)
153+
*
154+
* @default 1.0
114155
*/
115156
sampleRate?: number;
116157

117-
/** Maximum number of chars a single value can have before it will be truncated. */
158+
/**
159+
* Maximum number of chars a single value can have before it will be truncated.
160+
*
161+
* @default 250
162+
*/
118163
maxValueLength?: number;
119164

120165
/**
@@ -124,7 +169,8 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
124169
* - `user`
125170
* - `contexts`
126171
* - `extra`
127-
* Defaults to `3`. Set to `0` to disable.
172+
*
173+
* @default 3
128174
*/
129175
normalizeDepth?: number;
130176

@@ -135,26 +181,39 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
135181
* - `user`
136182
* - `contexts`
137183
* - `extra`
138-
* Defaults to `1000`
184+
*
185+
* @default 1000
139186
*/
140187
normalizeMaxBreadth?: number;
141188

142189
/**
143190
* A pattern for error messages which should not be sent to Sentry.
144191
* By default, all errors will be sent.
192+
*
193+
* Behavior of the `ignoreErrors` option is controlled by the `Sentry.eventFiltersIntegration` integration. If the
194+
* event filters integration is not installed, the `ignoreErrors` option will not have any effect.
195+
*
196+
* @default []
145197
*/
146198
ignoreErrors?: Array<string | RegExp>;
147199

148200
/**
149201
* A pattern for transaction names which should not be sent to Sentry.
150202
* By default, all transactions will be sent.
203+
*
204+
* Behavior of the `ignoreTransactions` option is controlled by the `Sentry.eventFiltersIntegration` integration.
205+
* If the event filters integration is not installed, the `ignoreTransactions` option will not have any effect.
206+
*
207+
* @default []
151208
*/
152209
ignoreTransactions?: Array<string | RegExp>;
153210

154211
/**
155212
* A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint
156213
* that accepts Sentry envelopes for forwarding. This can be used to force data
157214
* through a custom server independent of the type of data.
215+
*
216+
* @default undefined
158217
*/
159218
tunnel?: string;
160219

@@ -163,7 +222,7 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
163222
* Note that this only applies to data that the SDK is sending by default
164223
* but not data that was explicitly set (e.g. by calling `Sentry.setUser()`).
165224
*
166-
* Defaults to `false`.
225+
* @default false
167226
*
168227
* NOTE: This option currently controls only a few data points in a selected
169228
* set of SDKs. The goal for this option is to eventually control all sensitive
@@ -176,6 +235,8 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
176235
/**
177236
* Set of metadata about the SDK that can be internally used to enhance envelopes and events,
178237
* and provide additional data about every request.
238+
*
239+
* @internal This option is not part of the public API and is subject to change at any time.
179240
*/
180241
_metadata?: SdkMetadata;
181242

@@ -186,7 +247,9 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
186247
// eslint-disable-next-line @typescript-eslint/no-explicit-any
187248
[key: string]: any;
188249
/**
189-
* If logs support should be enabled. Defaults to false.
250+
* If logs support should be enabled.
251+
*
252+
* @default false
190253
*/
191254
enableLogs?: boolean;
192255
/**
@@ -196,6 +259,8 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
196259
* Note that you must return a valid log from this callback. If you do not wish to modify the log, simply return
197260
* it at the end. Returning `null` will cause the log to be dropped.
198261
*
262+
* @default undefined
263+
*
199264
* @param log The log generated by the SDK.
200265
* @returns A new log that will be sent | null.
201266
*/
@@ -207,7 +272,10 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
207272
* This is the opposite of {@link Options.denyUrls}.
208273
* By default, all errors will be sent.
209274
*
210-
* Requires the use of the `InboundFilters` integration.
275+
* Behavior of the `allowUrls` option is controlled by the `Sentry.eventFiltersIntegration` integration.
276+
* If the event filters integration is not installed, the `allowUrls` option will not have any effect.
277+
*
278+
* @default []
211279
*/
212280
allowUrls?: Array<string | RegExp>;
213281

@@ -216,7 +284,10 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
216284
* To allow certain errors instead, use {@link Options.allowUrls}.
217285
* By default, all errors will be sent.
218286
*
219-
* Requires the use of the `InboundFilters` integration.
287+
* Behavior of the `denyUrls` option is controlled by the `Sentry.eventFiltersIntegration` integration.
288+
* If the event filters integration is not installed, the `denyUrls` option will not have any effect.
289+
*
290+
* @default []
220291
*/
221292
denyUrls?: Array<string | RegExp>;
222293

@@ -253,7 +324,7 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
253324
* Function to compute tracing sample rate dynamically and filter unwanted traces.
254325
*
255326
* Tracing is enabled if either this or `tracesSampleRate` is defined. If both are defined, `tracesSampleRate` is
256-
* ignored.
327+
* ignored. Set this and `tracesSampleRate` to `undefined` to disable tracing.
257328
*
258329
* Will automatically be passed a context object of default and optional custom data.
259330
*

0 commit comments

Comments
 (0)