OpenTelemetryConfigAPI

Properties

Link copied to clipboard

Indicates whether OpenTelemetry resources should be shut down when the agent closes.

Link copied to clipboard
abstract val isVerbose: Boolean

Indicates whether verbose telemetry data is enabled.

Link copied to clipboard
abstract val serviceName: String

The service name reported in resource attributes.

Link copied to clipboard
abstract val serviceNamespace: String?

The service namespace reported in resource attributes, or null if not set.

Link copied to clipboard
abstract val serviceVersion: String

The service version reported in resource attributes.

Link copied to clipboard
abstract val tracer: Tracer

The Kotlin Multiplatform OpenTelemetry SDK Tracer used by the feature.

Functions

Link copied to clipboard
abstract fun addResourceAttributes(attributes: Map<String, Any>)

Adds resource attributes reported alongside every exported span.

Link copied to clipboard
abstract fun addSpanAdapter(adapter: SpanAdapter)

Installs a SpanAdapter that post-processes every GenAI span. Replaces any previously installed adapter.

Link copied to clipboard
abstract fun addSpanExporter(exporter: SpanExporter)

Registers exporter wrapped in a batchSpanProcessor - the OTel-recommended default for production deployments. Spans are buffered and flushed on a worker so the agent never blocks on network I/O at the span end.

Link copied to clipboard
abstract fun addSpanProcessor(factory: TraceExportConfigDsl.() -> SpanProcessor)

Registers a SpanProcessor produced by a factory invoked inside the SDK's TraceExportConfigDsl scope. Use this when the convenience addSpanExporter (which always wraps in batchSpanProcessor) doesn't fit - e.g., custom batching parameters, custom processor implementations, or a compositeSpanProcessor over several inner processors.

Link copied to clipboard
abstract fun setSdk(openTelemetry: OpenTelemetry)

Injects a pre-built Kotlin OpenTelemetry SDK to use for tracing.

Link copied to clipboard
abstract fun setServiceInfo(serviceName: String, serviceVersion: String, serviceNamespace: String? = null)

Sets the service information reported in resource attributes.

Link copied to clipboard
abstract fun setShutdownOnAgentClose(shutdownOnAgentClose: Boolean)

Toggles whether OpenTelemetryPlatform.shutdown runs when the agent closes. See isShutdownOnAgentClose.

Link copied to clipboard
abstract fun setVerbose(verbose: Boolean)

Toggles verbose telemetry capture. See isVerbose.