Trace Configuration¶
Trace Initialization Configuration¶
FTUnityBridge.InitTraceConfig(new TraceConfig
{
sampleRate = 0.9f,
traceType = TraceType.DDTrace,
enableNativeAutoTrace = true,
enableLinkRumData = true
});
| Field | Type | Required | Description |
|---|---|---|---|
| sampleRate | float | No | Sampling rate, value range [0,1]. 0 means no collection, 1 means full collection. Default value is 1. |
| traceType | string | No | Trace type: ddTrace (default), zipkinMultiHeader, zipkinSingleHeader, traceparent, skywalking, jaeger. |
| enableLinkRUMData | boolean | No | Whether to link with RUM data. Default is false. |
| enableNativeAutoTrace | boolean | No | Whether to enable native network auto-tracing for iOS NSURLSession and Android OKHttp. Default is false. Not supported for Android cloud builds. After enabling on iOS, network requests initiated by system APIs can be automatically traced. Please disable manual trace on iOS to prevent incorrect linking between traces and RUM data. |
Tracer Network Trace¶
Traces are implemented by generating Trace Headers and adding them to HTTP request headers.
Usage¶
/// <summary>
/// Get trace Id.
/// </summary>
/// <param name="url">url address</param>
/// <returns>json string</returns>
public static async Task<string> GetTraceHeaderWithUrl(string url)
/// <summary>
/// Get trace.
/// </summary>
/// <param name="resourceId">resource Id</param>
/// <param name="url">url address</param>
/// <returns>json string</returns>
public static async Task<string> GetTraceHeader(string resourceId, string url)