Troubleshooting¶
SDK Initialization Error Validation¶
.NET / C# Configuration Validation¶
GuanceSdk.Init() immediately validates key configuration:
| Error Message | Action |
|---|---|
RumAppId is required. |
Set the application ID created in the console. |
ServiceName is required. |
Set a non-empty ServiceName. |
Version is required. |
Set the application version. |
Env must be one of... |
Use prod, gray, pre, common, or local. |
Either DatawayUrl or DatakitUrl is required. |
Set at least one upload endpoint. |
ClientToken is required when DatawayUrl is configured. |
Add the Client Token for public DataWay mode. |
SampleRate must be between 0 and 1. |
Adjust the sample rate to 0.0–1.0. |
Native C/C++ Initialization or Loading Failure¶
- Confirm that your application, import library, and
guance_windows_native.dlluse the same architecture. The current vcpkg port only provides a dynamicx64-windowsbuild; for other architectures, use a build from source with the matching architecture. - Ensure the DLL is in the application directory or in the Windows DLL search path. The x86, x64, and ARM64 Native runtime assets in the NuGet package are for the .NET wrapper layer and are not equivalent to C/C++ headers and import libraries.
- Call
guance_sdk_config_init()first, then fill in the endpoint, Token, application ID, service name, version, and environment. - For public DataWay, provide the endpoint and Client Token; for a local deployment (Datakit), provide an accessible Datakit endpoint.
- If
guance_sdk_init()returns a null Handle, check required fields, cache directory permissions, and process architecture.
SDK Running Normally but No Data¶
No RUM Data in the Console¶
Check the following in order:
- Whether the App ID matches the "Custom" application in the current workspace.
- Whether the public DataWay has both the correct base endpoint and Client Token.
- Whether the local deployment (Datakit) is accessible from the application process and the RUM collector is enabled.
- Whether the RUM
SampleRateorsample_rateis greater than0. - Whether a View has been started or the corresponding automatic collection has been enabled.
- Whether the application waits for or calls the shutdown API before exiting.
var snapshot = GuanceSdk.GetDiagnosticsSnapshot();
Console.WriteLine(
$"sampled={snapshot.SessionSampled}, " +
$"enqueued={snapshot.RumEventsEnqueued}, " +
$"uploaded={snapshot.RumUploadSuccessCount}, " +
$"retry={snapshot.RumUploadRetryCount}, " +
$"terminal={snapshot.RumUploadTerminalFailureCount}, " +
$"lastStatus={snapshot.LastRumUploadStatusCode}, " +
$"lastError={snapshot.LastRumUploadError}");
guance_sdk_diagnostics diagnostics{};
if (guance_sdk_get_diagnostics(rum, &diagnostics)) {
printf("queued=%lld uploaded=%lld retries=%lld status=%lld error=%lld\n",
static_cast<long long>(diagnostics.rum_events_enqueued),
static_cast<long long>(diagnostics.rum_upload_success_count),
static_cast<long long>(diagnostics.rum_upload_retry_count),
static_cast<long long>(diagnostics.last_rum_upload_status_code),
static_cast<long long>(diagnostics.last_rum_upload_error_code));
}
When the enqueue count is 0, first check sampling, View, and collection switches; when retries keep increasing, check network, proxy, DNS, and upload endpoint; when terminal failures increase, check Token, permissions, and server-side status codes.
No View or Action in the Desktop UI¶
WPF and WinForms¶
- Call
EnableAutomaticInstrumentation()before the first window is created. - Confirm that
EnableWpforEnableWinFormsis not disabled. - Set stable
Name, title, or accessibility name for key controls. - Dynamic WinForms controls are scanned during Application Idle; if the message loop is not idle for a long time, discovery may be delayed.
WinUI 3¶
WinUI 3 windows must be explicitly associated before Activate(). For multi-window applications, associate each window individually:
window = new MainWindow().UseGuanceRum("MainWindow");
// or GuanceSdk.AttachWinUIWindow(window, "MainWindow");
window.Activate();
Native C/C++¶
- Call
guance_rum_start_view()after the window is created, andguance_rum_stop_view()before the window is closed. - Actions must be explicitly started and ended at command, menu, or input message handling boundaries.
- The UI Watchdog requires a valid top-level
HWNDowned by the current process. - The Native SDK does not install generic window or control hooks, so it will not automatically discover all MFC or custom framework events.
No Log Data¶
- Confirm that
GuanceConfig.Loggingis set andEnableCustomLog = true. - Check
SampleRate,LevelFilters, and whether the message exceeds the 30 KiB UTF-8 limit. System.Diagnostics.Traceoutput is not automatically forwarded by the SDK; explicitly callAddLog()orAddLogs()at your application's existing log output.- Read
GetLogDiagnosticsSnapshot()to check configuration, sampling, level, and capacity discard counts.
- Call
guance_log_config_init()first, thenguance_log_configure(). - Confirm
enable_custom_logis1, and checksample_rateandlevel_filter_mask. - The Native SDK does not automatically intercept Console, ETW, or third-party log libraries; call
guance_log_add()orguance_log_add_batch()at your existing log output. - Use
guance_log_get_diagnostics()to check enqueue, discard, retry, and last status code.
Log and RUM use independent queues. RUM running normally does not mean Log is enabled, and vice versa.
Requests Do Not Have Trace Headers¶
- Confirm that
EnableAutoTraceorenable_auto_traceis enabled. - Confirm the sample rate is not
0, and check that the target URL passesShouldTraceorshould_trace. - Check whether the propagation format required by the server matches
TraceTypeortrace_type. - The Trace Header is determined by the selected format; do not search only for an HTTP Header named
trace_id. - Do not propagate Trace Headers to untrusted targets.
Automatic diagnostic subscription requires AutomaticInstrumentationOptions.EnableHttpClient = true. Custom HttpClient pipelines can explicitly use GuanceSdk.CreateHttpMessageHandler().
WinHTTP requests need to use the guance_rum_winhttp.hpp adapter; other HTTP libraries need to call guance_trace_create_context() and write the returned Header into the request.
If the request already has a Trace Header with the same name, check whether the HTTP library or business code overwrites it after the SDK injects it.
Trace or Log Not Associated with RUM¶
- Enable
EnableLinkRumDataorenable_link_rum_datain the Trace/Log configuration respectively. - Initiate the request or write the Log while an active View or Action exists; the SDK does not retroactively modify contexts that have already ended.
- Trace association information is written into the matching RUM Resource. The Windows SDK does not upload APM Spans independently, so the absence of a Span in the Trace console does not mean Header injection failed.
No Page Data in WebView2¶
- Confirm that the WebView2 Runtime is installed and the control can complete
EnsureCoreWebView2Async(). - Confirm that
EnableWebView = true, or explicitly callAttachWebView(). - For dynamic controls, it is recommended to explicitly associate them after initialization is complete.
- After the control is
UnloadedorDisposed, reassociate it on the new instance. - Register a diagnostic listener and check for
WebView2 initialization failedordid not succeed.
Calling AttachWebView() repeatedly on the same control does not inject again. If the page itself also initializes Browser RUM, do not manually report the same page events again.
No Data in Electron¶
First determine which Electron integration method the application uses. The Session and upload owner differ between the two methods, so configurations cannot be mixed.
- Confirm that the GuanceCloud vcpkg registry is configured and that the
electron-bridgeFeature ofguance-windows-nativeis enabled in the manifest; currently only dynamicx64-windowsis supported. - In the development environment, check
vcpkg_installed/x64-windows/tools/guance-windows-native/; in the packaged environment, checkresources/native/. Both directories must contain bothguance_windows_electron_bridge.exeandguance_windows_native.dll. - When starting the Bridge, set
cwdto the directory containing the EXE and DLL, provide the full Native configuration, and check stdout for[Guance.RUM.NativeBridge] ready. Exit code2means a missing upload endpoint or RUM Application ID; exit code3means Native Core initialization or Log configuration failed. - Browser RUM/Logs are initialized only in the monitored Renderer; each window needs to install the Preload, register a trusted
webContents, and execute a minimal initialization. In the Renderer, fill in only the placeholder parameters required for Bridge mode – do not fill in the real Token, application ID, or upload endpoint. - In the Renderer DevTools Network, there should be no direct upload requests for RUM, Log, or Replay. Check whether the fixed IPC Channel receives messages, whether the Main Process accepts the trusted Renderer, and whether the Native Host stdin is writable.
- Check the Native Host's enqueue counts, upload status codes, retries, and terminal failure counts for RUM, Log, and Replay. Wait for
shutdown()to complete when the application exits to avoid losing queued data.
The Bridge cannot automatically capture Electron Main Process crashes. Renderer unresponsive and render-process-gone events should be listened to by the Main Process and converted into trusted Bridge commands. For the complete integration method, refer to Electron Monitoring.
- Browser RUM is initialized only in the Renderer; each independent Renderer page must be initialized.
- For
file://pages, setsessionPersistence: "local-storage". - The Main Process does not automatically pass the RUM instance to remote pages.
- Check the Browser RUM's
applicationId,site/datakitOrigin, Token, and sample rate. - This mode does not start the Windows Native Bridge. For the complete troubleshooting method, refer to Web RUM Electron Application Integration.
Duplicate Data¶
- Initialize the corresponding SDK Handle only once during application startup.
- In .NET, repeated calls to
GuanceSdk.Init()asynchronously release the old client; overlapping initialization boundaries may cause duplicate collection. - Do not manually report control interactions,
HttpClient, or WinHTTP requests that are already covered by automatic collection. - For WinUI 3, use only one association method per window.
- The Electron renderer should ensure the initialization entry point is executed only once.
Queued Data Remaining on Exit¶
Do not simply trigger an asynchronous shutdown and then immediately terminate the process. Native crash errors are recovered and enqueued on the next startup; no network upload occurs within the crashing process.
Enable Debug Logging¶
Set Debug = true or debug = 1 in a test environment. In C#, you can use GuanceSdk.AddDiagnosticListener() to record SDK-level details, source, and message. When submitting an issue, provide:
- SDK version, runtime or compiler version, and Windows version;
- UI framework, process architecture, and integration language;
- Redacted configuration;
- RUM and Log diagnostic counts and status codes;
- Minimal reproducible steps.
Do not submit Client Tokens, authentication headers, cookies, user-sensitive information, or local absolute paths.