Package-level declarations

Types

Link copied to clipboard
class OpenTelemetryObserver(openTelemetry: OpenTelemetry = GlobalOpenTelemetry.get(), recordContent: Boolean = false, maxContentLength: Int = ConversationAttributes.DEFAULT_MAX_LENGTH) : ConversationObserver

Sends the runs of a graph to OpenTelemetry as traces. Give it to a run with GraphConfig.observers:

Link copied to clipboard
class OtlpExportException(message: String, cause: Throwable? = null) : TelarException

Spans could not be sent to the collector of an OtlpObserver: it could not be reached, or it did not accept them. The run they belong to is not affected.

Link copied to clipboard
class OtlpObserver(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 = {}) : ConversationObserver

Sends the runs of a graph as traces to an OpenTelemetry collector, or to any backend that receives OTLP over HTTP, on every platform: Android, iOS, desktop, servers and the browser. Give it to a run with GraphConfig.observers:

Link copied to clipboard
class TraceContext(val traceId: String, val spanId: String) : AbstractCoroutineContextElement

The ids of a span in the coroutine context. An OtlpObserver puts one in the context of each node, with the span of the node. Read it with currentCoroutineContext()[TraceContext], for example to log the trace id next to a message, or let the Traceparent plugin send it with each request.

Properties

Link copied to clipboard
val Traceparent: ClientPlugin<Unit>

A plugin of Ktor's HttpClient that sends the traceparent header with each request made inside a node traced by an OtlpObserver, so that the server records its spans inside the span of the node. A request outside a traced node, or with a traceparent of its own, is sent as it is.