Skip to content

AndroidTracer.Builder

Xavier F. Gouchet edited this page Sep 4, 2024 · 1 revision

class Builder

Builds a AndroidTracer instance.

Constructors

Builder

@JvmOverloads

constructor(sdkCore: SdkCore = Datadog.getInstance())

Parameters
sdkCore SDK instance to bind to. If not provided, default instance will be used.

Functions

addGlobalTag

fun addGlobalTag(key: String, value: String): AndroidTracer.Builder


Deprecated

addGlobalTag is deprecated, please use addTag instead

Replace with
addTag

Adds a global tag which will be appended to all spans created with the built tracer.

Parameters
key the tag key
value the tag value

addTag

fun addTag(key: String, value: String): AndroidTracer.Builder

Adds a global tag which will be appended to all spans created with the built tracer.

Parameters
key the tag key
value the tag value

build

fun build(): AndroidTracer

Builds a AndroidTracer based on the current state of this Builder.

setBundleWithRumEnabled

fun setBundleWithRumEnabled(enabled: Boolean): AndroidTracer.Builder

Enables the trace bundling with the current active View. If this feature is enabled all the spans from this moment on will be bundled with the current view information and you will be able to see all the traces sent during a specific view in the Rum Explorer.

Parameters
enabled true by default

setPartialFlushThreshold

fun setPartialFlushThreshold(threshold: Int): AndroidTracer.Builder

Sets the partial flush threshold. When this threshold is reached (you have a specific amount of spans closed waiting) the flush mechanism will be triggered and all the pending closed spans will be processed in order to be sent to the intake.

Parameters
threshold the threshold value (default = 5)

setSampleRate

fun setSampleRate(@FloatRange(from = 0.0, to = 100.0)sampleRate: Double): AndroidTracer.Builder

Sets the sample rate of spans.

Parameters
sampleRate the sample rate as a percentage between 0 and 100 (default is 100%)

setService

fun setService(service: String): AndroidTracer.Builder

Sets the service name that will appear in your traces.

Parameters
service the service name (default = application package name)

setTracingHeaderTypes

fun setTracingHeaderTypes(headerTypes: Set<TracingHeaderType>): AndroidTracer.Builder

Sets the tracing header styles that may be injected by this tracer.

Parameters
headerTypes the list of header types injected (default = datadog style headers)
Clone this wiki locally