Package 

Class TracingInterceptor.BaseBuilder

    • Method Summary

      Modifier and Type Method Description
      final R setSdkInstanceName(String sdkInstanceName) Set the SDK instance name to bind to, the default value is null.
      final R setTracedRequestListener(TracedRequestListener tracedRequestListener) Set the listener for automatically created AgentSpans.
      final R setTraceSampleRate(@FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float sampleRate) Set the trace sample rate controlling the sampling of APM traces created for auto-instrumented requests.
      final R setTraceSampler(Sampler<DatadogSpan> traceSampler) Set the trace sampler controlling the sampling of APM traces created for auto-instrumented requests.
      final R setTraceContextInjection(TraceContextInjection traceContextInjection) Set the trace context injection behavior for this interceptor in the intercepted requests.
      final R setTraceContextInjection(TraceContextInjection traceContextInjection) Deprecated.
      final R set404ResourcesRedacted(Boolean redacted) Set whether network requests returning a 404 status code should have their resource name redacted.
      abstract T build() Build the interceptor.
      • Methods inherited from class java.lang.Object

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

      • TracingInterceptor.BaseBuilder

        TracingInterceptor.BaseBuilder(Map<String, Set<TracingHeaderType>> tracedHostsWithHeaderType)
    • Method Detail

      • setSdkInstanceName

         final R setSdkInstanceName(String sdkInstanceName)

        Set the SDK instance name to bind to, the default value is null.

        Parameters:
        sdkInstanceName - SDK instance name to bind to, the default value is null.
      • setTracedRequestListener

         final R setTracedRequestListener(TracedRequestListener tracedRequestListener)

        Set the listener for automatically created AgentSpans.

        Parameters:
        tracedRequestListener - a listener for automatically created AgentSpans
      • setTraceSampleRate

         final R setTraceSampleRate(@FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float sampleRate)

        Set the trace sample rate controlling the sampling of APM traces created for auto-instrumented requests. If there is a parent trace attached to the network span created, then its sampling decision will be used instead.

        When used with com.datadog.android.okhttp.DatadogInterceptor, the effective trace sample rate is automatically combined with the active RUM session sample rate, ensuring the backend receives correct sampling metadata (_dd.agent_psr / _dd.rule_psr) for RUM-to-APM correlation.

        Parameters:
        sampleRate - the sample rate to use (percentage between 0f and 100f, default is 100f).
      • setTraceSampler

         final R setTraceSampler(Sampler<DatadogSpan> traceSampler)

        Set the trace sampler controlling the sampling of APM traces created for auto-instrumented requests. If there is a parent trace attached to the network span created, then its sampling decision will be used instead.

        Note: custom samplers passed here do not participate in cross-product rebasing with the RUM session sample rate. Subclasses of DeterministicTraceSampler are also treated as custom samplers and bypass rebasing — only an exact DeterministicTraceSampler instance (equivalent to calling setTraceSampleRate) participates in rebasing. Use setTraceSampleRate if you need correlated sampling between RUM sessions and APM traces.

        Parameters:
        traceSampler - the trace sampler controlling the sampling of APM traces.
      • setTraceContextInjection

         final R setTraceContextInjection(TraceContextInjection traceContextInjection)

        Set the trace context injection behavior for this interceptor in the intercepted requests. By default this is set to TraceContextInjection.SAMPLED, meaning that only the sampled request will propagate the trace context. In case of TraceContextInjection.ALL all the trace context will be propagated in the intercepted requests no matter if the span created around the request is sampled or not.

        Parameters:
        traceContextInjection - the trace context injection option.
      • setTraceContextInjection

         final R setTraceContextInjection(TraceContextInjection traceContextInjection)

        Deprecated. Use setTraceContextInjection(com.datadog.android.trace.TraceContextInjection) instead.

        Set the trace context injection behavior for this interceptor in the intercepted requests. By default this is set to TraceContextInjection.SAMPLED, meaning that only the sampled request will propagate the trace context. In case of TraceContextInjection.ALL all the trace context will be propagated in the intercepted requests no matter if the span created around the request is sampled or not.

        Parameters:
        traceContextInjection - the trace context injection option.
      • set404ResourcesRedacted

         final R set404ResourcesRedacted(Boolean redacted)

        Set whether network requests returning a 404 status code should have their resource name redacted. In order to reduce the cardinality of resource names in APM, 404 URLs are automatically redacted to "404".

        Parameters:
        redacted - if true, all 404 requests will have a resource name set to "404", else the resource name will be the URL
      • build

         abstract T build()

        Build the interceptor.