Package 

Class RumInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    
    public final class RumInterceptor
    extends DatadogInterceptor
                        

    Provides automatic RUM integration for OkHttpClient by way of the Interceptor system.

    This interceptor will log the request as a RUM Resource, and fill the request information (url, method, status code, optional error). Note that RUM Resources are only tracked when a view is active. You can use one of the existing ViewTrackingStrategy when configuring the SDK (see Configuration.Builder.useViewTrackingStrategy) or start a view manually (see RumMonitor.startView).

    If you use multiple Interceptors, make sure that this one is called first. If you also want to trace network request, use the DatadogInterceptor instead, which combines the RUM and APM integrations.

    To use:

    OkHttpClient client = new OkHttpClient.Builder()
        .addInterceptor(new RumInterceptor())
        .build();
    • Method Summary

      Modifier and Type Method Description
      • Methods inherited from class com.datadog.android.rum.RumInterceptor

        intercept
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RumInterceptor

        RumInterceptor(List<String> firstPartyHosts, RumResourceAttributesProvider rumResourceAttributesProvider, Float traceSamplingRate)
        Parameters:
        firstPartyHosts - the list of first party hosts.
        rumResourceAttributesProvider - which listens on the intercepted okhttp3.Request and offers the possibility to add custom attributes to the RUM resource events.
        traceSamplingRate - the sampling rate for APM traces created for auto-instrumented requests.