OpenTelemetryConfig

Configuration class for OpenTelemetry integration.

Provides seamless integration with the OpenTelemetry SDK, allowing initialization and customization of various components such as the tracer, meter, exporters, etc.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Indicates whether verbose telemetry data is enabled.

Link copied to clipboard
val sdk: OpenTelemetrySdk

Provides an instance of the OpenTelemetrySdk.

Link copied to clipboard

The name of the service associated with this OpenTelemetry configuration.

Link copied to clipboard

The version of the service used in the OpenTelemetry configuration.

Link copied to clipboard
val tracer: Tracer

Provides access to the Tracer instance for tracking and recording tracing data.

Functions

Link copied to clipboard
Link copied to clipboard
fun <T : Any> addResourceAttributes(attributes: Map<AttributeKey<T>, T>)

Adds resource attributes to the OpenTelemetry configuration. Resource attributes are key-value pairs that provide metadata describing the entity producing telemetry data.

Link copied to clipboard
fun addSpanExporter(exporter: SpanExporter)

Adds a SpanExporter to the OpenTelemetry configuration. This exporter will be used to export spans collected during the application's execution.

Link copied to clipboard
fun addSpanProcessor(processor: (SpanExporter) -> SpanProcessor)

Adds a SpanProcessor creator function to the OpenTelemetry configuration.

Link copied to clipboard
fun setSampler(sampler: Sampler)

Sets the sampler to be used by the OpenTelemetry configuration. The sampler determines which spans are sampled and exported during application execution.

Link copied to clipboard
fun setServiceInfo(serviceName: String, serviceVersion: String)

Sets the service information for the OpenTelemetry configuration. This information is used to identify the service in telemetry data.

Link copied to clipboard
fun setVerbose(verbose: Boolean)

Controls whether verbose telemetry data should be captured during application execution. When set to true, the application collects more detailed telemetry data. This option can be useful for debugging and fine-grained monitoring but may impact performance.