Skip to content

Commit

Permalink
πŸ“ [RUMF-1397] Use new init parameters in the doc (#1922)
Browse files Browse the repository at this point in the history
* Use `sessionSampleRate` in doc

* Use `traceSampleRate` in doc

* Use `trackUserInteractions` in doc

* πŸ‘Œ fix aggressive renaming

* πŸ‘Œ keep deprecated sample rate doc for logs

* πŸ‘Œ phrasing

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>

* πŸ‘Œ phrasing

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>

* πŸ‘Œ phrasing

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
  • Loading branch information
bcaudan and rtrieu committed Jan 12, 2023
1 parent 402837f commit 90eee94
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 12 deletions.
13 changes: 7 additions & 6 deletions packages/logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ datadogLogs.init({
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100,
sessionSampleRate: 100,
})
```

Expand All @@ -61,8 +61,8 @@ Load and configure the SDK in the head section of your pages.
DD_LOGS.init({
clientToken: 'XXX',
site: 'datadoghq.com',
forwardErrorsToLogs: true,
sampleRate: 100,
forwardErrorsToLogs: true,
sessionSampleRate: 100,
})
})
</script>
Expand All @@ -87,7 +87,7 @@ To receive all logs and errors, load and configure the SDK at the beginning of t
clientToken: '<CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100,
sessionSampleRate: 100,
})
</script>
</head>
Expand All @@ -107,7 +107,7 @@ window.DD_LOGS.init({
clientToken: '<CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100,
sessionSampleRate: 100,
})
```

Expand All @@ -127,7 +127,8 @@ The following parameters are available to configure the Datadog browser logs SDK
| `forwardErrorsToLogs` | Boolean | No | `true` | Set to `false` to stop forwarding console.error logs, uncaught exceptions and network errors to Datadog. |
| `forwardConsoleLogs` | `"all"` or an Array of `"log"` `"debug"` `"info"` `"warn"` `"error"` | No | `[]` | Forward logs from `console.*` to Datadog. Use `"all"` to forward everything or an array of console API names to forward only a subset. |
| `forwardReports` | `"all"` or an Array of `"intervention"` `"deprecation"` `"csp_violation"` | No | `[]` | Forward reports from the [Reporting API][8] to Datadog. Use `"all"` to forward everything or an array of report types to forward only a subset. |
| `sampleRate` | Number | No | `100` | The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send logs. |
| `sampleRate` | Number | No | `100` | **Deprecated** - see `sessionSampleRate`. |
| `sessionSampleRate` | Number | No | `100` | The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send logs. |
| `silentMultipleInit` | Boolean | No | | Prevent logging errors while having multiple init. |
| `proxyUrl` | String | No | | Optional proxy URL (ex: https://www.proxy.com/path), see the full [proxy setup guide][6] for more information. |
| `telemetrySampleRate` | Number | No | `20` | Telemetry data (error, debug logs) about SDK execution is sent to Datadog in order to detect and solve potential issues. Set this option to `0` to opt out from telemetry collection. |
Expand Down
109 changes: 103 additions & 6 deletions packages/rum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ Add [`@datadog/browser-rum`][4] to your `package.json` file, then initialize it
```javascript
import { datadogRum } from '@datadog/browser-rum'

datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100, // if not included, the default is 100
trackResources: true,
trackLongTasks: true,
trackUserInteractions: true,
})
```

</details>

<details>
<summary>before <code>v4.30.0</code></summary>

```javascript
import { datadogRum } from '@datadog/browser-rum'

datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
Expand Down Expand Up @@ -102,7 +125,7 @@ datadogRum.init({

</details>

The `trackInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained on your pages may be included to identify the elements interacted with.
The `trackUserInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained in your pages may be included to identify the elements interacted with.

### CDN async

Expand All @@ -111,6 +134,37 @@ Add the generated code snippet to the head tag of every HTML page you want to mo
<details open>
<summary>Latest version</summary>

<!-- prettier-ignore -->
```html
<script>
(function(h,o,u,n,d) {
h=h[d]=h[d]||{q:[],onReady:function(c){h.q.push(c)}}
d=o.createElement(u);d.async=1;d.src=n
n=o.getElementsByTagName(u)[0];n.parentNode.insertBefore(d,n)
})(window,document,'script','https://www.datadoghq-browser-agent.com/datadog-rum-v4.js','DD_RUM')
DD_RUM.onReady(function() {
DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
site: '<DATADOG_SITE>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100, // if not included, the default is 100
trackResources: true,
trackLongTasks: true,
trackUserInteractions: true,
})
})
</script>
```

</details>

<details>
<summary>before<code>v4.30.0</code></summary>

<!-- prettier-ignore -->
```html
<script>
Expand Down Expand Up @@ -197,7 +251,7 @@ Add the generated code snippet to the head tag of every HTML page you want to mo

</details>

The `trackInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained on your pages may be included to identify the elements interacted with.
The `trackUserInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained in your pages may be included to identify the elements interacted with.

Early RUM API calls must be wrapped in the `DD_RUM.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.

Expand All @@ -208,6 +262,31 @@ Add the generated code snippet to the head tag (in front of any other script tag
<details open>
<summary>Latest version</summary>

```html
<script src="https://www.datadoghq-browser-agent.com/datadog-rum-v4.js" type="text/javascript"></script>
<script>
window.DD_RUM &&
window.DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
site: '<DATADOG_SITE>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100, // if not included, the default is 100
trackResources: true,
trackLongTasks: true,
trackUserInteractions: true,
})
</script>
```

</details>

<details>
<summary>before<code>v4.30.0</code></summary>

```html
<script src="https://www.datadoghq-browser-agent.com/datadog-rum-v4.js" type="text/javascript"></script>
<script>
Expand Down Expand Up @@ -276,7 +355,7 @@ Add the generated code snippet to the head tag (in front of any other script tag

</details>

The `trackInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained on your pages may be included to identify the elements interacted with.
The `trackUserInteractions` and `trackFrustrations` parameters enable the automatic collection of user clicks in your application. **Sensitive and private data** contained in your pages may be included to identify the elements interacted with.

The `window.DD_RUM` check is used to prevent issues if a loading failure occurs with the RUM Browser SDK.

Expand All @@ -291,7 +370,7 @@ window.DD_RUM.init({
applicationId: 'XXX',
clientToken: 'XXX',
site: 'datadoghq.com',
sampleRate: 100,
sessionSampleRate: 100,
sessionReplaySampleRate: 100, // if not included, the default is 100
trackResources: true,
trackLongTasks: true,
Expand Down Expand Up @@ -342,6 +421,12 @@ The application’s version, for example: 1.2.3, 6c44da20, and 2020.02.13. Follo
Allows you to control RUM views creation. See [override default RUM view names][10].

`trackInteractions`
: Optional - **Deprecated**<br/>
**Type**: Boolean<br/>
**Default**: `false` <br/>
See `trackUserInteractions`.

`trackUserInteractions`
: Optional<br/>
**Type**: Boolean<br/>
**Default**: `false` <br/>
Expand All @@ -351,7 +436,7 @@ Enables [automatic collection of users actions][6].
: Optional<br/>
**Type**: Boolean<br/>
**Default**: `false` <br/>
Enables [automatic collection of user frustrations][20]. Implies `trackInteractions: true`.
Enables [automatic collection of user frustrations][20]. Implies `trackUserInteractions: true`.

`trackResources`
: Optional<br/>
Expand All @@ -377,10 +462,16 @@ See [Session Replay Privacy Options][13].
Specify your own attribute to be used to [name actions][9].

`sampleRate`
: Optional - **Deprecated**<br/>
**Type**: Number<br/>
**Default**: `100`<br/>
See ``sessionSampleRate`.

`sessionSampleRate`
: Optional<br/>
**Type**: Number<br/>
**Default**: `100`<br/>
The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send RUM events. For more details about `sampleRate`, see the [sampling configuration][21].
The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send RUM events. For more details about `sessionSampleRate`, see the [sampling configuration][21].

`replaySampleRate`
: Optional - **Deprecated**<br/>
Expand Down Expand Up @@ -417,6 +508,12 @@ Optional proxy URL, for example: https://www.proxy.com/path. For more informatio
A list of request origins used to inject tracing headers. For more information, see [Connect RUM and Traces][12].

`tracingSampleRate`
: Optional - **Deprecated**<br/>
**Type**: Number<br/>
**Default**: `100`<br/>
See `traceSampleRate`.

`traceSampleRate`
: Optional<br/>
**Type**: Number<br/>
**Default**: `100`<br/>
Expand Down

0 comments on commit 90eee94

Please sign in to comment.