Manual Integration¶
Integrating the SDK Without Using ft-plugin¶
Guance uses Android Gradle Plugin Transformation for code injection to enable automatic data collection. However, due to compatibility issues, ft-plugin or ft-plugin-legacy may not be available in some cases. The affected scope includes:
- RUM
ActionandResource android.util.Log- Automatic capture of Java and Kotlin
printlnconsole logs - Automatic symbol file upload
Currently, for such cases, a manual integration approach can be used.
Application Startup Event¶
Source code example reference DemoForManualSet.kt.
Manually Adding User Actions¶
Events such as button clicks need to be added manually at the trigger point. Here, a Button onClick event is used as an example. Source code example reference ManualActivity.kt:
Manually Integrating OkHttp Resource / Trace¶
OkHttp can be used to integrate Resource and Trace via addInterceptor and eventListener. Example below, source code example reference ManualActivity.kt:
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.addInterceptor(new FTTraceInterceptor())
.addInterceptor(new FTResourceInterceptor())
.eventListenerFactory(new FTResourceEventListener.FTFactory());
//.eventListenerFactory(new FTResourceEventListener.FTFactory(true));
OkHttpClient client = builder.build();
Other network frameworks need to implement FTRUMGlobalManager.startResource, stopResource, addResource, and FTTraceManager.getTraceHeader themselves. See the source code example ManualActivity.kt for detailed implementation.
Manually Integrating OkHttp WebSocket Resource¶
When ft-sdk >= 1.7.5 and the ft-plugin that supports automatic WebSocket instrumentation is not used, the OkHttp WebSocket handshake Resource can be explicitly collected via FTWebSocket. First, enable FTRUMConfig.setEnableTraceUserResource(true). Existing Resource URL filtering and RUM sampling rules still apply. Collection only covers successful handshake, server rejection, or failure; connection duration is not tracked, and message content is not collected.
For a small number of call sites, FTWebSocket.newWebSocket() can be used directly:
If the project provides a WebSocket factory uniformly via dependency injection, wrap it once and inject a WebSocket.Factory:
wrap() supports repeated calls. Even if ft-plugin >= 1.3.8 is also enabled, the same request will only be collected once for the handshake Resource. If a third-party library holds an OkHttpClient internally and neither exposes the newWebSocket() call site nor allows passing in a WebSocket.Factory, the ft-plugin automatic instrumentation must still be used.