Skip to content

Commit a2c8fdb

Browse files
committed
update advanced config
1 parent 3e9e552 commit a2c8fdb

1 file changed

Lines changed: 52 additions & 52 deletions

File tree

flashduty/en/2. RUM/2. Applications/3. Advanced Configuration.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
title: "RUM SDK Advanced Configuration"
3-
description: "This document details how to configure advanced features of the FlashCat RUM SDK."
3+
description: "This document provides detailed instructions on configuring advanced features of FlashCat RUM SDK."
44
date: "2024-05-09T10:00:00+08:00"
55
url: "https://docs.flashcat.cloud/en/flashduty/rum/advanced-configuration?nav=01JCQ7A4N4WRWNXW8EWEHXCMF5"
66
---
77

88
## Overview
99

10-
FlashDuty Real User Monitoring (RUM) provides various advanced configuration options that allow you to modify the collected data and context according to your needs, supporting the following scenarios:
10+
FlashDuty Real User Monitoring (RUM) offers various advanced configuration options that allow you to modify collected data and context based on your requirements, supporting the following scenarios:
1111

12-
- **Protect sensitive data**: Mask sensitive data such as personally identifiable information.
12+
- **Protect sensitive data**: Mask personally identifiable information and other sensitive data.
1313
- **Associate user sessions**: Link user sessions with internal user identifiers for support and troubleshooting.
14-
- **Reduce data volume**: Reduce RUM data collection through sampling to optimize costs.
15-
- **Enhance context**: Add richer context information to data beyond default attributes.
14+
- **Reduce data volume**: Lower RUM data collection through sampling to optimize costs.
15+
- **Enhance context**: Add richer contextual information to data beyond default attributes.
1616

17-
The following sections detail how to implement these features.
17+
The following sections detail how to implement these capabilities.
1818

1919
## Override Default RUM View Names
2020

2121
The FlashDuty RUM browser SDK automatically generates view events when users visit new pages or when URLs change in single-page applications (SPAs). View names are calculated from the current page URL by default and automatically remove variable IDs (path segments containing numbers). For example, `/dashboard/1234` and `/dashboard/9a` are normalized to `/dashboard/?`.
2222

23-
You can manually track view events by setting the `trackViewsManually` option and specify custom names for views as well as associated services and versions.
23+
You can manually track view events by setting the `trackViewsManually` option and specify custom names for views along with their associated services and versions.
2424

2525
### Configure Manual View Tracking
2626

