From 1d3e50d0131d0043ef7575fe3b2ffbf5d992ddda Mon Sep 17 00:00:00 2001 From: Fiona Date: Wed, 5 Aug 2026 00:48:50 -0700 Subject: [PATCH] docs(rum): state the setTrackNetworkRequests prerequisite for HarmonyOS network tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The network integration section explained the rcp interceptor and the FlashcatHttp wrapper but never mentioned that both need `setTrackNetworkRequests(true)`, which defaults to false. Readers who followed only that section got no resource events and had no hint why. The view and tap sections already state their own toggles, so this brings the network section in line. Also note that plain `http.createHttp()` is not hooked, and mark the manual resource API as unaffected by the toggle — it bypasses the bus path the toggle gates. --- en/rum/sdk/harmony/data-collection.mdx | 6 +++--- en/rum/sdk/harmony/sdk-integration.mdx | 6 +++++- zh/rum/sdk/harmony/data-collection.mdx | 6 +++--- zh/rum/sdk/harmony/sdk-integration.mdx | 6 +++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/en/rum/sdk/harmony/data-collection.mdx b/en/rum/sdk/harmony/data-collection.mdx index c06c229..bb850ce 100644 --- a/en/rum/sdk/harmony/data-collection.mdx +++ b/en/rum/sdk/harmony/data-collection.mdx @@ -107,9 +107,9 @@ Action events include `action.id`, `action.type`, `action.target.name`, and `act A resource represents a network request. The SDK generates resources in these cases: -- You use an `rcp` session with `FlashcatTrace.interceptor()` -- You use `FlashcatHttp.request()` to wrap `@kit.NetworkKit` requests -- You manually call `GlobalRumMonitor.get().startResource()` and `stopResource()` +- You use an `rcp` session with `FlashcatTrace.interceptor()`, with `setTrackNetworkRequests(true)` enabled +- You use `FlashcatHttp.request()` to wrap `@kit.NetworkKit` requests, with `setTrackNetworkRequests(true)` enabled +- You manually call `GlobalRumMonitor.get().startResource()` and `stopResource()`, which the toggle does not affect ```ts import { diff --git a/en/rum/sdk/harmony/sdk-integration.mdx b/en/rum/sdk/harmony/sdk-integration.mdx index 2f28934..98c63df 100644 --- a/en/rum/sdk/harmony/sdk-integration.mdx +++ b/en/rum/sdk/harmony/sdk-integration.mdx @@ -160,7 +160,11 @@ monitor.stopAction(RumActionType.SCROLL, 'product_feed'); ## Track network requests and Trace -The HarmonyOS SDK supports two network integration paths. +The HarmonyOS SDK supports two network integration paths. Both only produce resource events when RUM is configured with `setTrackNetworkRequests(true)`, which is disabled by default. + + +The SDK does not automatically hook `http.createHttp()` from `@kit.NetworkKit`. Requests you send with it directly are not collected. Use one of the integration paths below, or the [manual resource API](/en/rum/sdk/harmony/data-collection#resource-events). + ### rcp interceptor diff --git a/zh/rum/sdk/harmony/data-collection.mdx b/zh/rum/sdk/harmony/data-collection.mdx index ffb126f..4159b42 100644 --- a/zh/rum/sdk/harmony/data-collection.mdx +++ b/zh/rum/sdk/harmony/data-collection.mdx @@ -107,9 +107,9 @@ Action 事件包含 `action.id`、`action.type`、`action.target.name` 和 `acti Resource 表示网络请求。SDK 会在以下场景生成 resource: -- 使用 `rcp` session 并添加 `FlashcatTrace.interceptor()` -- 使用 `FlashcatHttp.request()` 包装 `@kit.NetworkKit` 请求 -- 通过 `GlobalRumMonitor.get().startResource()` 和 `stopResource()` 手动记录 +- 使用 `rcp` session 并添加 `FlashcatTrace.interceptor()`,需要启用 `setTrackNetworkRequests(true)` +- 使用 `FlashcatHttp.request()` 包装 `@kit.NetworkKit` 请求,需要启用 `setTrackNetworkRequests(true)` +- 通过 `GlobalRumMonitor.get().startResource()` 和 `stopResource()` 手动记录,不受该开关影响 ```ts import { diff --git a/zh/rum/sdk/harmony/sdk-integration.mdx b/zh/rum/sdk/harmony/sdk-integration.mdx index 77a066d..6ae2484 100644 --- a/zh/rum/sdk/harmony/sdk-integration.mdx +++ b/zh/rum/sdk/harmony/sdk-integration.mdx @@ -160,7 +160,11 @@ monitor.stopAction(RumActionType.SCROLL, 'product_feed'); ## 采集网络请求和 Trace -HarmonyOS SDK 提供两种网络接入方式。 +HarmonyOS SDK 提供两种网络接入方式。两者都只有在 RUM 配置中启用 `setTrackNetworkRequests(true)` 后才会生成 resource 事件,该开关默认关闭。 + + +SDK 不会自动挂钩 `@kit.NetworkKit` 的 `http.createHttp()`。直接用它发起的请求不会被采集,请改用下面两种接入方式之一,或使用[手动 resource API](/zh/rum/sdk/harmony/data-collection#resource-事件)。 + ### rcp 拦截器