OtlpObserver

constructor(client: HttpClient, scope: CoroutineScope, endpoint: String = DEFAULT_ENDPOINT, serviceName: String = DEFAULT_SERVICE_NAME, resource: Map<String, String> = emptyMap(), headers: Map<String, String> = emptyMap(), exportDelay: Duration = 1.seconds, recordContent: Boolean = false, maxContentLength: Int = ConversationAttributes.DEFAULT_MAX_LENGTH, onExportFailed: (OtlpExportException) -> Unit = {})

Parameters

client

sends the spans. Its engine decides the platform: Js in the browser, Darwin on iOS, OkHttp on Android, CIO or Java on the JVM.

scope

the coroutines that send the spans run in it. Cancel it, and nothing more is sent except by flush.

endpoint

the URL of the traces, /v1/traces of the collector. The default is a collector on the same machine.

serviceName

the service.name of the spans, the name a backend shows for the app.

resource

more attributes of the app, such as service.version or deployment.environment.

headers

sent with each request, for example the key of a backend that receives OTLP itself.

exportDelay

how long a span that ended waits for others before they are sent together.

recordContent

records the messages of each model call and the input and result of each tool call. Off by default, because they can hold personal data.

maxContentLength

the most characters of each text that recordContent records.

onExportFailed

told when spans could not be sent. It must not throw.