@@ -37,7 +37,7 @@ flashcatRum.init({
3737
});
3838
```
3939

40-
After enabling manual tracking, you need to call the `startView` method for each new page or route change (for single-page applications) to start a view. RUM data will begin collecting when the view starts. You can add context to the view and its child events.
40+
After enabling manual tracking, you need to call the `startView` method on each new page or route change (for single-page applications) to start a view. RUM data will begin collecting when the view starts. You can add context to the view and its child events.
4141

4242
#### Parameter Description
4343

@@ -63,10 +63,10 @@ flashcatRum.startView({
6363

6464
### React Router Integration
6565

66-
For applications using React Router v6, you can override default view names to match route names defined in your React application with these steps:
66+
For applications using React Router v6, you can override default view names to match route names defined in your React application through the following steps:
6767

68-
1. Set `trackViewsManually` to `true` during initialization (as above).
69-
2. Start views when routes change using the `useLocation` and `matchRoutes` APIs from `react-router-dom`.
68+
1. Set `trackViewsManually` to `true` during initialization (as shown above).
69+
2. Start views on route changes using the `useLocation` and `matchRoutes` APIs from `react-router-dom`.
7070

7171
Here's an example:
7272

@@ -119,9 +119,9 @@ flashcatRum.setViewName("Checkout");
119119

120120
## Enrich and Control RUM Data
121121

122-
The FlashDuty RUM browser SDK automatically captures RUM events and populates their main properties. With the `beforeSend` callback function, you can intercept and modify events before they are sent to FlashDuty, supporting the following operations:
122+
The FlashDuty RUM browser SDK automatically captures RUM events and populates their main attributes. Through the `beforeSend` callback function, you can intercept and modify events before they are sent to FlashDuty, supporting the following operations:
123123

124-
- **Enrich events**: Add additional context properties.
124+
- **Enrich events**: Add additional context attributes.
125125
- **Modify events**: Change event content or mask sensitive information.
126126
- **Discard events**: Selectively discard specific RUM events.
127127

@@ -144,7 +144,7 @@ Different event types correspond to different contexts:
144144

145145
### Enrich RUM Events
146146

147-
You can add context properties to events through the `beforeSend` callback. For example, add data from response headers to resource events:
147+
You can add context attributes to events through the `beforeSend` callback. For example, adding data from response headers to resource events:
148148

149149
```javascript
150150
flashcatRum.init({
@@ -162,7 +162,7 @@ flashcatRum.init({
162162
});
163163
```
164164

165-
You can also add properties to events through the global context API. Note: Only properties in `event.context` will be recognized by the RUM SDK.
165+
You can also add attributes to events through the global context API. Note: Only attributes in `event.context` will be recognized by the RUM SDK.
166166

167167
### Modify RUM Event Content
168168

@@ -179,26 +179,26 @@ flashcatRum.init({
179179
});
180180
```
181181

182-
#### Modifiable Properties
182+
#### Modifiable Attributes
183183

184-
The following properties can be modified through `beforeSend`:
184+
The following attributes can be modified through `beforeSend`:
185185

186186
- **view.url** (string): Current page URL.
187187
- **view.referrer** (string): Previous page URL.
188188
- **view.name** (string): Current view name.
189189
- **view.performance.lcp.resource_url** (string): Resource URL for Largest Contentful Paint (LCP).
190-
- **service** (string): Service name of the application.
190+
- **service** (string): Application service name.
191191
- **version** (string): Application version.
192-
- **action.target.name** (string): Element involved in user interaction (only for automatically collected actions).
192+
- **action.target.name** (string): Element involved in user interaction (for automatically collected actions only).
193193
- **error.message** (string): Error message.
194194
- **error.stack** (string): Error stack or supplementary information.
195195
- **error.resource.url** (string): Resource URL that triggered the error.
196196
- **resource.url** (string): Resource URL.
197197
- **long_task.scripts.source_url** (string): Script resource URL for long tasks.
198198
- **long_task.scripts.invoker** (string): Name of the invoking script.
199-
- **context** (object): Properties added through global context API, view context API, or manually generated events (such as `addError`, `addAction`).
199+
- **context** (object): Attributes added through global context API, view context API, or manually generated events (such as `addError`, `addAction`).
200200

201-
Modifications to other properties will be ignored.
201+
Modifications to other attributes will be ignored.
202202

203203
### Discard RUM Events
204204

@@ -221,13 +221,13 @@ flashcatRum.init({
221221

222222
By adding user information to RUM sessions, you can:
223223

224-
- Track specific users' browsing paths.
224+
- Track browsing paths of specific users.
225225
- Understand which users are most affected by errors.
226226
- Monitor performance for key users.
227227

228228
### User Attributes
229229

230-
The following are optional user attributes, but it is recommended to provide at least one:
230+
The following are optional user attributes, with at least one recommended:
231231

232232
- **usr.id** (string): Unique user identifier.
233233
- **usr.name** (string): User-friendly name, displayed by default in the RUM UI.
@@ -254,13 +254,13 @@ flashcatRum.setUser({
254254
const user = flashcatRum.getUser();
255255
```
256256

257-
#### Add/Override User Properties
257+
#### Add/Override User Attributes
258258

259259
```javascript
260260
flashcatRum.setUserProperty("name", "John Doe");
261261
```
262262

263-
#### Remove User Properties
263+
#### Remove User Attributes
264264

265265
```javascript
266266
flashcatRum.removeUserProperty("name");
@@ -274,7 +274,7 @@ flashcatRum.clearUser();
274274

275275
**Note**:
276276

277-
- After user session information is changed, subsequent RUM events will include the updated information.
277+
- After user session information changes, subsequent RUM events will include the updated information.
278278
- After logout (calling `clearUser`), the last view will still retain user information, but subsequent views and session-level data will not.
279279

280280
## Sampling
@@ -290,7 +290,7 @@ flashcatRum.init({
290290
});
291291
```
292292

293-
Sampled-out sessions will not collect any page views or their related telemetry data.
293+
Sampled sessions will not collect any page views and their related telemetry data.
294294

295295
## User Tracking Consent
296296

@@ -302,7 +302,7 @@ To comply with privacy regulations such as GDPR and CCPA, FlashDuty RUM allows s
302302
You can change the consent status after initialization using the `setTrackingConsent` API:
303303

304304
- Changing from `"granted"` to `"not-granted"`: Stops the RUM session, and data is no longer sent.
305-
- Changing from `"not-granted"` to `"granted"`: If there is no active session, a new session is created and data collection resumes.
305+
- Changing from `"not-granted"` to `"granted"`: If there is no active session, a new session will be created and data collection resumes.
306306

307307
**Note**: Consent status is not synchronized between tabs or persisted; you need to provide the user's decision during initialization or through `setTrackingConsent`.
308308

@@ -348,7 +348,7 @@ flashcatRum.setViewContext({
348348

349349
## Error Context
350350

351-
When capturing errors, you can attach local context to error objects through the `dd_context` property, and the RUM SDK will automatically merge it into the final error event context.
351+
When capturing errors, you can attach local context to error objects through the `dd_context` attribute, and the RUM SDK will automatically merge it into the final error event context.
352352

353353
```javascript
354354
const error = new Error("Something went wrong");
@@ -360,37 +360,37 @@ throw error;
360360

361361
Global context is attached to all RUM events and supports the following operations:
362362

363-
- **Add Global Context Property**:
363+
- **Add global context attribute**:
364364
```javascript
365365
flashcatRum.setGlobalContextProperty("activity", {
366366
hasPaid: true,
367367
amount: 23.42,
368368
});
369369
```
370-
- **Remove Global Context Property**:
370+
- **Remove global context attribute**:
371371
```javascript
372372
flashcatRum.removeGlobalContextProperty("codeVersion");
373373
```
374-
- **Replace Global Context**:
374+
- **Replace global context**:
375375
```javascript
376376
flashcatRum.setGlobalContext({
377377
codeVersion: 34,
378378
});
379379
```
380-
- **Clear Global Context**:
380+
- **Clear global context**:
381381
```javascript
382382
flashcatRum.clearGlobalContext();
383383
```
384-
- **Read Global Context**:
384+
- **Read global context**:
385385
```javascript
386386
const context = flashcatRum.getGlobalContext();
387387
```
388388

389389
### Context Lifecycle
390390

391-
By default, global context and user context are stored in the current page's memory, meaning:
391+
By default, global context and user context are stored in the current page memory, therefore:
392392

393-
- They are not retained after a full page refresh.
393+
- They are not retained after a complete page refresh.
394394
- They are not shared between different tabs or windows.
395395

396396
Enabling the `storeContextsAcrossPages` option stores context in `localStorage`, supporting:
@@ -413,15 +413,15 @@ flashcatRum.init({
413413

414414
- It is not recommended to store personally identifiable information in context, as `localStorage` data exceeds the user session lifecycle.
415415
- Not compatible with the `trackSessionAcrossSubdomains` option, as `localStorage` is only shared within the same domain.
416-
- `localStorage` capacity is limited to 5 MiB, so ensure that the total of application data, FlashDuty context, and other third-party data is within this range.
416+
- `localStorage` capacity is limited to 5 MiB, so ensure that the total of application data, FlashDuty context, and other third-party data remains within this range.
417417

418418
## Micro-frontend Support
419419

420-
FlashDuty RUM supports micro-frontend architecture by identifying event sources through the stacktrace mechanism. You need to extract `service` and `version` properties from application file paths and filenames.
420+
FlashDuty RUM supports micro-frontend architecture by identifying event sources through stacktrace mechanism. You need to extract `service` and `version` attributes from application file paths and filenames.
421421

422422
### Usage
423423

424-
Override `service` and `version` properties in `beforeSend` based on stack information:
424+
Override `service` and `version` attributes in `beforeSend` based on stack information:
425425

426426
```javascript
427427
const SERVICE_REGEX = /some-pathname\/(?<service>\w+)\/(?<version>\w+)\//;
@@ -444,7 +444,7 @@ flashcatRum.init({
444444
});
445445
```
446446
447-
In the RUM browser, you can filter events using the `service` property.
447+
In the RUM browser, you can filter events using the `service` attribute.
448448
449449
### Limitations
450450
@@ -455,36 +455,36 @@ The following events cannot be attributed to specific sources and therefore do n
455455
- View events (can be resolved by overriding view names).
456456
- CORS and CSP violation events.
457457
458-
## Connect RUM and Traces
458+
## Integrate RUM with Distributed Tracing
459459
460-
The APM integration with Real User Monitoring allows you to link requests from your web and mobile applications to their corresponding backend traces. This combination enables you to see your full frontend and backend data through one lens.
460+
Integrating RUM with distributed tracing allows you to correlate requests from your web and mobile applications with their corresponding backend traces. This combination enables you to view complete frontend and backend data at a glance.
461461
462-
Use frontend data from RUM, as well as backend, infrastructure, and log information from trace ID injection to pinpoint issues anywhere in your stack and understand what your users are experiencing.
462+
Use frontend data from RUM along with backend, infrastructure, and log information from trace ID injection to identify issues anywhere in your stack and understand user experience.
463463
464464
### Usage
465465
466-
Initialize the RUM SDK. Configure the `allowedTracingUrls` initialization parameter with the list of internal, first-party origins called by your browser application.
466+
Initialize the RUM SDK. Configure the `allowedTracingUrls` initialization parameter with the list of internal first-party origins called by your browser application.
467467
468468
```javascript
469469
import { flashcatRum } from "@flashcatcloud/browser-rum";
470470

471471
flashcatRum.init({
472472
applicationId: "<YOUR_APPLICATION_ID>", // Get from application management page
473473
clientToken: "<YOUR_CLIENT_TOKEN>", // Get from application management page
474-
service: "<SERVICE_NAME>", // Service name to distinguish different services
474+
service: "<SERVICE_NAME>", // Service name for distinguishing different services
475475
env: "<ENV_NAME>", // Environment identifier
476476
version: "1.0.0", // Application version
477477
sessionSampleRate: 100, // Sampling rate
478-
allowedTracingUrls: ["https://api.example.com", /https:\/\/.*\.my-api-domain\.com/, (url) => url.startsWith("https://api.example.com")], // A list of request URLs used to inject tracing headers.
479-
traceSampleRate: 20 // Optional,The percentage of requests to trace: 100 for all, 0 for none. Default value: 100
478+
allowedTracingUrls: ["https://api.example.com", /https:\/\/.*\.my-api-domain\.com/, (url) => url.startsWith("https://api.example.com")], // List of URLs that need to be tracked
479+
traceSampleRate: 20 // Optional parameter, percentage of requests to trace: 100 for all, 0 for none. Default value: 100
480480
});
481481
```
482482
483-
allowedTracingUrls matches the full URL (`<scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]`). It accepts the following types:
483+
allowedTracingUrls matches the complete URL (`<scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]`). It accepts the following types:
484484

485-
- **String:** matches any URL that starts with the value, so `https://api.example.com` matches `https://api.example.com/v1/resource`.
486-
- **RegExp:** executes a test with the provided RegExp and the URL.
487-
- **Function:** evaluates with the URL as parameter. Returning a boolean set to true indicates a match.
485+
- **String:** Matches any URL that starts with this value, for example `https://api.example.com ` matches `https://api.example.com/v1/resource`.
486+
- **RegExp:** Uses the regex test() method to check if the URL matches.
487+
- **Function:** Accepts the URL as a parameter and executes the callback function, returning `true` indicates a successful URL match.
488488

489489
## Considerations
490490

@@ -494,4 +494,4 @@ allowedTracingUrls matches the full URL (`<scheme>://<host>[:<port>]/<path>[?<qu
494494

495495
## More Information
496496

497-
For more detailed information about FlashDuty RUM, visit [FlashDuty SDK](https://github.com/flashcatcloud/browser-sdk).
497+
For more detailed information about FlashDuty RUM, please visit [FlashDuty SDK](https://github.com/flashcatcloud/browser-sdk).

0 commit comments

Comments
 (0)