https://kotlinlang.org logo
#ktor
Title
# ktor
a

Alberto Quario

11/13/2020, 4:52 PM
Hi, I have added metrics to an application like this:
Copy code
install(MicrometerMetrics) {
        registry = DatadogMeterRegistry(config, Clock.SYSTEM)
        ...
    }
Would it be possible to access and reuse the same registry for adding custom metrics in handlers? Thanks!
d

David Hernando

11/13/2020, 4:59 PM
you need to instantiate the MeterRegistry outside the
install
statement and assign it
Copy code
val registry = DatadogMeterRegistry(config, Clock.SYSTEM)
install(MicrometerMetrics) {
        registry = registry
        ...
    }
// use it in a route
a

Alberto Quario

11/13/2020, 5:04 PM
Thanks @David Hernando!
🤟 1
5 Views