All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kr.jadekim.jext.apm.es.exposed.DatadogApmDB.kt Maven / Gradle / Ivy

The newest version!
package kr.jadekim.jext.apm.es.exposed

import kr.jadekim.jext.exposed.CrudDB
import kr.jadekim.jext.exposed.ReadDB
import org.jetbrains.exposed.sql.Transaction

open class DatadogReadDB(
    private val delegate: ReadDB
) : ReadDB {

    override suspend fun  read(
        transactionIsolation: Int?,
        statement: suspend Transaction.() -> T
    ): T = delegate.read {
        installDatadogApmTracer()
        statement()
    }
}

open class DatadogCrudDB(
    private val delegate: CrudDB
) : CrudDB, DatadogReadDB(delegate) {

    override suspend fun  execute(
        transactionIsolation: Int?,
        statement: suspend Transaction.() -> T
    ): T = delegate.execute {
        installDatadogApmTracer()
        statement()
    }
}

fun ReadDB.tracingApm(): ReadDB = DatadogReadDB(this)

fun CrudDB.tracingApm(): CrudDB = DatadogCrudDB(this)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy