Skip to content

Commit 740f39f

Browse files
📝 adjust Public Api and Init configuration categories (#3855)
1 parent f8f1e7d commit 740f39f

File tree

8 files changed

+175
-55
lines changed

8 files changed

+175
-55
lines changed

packages/core/src/domain/configuration/configuration.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,34 @@ export type TraceContextInjection = (typeof TraceContextInjection)[keyof typeof
5151
export interface InitConfiguration {
5252
/**
5353
* The client token for Datadog. Required for authenticating your application with Datadog.
54+
*
55+
* @category Authentication
5456
*/
5557
clientToken: string
58+
5659
/**
5760
* A callback function that can be used to modify events before they are sent to Datadog.
61+
*
62+
* @category Data Collection
5863
*/
5964
beforeSend?: GenericBeforeSendCallback | undefined
65+
6066
/**
6167
* The percentage of sessions tracked. A value between 0 and 100.
6268
*
69+
* @category Data Collection
6370
* @defaultValue 100
6471
*/
6572
sessionSampleRate?: number | undefined
73+
6674
/**
6775
* The percentage of telemetry events sent. A value between 0 and 100.
6876
*
77+
* @category Data Collection
6978
* @defaultValue 20
7079
*/
7180
telemetrySampleRate?: number | undefined
81+
7282
/**
7383
* Initialization fails silently if the RUM Browser SDK is already initialized on the page.
7484
*
@@ -81,6 +91,7 @@ export interface InitConfiguration {
8191
*
8292
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
8393
*
94+
* @category Session Persistence
8495
* @defaultValue "cookie"
8596
*/
8697
sessionPersistence?: SessionPersistence | undefined
@@ -91,6 +102,7 @@ export interface InitConfiguration {
91102
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
92103
* See [Monitor Electron Applications Using the Browser SDK](https://docs.datadoghq.com/real_user_monitoring/guide/monitor-electron-applications-using-browser-sdk) for further information.
93104
*
105+
* @category Session Persistence
94106
* @deprecated use `sessionPersistence: local-storage` where you want to use localStorage instead
95107
*/
96108
allowFallbackToLocalStorage?: boolean | undefined
@@ -101,17 +113,20 @@ export interface InitConfiguration {
101113
* @defaultValue false
102114
*/
103115
allowUntrustedEvents?: boolean | undefined
116+
104117
/**
105118
* Store global context and user context in localStorage to preserve them along the user navigation.
106119
* See [Contexts life cycle](https://docs.datadoghq.com/real_user_monitoring/browser/advanced_configuration/?tab=npm#contexts-life-cycle) for further information.
107120
*
108121
* @defaultValue false
109122
*/
110123
storeContextsAcrossPages?: boolean | undefined
124+
111125
/**
112126
* Set the initial user tracking consent state.
113127
* See [User tracking consent](https://docs.datadoghq.com/real_user_monitoring/browser/advanced_configuration/?tab=npm#user-tracking-consent) for further information.
114128
*
129+
* @category Privacy
115130
* @defaultValue granted
116131
*/
117132
trackingConsent?: TrackingConsent | undefined
@@ -127,27 +142,38 @@ export interface InitConfiguration {
127142
/**
128143
* Optional proxy URL, for example: https://www.proxy.com/path.
129144
* See [Proxy Your Browser RUM Data](https://docs.datadoghq.com/real_user_monitoring/guide/proxy-rum-data) for further information.
145+
*
146+
* @category Transport
130147
*/
131148
proxy?: string | ProxyFn | undefined
149+
132150
/**
133151
* The Datadog [site](https://docs.datadoghq.com/getting_started/site) parameter of your organization.
134152
*
153+
* @category Transport
135154
* @defaultValue datadoghq.com
136155
*/
137156
site?: Site | undefined
138157

139158
// tag and context options
140159
/**
141160
* The service name for your application. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
161+
*
162+
* @category Data Collection
142163
*/
143164
service?: string | undefined | null
165+
144166
/**
145167
* The application’s environment, for example: prod, pre-prod, and staging. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
146168
*
169+
* @category Data Collection
147170
*/
148171
env?: string | undefined | null
172+
149173
/**
150174
* The application’s version, for example: 1.2.3, 6c44da20, and 2020.02.13. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
175+
*
176+
* @category Data Collection
151177
*/
152178
version?: string | undefined | null
153179

@@ -157,60 +183,77 @@ export interface InitConfiguration {
157183
*
158184
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
159185
*
186+
* @category Session Persistence
160187
* @defaultValue false
161188
*/
162189
usePartitionedCrossSiteSessionCookie?: boolean | undefined
190+
163191
/**
164192
* Use a secure session cookie. This disables RUM events sent on insecure (non-HTTPS) connections.
165193
*
166194
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
167195
*
196+
* @category Session Persistence
168197
* @defaultValue false
169198
*/
170199
useSecureSessionCookie?: boolean | undefined
200+
171201
/**
172202
* Preserve the session across subdomains for the same site.
173203
*
174204
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
175205
*
206+
* @category Session Persistence
176207
* @defaultValue false
177208
*/
178209
trackSessionAcrossSubdomains?: boolean | undefined
210+
179211
/**
180212
* Track anonymous user for the same site and extend cookie expiration date
181213
*
214+
* @category Data Collection
182215
* @defaultValue true
183216
*/
184217
trackAnonymousUser?: boolean | undefined
218+
185219
// internal options
186220
/**
187221
* [Internal option] Enable experimental features
188222
*
189223
* @internal
190224
*/
191225
enableExperimentalFeatures?: string[] | undefined
226+
192227
/**
193228
* [Internal option] Configure the dual shipping to another datacenter
229+
*
230+
* @internal
194231
*/
195232
replica?: ReplicaUserConfiguration | undefined
233+
196234
/**
197235
* [Internal option] Set the datacenter from where the data is dual shipped
236+
*
237+
* @internal
198238
*/
199239
datacenter?: string
240+
200241
/**
201242
* [Internal option] Datadog internal analytics subdomain
202243
*
203244
* @internal
204245
*/
205246
// TODO next major: remove this option and replace usages by proxyFn
206247
internalAnalyticsSubdomain?: string
248+
207249
/**
208250
* [Internal option] The percentage of telemetry configuration sent. A value between 0 and 100.
209251
*
210252
* @internal
211253
* @defaultValue 5
212254
*/
213255
telemetryConfigurationSampleRate?: number
256+
214257
/**
215258
* [Internal option] The percentage of telemetry usage sent. A value between 0 and 100.
216259
*

packages/logs/src/boot/logsPublicApi.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export interface LogsPublicApi extends PublicApi {
6464
*
6565
* See [User tracking consent](https://docs.datadoghq.com/logs/log_collection/javascript/#user-tracking-consent) for further information.
6666
*
67-
* @category Tracking Consent
67+
* @category Privacy
6868
* @param trackingConsent - The user tracking consent
6969
*/
7070
setTrackingConsent: (trackingConsent: TrackingConsent) => void
@@ -73,7 +73,7 @@ export interface LogsPublicApi extends PublicApi {
7373
* Set the global context information to all events, stored in `@context`
7474
* See [Global context](https://docs.datadoghq.com/logs/log_collection/javascript/#overwrite-context) for further information.
7575
*
76-
* @category Global Context
76+
* @category Context - Global Context
7777
* @param context - Global context
7878
*/
7979
setGlobalContext: (context: any) => void
@@ -83,7 +83,7 @@ export interface LogsPublicApi extends PublicApi {
8383
*
8484
* See [Global context](https://docs.datadoghq.com/logs/log_collection/javascript/#overwrite-context) for further information.
8585
*
86-
* @category Global Context
86+
* @category Context - Global Context
8787
*/
8888
getGlobalContext: () => Context
8989

@@ -92,7 +92,7 @@ export interface LogsPublicApi extends PublicApi {
9292
*
9393
* See [Global context](https://docs.datadoghq.com/logs/log_collection/javascript/#overwrite-context) for further information.
9494
*
95-
* @category Global Context
95+
* @category Context - Global Context
9696
* @param key - Key of the property
9797
* @param value - Value of the property
9898
*/
@@ -103,7 +103,7 @@ export interface LogsPublicApi extends PublicApi {
103103
*
104104
* See [Global context](https://docs.datadoghq.com/logs/log_collection/javascript/#overwrite-context) for further information.
105105
*
106-
* @category Global Context
106+
* @category Context - Global Context
107107
*/
108108
removeGlobalContextProperty: (key: any) => void
109109

@@ -112,7 +112,7 @@ export interface LogsPublicApi extends PublicApi {
112112
*
113113
* See [Global context](https://docs.datadoghq.com/logs/log_collection/javascript/#overwrite-context) for further information.
114114
*
115-
* @category Global Context
115+
* @category Context - Global Context
116116
*/
117117
clearGlobalContext: () => void
118118

@@ -121,15 +121,15 @@ export interface LogsPublicApi extends PublicApi {
121121
*
122122
* See [User session](https://docs.datadoghq.com/logs/log_collection/javascript/#user-context) for further information.
123123
*
124-
* @category User
124+
* @category Context - User
125125
* @param newUser - User information
126126
*/
127127
setUser(newUser: User & { id: string }): void
128128

129129
/**
130130
* Set user information to all events, stored in `@usr`
131131
*
132-
* @category User
132+
* @category Context - User
133133
* @deprecated You must specify a user id, favor using {@link setUser} instead
134134
* @param newUser - User information with optional id
135135
*/
@@ -140,7 +140,7 @@ export interface LogsPublicApi extends PublicApi {
140140
*
141141
* See [User session](https://docs.datadoghq.com/logs/log_collection/javascript/#user-context) for further information.
142142
*
143-
* @category User
143+
* @category Context - User
144144
* @returns User information
145145
*/
146146
getUser: () => Context
@@ -150,7 +150,7 @@ export interface LogsPublicApi extends PublicApi {
150150
*
151151
* See [User session](https://docs.datadoghq.com/logs/log_collection/javascript/#user-context) for further information.
152152
*
153-
* @category User
153+
* @category Context - User
154154
* @param key - Key of the property
155155
* @param property - Value of the property
156156
*/
@@ -159,7 +159,7 @@ export interface LogsPublicApi extends PublicApi {
159159
/**
160160
* Remove a user property
161161
*
162-
* @category User
162+
* @category Context - User
163163
* @param key - Key of the property to remove
164164
* @see [User session](https://docs.datadoghq.com/logs/log_collection/javascript/#user-context) for further information.
165165
*/
@@ -170,30 +170,30 @@ export interface LogsPublicApi extends PublicApi {
170170
*
171171
* See [User session](https://docs.datadoghq.com/logs/log_collection/javascript/#user-context) for further information.
172172
*
173-
* @category User
173+
* @category Context - User
174174
*/
175175
clearUser: () => void
176176

177177
/**
178178
* Set account information to all events, stored in `@account`
179179
*
180-
* @category Account
180+
* @category Context - Account
181181
* @param newAccount - Account information
182182
*/
183183
setAccount: (newAccount: Account) => void
184184

185185
/**
186186
* Get account information
187187
*
188-
* @category Account
188+
* @category Context - Account
189189
* @returns Account information
190190
*/
191191
getAccount: () => Context
192192

193193
/**
194194
* Set or update the account property, stored in `@account.<key>`
195195
*
196-
* @category Account
196+
* @category Context - Account
197197
* @param key - Key of the property
198198
* @param property - Value of the property
199199
*/
@@ -202,15 +202,15 @@ export interface LogsPublicApi extends PublicApi {
202202
/**
203203
* Remove an account property
204204
*
205-
* @category Account
205+
* @category Context - Account
206206
* @param key - Key of the property to remove
207207
*/
208208
removeAccountProperty: (key: string) => void
209209

210210
/**
211211
* Clear all account information
212212
*
213-
* @category Account
213+
* @category Context - Account
214214
* @returns Clear all account information
215215
*/
216216
clearAccount: () => void

packages/logs/src/domain/configuration.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,37 @@ export interface LogsInitConfiguration extends InitConfiguration {
3333
* - Enrich your logs with additional context attributes
3434
* - Modify your logs to modify their content, or redact sensitive sequences (see the list of editable properties)
3535
* - Discard selected logs
36+
*
37+
* @category Data Collection
3638
*/
3739
beforeSend?: ((event: LogsEvent, context: LogsEventDomainContext) => boolean) | undefined
40+
3841
/**
3942
* Forward console.error logs, uncaught exceptions and network errors to Datadog.
4043
*
44+
* @category Data Collection
4145
* @defaultValue true
4246
*/
4347
forwardErrorsToLogs?: boolean | undefined
48+
4449
/**
4550
* Forward logs from console.* to Datadog. Use "all" to forward everything or an array of console API names to forward only a subset.
51+
*
52+
* @category Data Collection
4653
*/
4754
forwardConsoleLogs?: ConsoleApiName[] | 'all' | undefined
55+
4856
/**
4957
* Forward reports from the [Reporting API](https://developer.mozilla.org/en-US/docs/Web/API/Reporting_API) to Datadog. Use "all" to forward everything or an array of report types to forward only a subset.
58+
*
59+
* @category Data Collection
5060
*/
5161
forwardReports?: RawReportType[] | 'all' | undefined
62+
5263
/**
5364
* Use PCI-compliant intake. See [PCI DSS Compliance](https://docs.datadoghq.com/data_security/pci_compliance/?tab=logmanagement) for further information.
5465
*
66+
* @category Privacy
5567
* @defaultValue false
5668
*/
5769
usePciIntake?: boolean

packages/logs/typedoc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
22
"$schema": "https://typedoc.org/schema.json",
3-
"entryPoints": ["src/entries/main.ts"]
3+
"entryPoints": ["src/entries/main.ts"],
4+
5+
"categoryOrder": [
6+
"Init",
7+
"Authentication",
8+
"Privacy",
9+
"Data Collection",
10+
"Session Persistence",
11+
"Transport",
12+
"*",
13+
"Other"
14+
]
415
}

0 commit comments

Comments
 (0)