Skip to content

Commit e6dfa6f

Browse files
author
niuweili
committed
Merge branch 'feat/rum_docs@nwl'
2 parents 02d1f5b + 9b8ae2c commit e6dfa6f

4 files changed

Lines changed: 66 additions & 4 deletions

File tree

flashduty/en/2. RUM/2. Applications/2. SDK Integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ You can check for loading issues with `window.FC_RUM` if the RUM browser SDK fai
131131
| sessionSampleRate | Number | No | Percentage of sessions to track: 100 for all, 0 for none. Only tracked sessions send RUM events. Default: `100` |
132132
| silentMultipleInit | Boolean | No | If the RUM browser SDK is already initialized on the page, initialization will silently fail. Default: `false` |
133133
| proxy | String | No | Optional proxy URL, for example: `https://www.proxy.com/path` |
134-
| allowedTracingUrls | Array | No | List of request URLs for injecting tracing headers |
134+
| allowedTracingUrls | Array | No | List of request URLs for injecting tracing headers. For more information, see [Connect RUM and Traces](https://docs.flashcat.cloud/en/flashduty/rum/sdk-integration#Connect%20RUM%20and%20Traces) |
135135
| traceSampleRate | Number | No | Percentage of requests to trace: 100 for all, 0 for none. Default: `100` |
136136
| excludedActivityUrls | Array | No | List of request origins to ignore when calculating page activity |
137137
| compressIntakeRequests | Boolean | No | Compress requests sent to the FlashDuty intake to reduce bandwidth usage when sending large amounts of data. Compression is done in a Worker thread. Default: `false` |
138138
| storeContextsAcrossPages | Boolean | No | Store global context and user context in localStorage to preserve them across user navigation. Default: `false` |
139-
| allowUntrustedEvents | Boolean | No | Allow capturing [untrusted events][untrustedEvents], for example in automated UI tests. Default: `false` |
139+
| allowUntrustedEvents | Boolean | No | Allow capturing [untrusted events][https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted], for example in automated UI tests. Default: `false` |
140140

141141
## Use Cases
142142

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,37 @@ 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
459+
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.
461+
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.
463+
464+
### Usage
465+
466+
Initialize the RUM SDK. Configure the `allowedTracingUrls` initialization parameter with the list of internal, first-party origins called by your browser application.
467+
468+
```javascript
469+
import { flashcatRum } from "@flashcatcloud/browser-rum";
470+
471+
flashcatRum.init({
472+
applicationId: "<YOUR_APPLICATION_ID>", // Get from application management page
473+
clientToken: "<YOUR_CLIENT_TOKEN>", // Get from application management page
474+
service: "<SERVICE_NAME>", // Service name to distinguish different services
475+
env: "<ENV_NAME>", // Environment identifier
476+
version: "1.0.0", // Application version
477+
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.
480+
});
481+
```
482+
483+
allowedTracingUrls matches the full URL (`<scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]`). It accepts the following types:
484+
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.
488+
458489
## Considerations
459490

460491
- Ensure correct configuration of `applicationId` and `clientToken` to avoid data upload failures.

flashduty/zh/2. RUM/2. 应用管理/2. SDK接入.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ flashcatRum.init({
130130
| sessionSampleRate | Number || 要跟踪的会话百分比:100 为所有,0 为无。仅跟踪的会话发送 RUM 事件。默认值:`100` |
131131
| silentMultipleInit | Boolean || 如果 RUM 浏览器 SDK 已在页面上初始化,则初始化会静默失败。默认值:`false` |
132132
| proxy | String || 可选代理 URL,例如:`https://www.proxy.com/path` |
133-
| allowedTracingUrls | Array || 用于注入跟踪 Headers 的请求 URL 列表。 |
133+
| allowedTracingUrls | Array || 用于注入跟踪 Headers 的请求 URL 列表。请参阅[连接RUM与跟踪](https://docs.flashcat.cloud/zh/flashduty/rum/advanced-configuration#%E9%9B%86%E6%88%90%20RUM%20%E4%B8%8E%E5%88%86%E5%B8%83%E5%BC%8F%E8%BF%BD%E8%B8%AA) |
134134
| traceSampleRate | Number || 要跟踪的请求百分比:100 为所有,0 为无。默认值:`100` |
135135
| excludedActivityUrls | Array || 计算页面活动时忽略的请求来源列表。 |
136136
| compressIntakeRequests | Boolean || 压缩发送到 FlashDuty 入口的请求,以减少发送大量数据时的带宽使用。压缩是在 Worker 线程中完成的。默认值:`false` |
137137
| storeContextsAcrossPages | Boolean || 将全局上下文和用户上下文存储在 localStorage 中以沿用户导航保留它们。默认值:`false` |
138-
| allowUntrustedEvents | Boolean || 允许捕获[不受信任的事件][untrustedEvents],例如在自动化 UI 测试中。默认值:`false` |
138+
| allowUntrustedEvents | Boolean || 允许捕获[不受信任的事件](https://developer.mozilla.org/zh-CN/docs/Web/API/Event/isTrusted),例如在自动化 UI 测试中。默认值:`false` |
139139

140140
## 应用场景
141141

flashduty/zh/2. RUM/2. 应用管理/3. 高级配置.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,37 @@ flashcatRum.init({
455455
- 视图事件(可通过覆盖视图名称解决)。
456456
- CORS 和 CSP 违规事件。
457457
458+
## 集成 RUM 与分布式追踪
459+
460+
集成 RUM 与分布式追踪,可让您将 Web 和移动应用程序的请求与其对应的后端跟踪关联起来。这种组合让您能够一目了然地查看完整的前端和后端数据。
461+
462+
使用来自 RUM 的前端数据以及来自跟踪 ID 注入的后端、基础设施和日志信息来查明堆栈中任何地方的问题并了解用户的体验。
463+
464+
### 使用方法
465+
466+
初始化 RUM SDK。使用 `allowedTracingUrls` 初始化参数配置浏览器应用调用的内部第一方源列表。
467+
468+
```javascript
469+
import { flashcatRum } from "@flashcatcloud/browser-rum";
470+
471+
flashcatRum.init({
472+
applicationId: "<YOUR_APPLICATION_ID>", // 从应用管理页面获取
473+
clientToken: "<YOUR_CLIENT_TOKEN>", // 从应用管理页面获取
474+
service: "<SERVICE_NAME>", // 服务名称,用于区分不同的服务
475+
env: "<ENV_NAME>", // 环境标识
476+
version: "1.0.0", // 应用版本号
477+
sessionSampleRate: 100, // 采样率
478+
allowedTracingUrls: ["https://api.example.com", /https:\/\/.*\.my-api-domain\.com/, (url) => url.startsWith("https://api.example.com")], // 需要跟踪的url列表
479+
traceSampleRate: 20 // 可选参数,要跟踪的请求百分比:100为所有,0为无。
480+
});
481+
```
482+
483+
allowedTracingUrls 匹配完整 URL(`<scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]`)。它接受以下类型:
484+
485+
- **string:** 匹配任何以该值开头的 URL,例如 `https://api.example.com ` 匹配 `https://api.example.com/v1/resource`
486+
- **RegExp** 使用正则表达式的 test() 方法检查 URL 是否匹配。
487+
- **function:** 接收 URL 作为参数执行回调函数,当函数返回 `true` 时表示 URL 匹配成功。
488+
458489
## 注意事项
459490

460491
- 确保正确配置 `applicationId` 和 `clientToken`,以避免数据上传失败。

0 commit comments

Comments
 (0)