Skip to content

oripwk/micrometer-kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kotlin for Micrometer

Apache License Maven Central Download

Kotlin support for micrometer.io.

Install

repositories {
    mavenCentral() // jcenter()
}
dependencies {
    implementation group: 'com.oripwk', name: 'micrometer-kotlin', version: '0.1'
    // OR
    implementation group: 'com.oripwk', name: 'micrometer-kotlin', version: '0.1.kotlin12'
}

Easily create timers that can receive suspend functions

val meterRegistry = SimpleMeterRegistry()
val myTimer = meterRegistry.coTimer("my-timer")

val result: Int = myTimer.record {
    GlobalScope.async { 42 }.await()
}

Comprehensive Timer building support

The API is fully compatible with Timer.builder(…) API, leveraging Kotlin's default parameters constructor:

Timer
    .builder("my-timer")
    .coTimer(
        meterRegistry = SimpleMeterRegistry(),
        tags = listOf(Tag.of("env", "dev")),
        maximumExpectedValue = Duration.ofSeconds(1)
        //
    )

About

Kotlin support for micrometer.io

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages