-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rum] Add RUM's plugin documentation #144
Draft
yoannmoinet
wants to merge
1
commit into
master
Choose a base branch
from
yoann/add-rum-documentation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# RUM Plugin <!-- #omit in toc --> | ||
|
||
> [!NOTE] | ||
> This feature is in **beta** and may misbehave in edgiest cases. | ||
|
||
Interact with Real User Monitoring (RUM) directly from your build system. | ||
|
||
<!-- The title and the following line will both be added to the root README.md --> | ||
|
||
## Table of content <!-- #omit in toc --> | ||
|
||
<!-- This is auto generated with yarn cli integrity --> | ||
|
||
<!-- #toc --> | ||
- [Configuration](#configuration) | ||
- [Browser SDK Injection](#browser-sdk-injection) | ||
- [Using global `DD_RUM`](#using-global-ddrum) | ||
- [rum.sdk.applicationId](#rumsdkapplicationid) | ||
- [rum.sdk.clientToken](#rumsdkclienttoken) | ||
<!-- #toc --> | ||
|
||
## Configuration | ||
|
||
<details> | ||
<summary>Full configuration</summary> | ||
|
||
```ts | ||
rum?: { // BETA, the feature may misbehave in edgiest cases. | ||
disabled?: boolean; | ||
sdk?: { | ||
actionNameAttribute?: string; | ||
allowedTracingUrls?: string[]; | ||
allowUntrustedEvents?: boolean; | ||
applicationId: string; | ||
clientToken?: string; | ||
compressIntakeRequests?: boolean; | ||
defaultPrivacyLevel?: 'mask' | 'mask-user-input' | 'allow'; | ||
enablePrivacyForActionName?: boolean; | ||
env?: string; | ||
excludedActivityUrls?: string[]; | ||
proxy?: string; | ||
service?: string; | ||
sessionReplaySampleRate?: number; | ||
sessionSampleRate?: number; | ||
silentMultipleInit?: boolean; | ||
site?: string; | ||
startSessionReplayRecordingManually?: boolean; | ||
storeContextsAcrossPages?: boolean; | ||
telemetrySampleRate?: number; | ||
traceSampleRate?: number; | ||
trackingConsent?: 'granted' | 'not_granted'; | ||
trackLongTasks?: boolean; | ||
trackResources?: boolean; | ||
trackUserInteractions?: boolean; | ||
trackViewsManually?: boolean; | ||
version?: string; | ||
workerUrl?: string; | ||
}; | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
**Minimal configuration**: | ||
|
||
```ts | ||
rum: { | ||
sdk: { | ||
applicationId: 'your_application_id', | ||
} | ||
} | ||
``` | ||
|
||
## Browser SDK Injection | ||
|
||
Automatically inject the RUM SDK v6 into your application and initialize it. | ||
|
||
Full documentation can be found in the [Datadog documentation](https://docs.datadoghq.com/real_user_monitoring/browser/setup/client?tab=rum#configuration). | ||
|
||
### Using global `DD_RUM` | ||
|
||
You can use [the global `DD_RUM` object](https://docs.datadoghq.com/real_user_monitoring/browser/advanced_configuration/?tab=cdnasync) to interact with the RUM SDK. | ||
|
||
> [!NOTE] | ||
> You don't need to use `DD_RUM.onReady()` to wrap your code, | ||
> the plugin makes sure the SDK is loaded before executing your code. | ||
|
||
```ts | ||
import type { RumTypes: { RumPublicApi } } from '@datadog/webpack-plugin'; | ||
declare global { | ||
type DD_RUM = RumPublicApi; | ||
} | ||
``` | ||
|
||
You can also configure `eslint` to recognize the global `DD_RUM` object: | ||
|
||
```json | ||
{ | ||
"globals": { | ||
"DD_RUM": "readonly" | ||
} | ||
} | ||
``` | ||
|
||
### rum.sdk.applicationId | ||
|
||
> required | ||
|
||
The RUM application ID. [Create a new application if necessary](https://app.datadoghq.com/rum/list/create). | ||
|
||
### rum.sdk.clientToken | ||
|
||
> optional, will be fetched if missing | ||
|
||
A [Datadog client token](https://docs.datadoghq.com/account_management/api-app-keys/#client-tokens). | ||
|
||
> [!NOTE] | ||
> If not provided, the plugin will attempt to fetch the client token using the API. | ||
> You need to provide both `auth.apiKey` and `auth.appKey` with the `rum_apps_read` permission. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not working because the
dts()
bundling doesn't bundle in@datadog/browser-rum
for some reason.Needs a fix before merging.