I was in need of a kotlin multiplatform metrics fr...
# feed
j
I was in need of a kotlin multiplatform metrics framework, so I vibe coded one: https://github.com/jillesvangurp/multiplatform-metrics I'd take credit for this but this started with a brain fart in chat gpt that generated a pretty alright looking bit of code that escalated to a few iterations using codex. I did some brief research but there don't seem to be a lot of multiplatform metrics libraries currently. And vibe coding this definitely beats me spending a lot of time on this. Highlights • Simple metrics primitives: counters, timers, gauges, and summaries. • Kotlin-first API: idiomatic DSLs,
kotlin.time
integration, and minimal ceremony. • JVM support via Micrometer: seamlessly plugs into existing Micrometer
MeterRegistry
. A multiplatform SimpleMeterRegistry implementing the same
IMeterRegistry
is provided. So, easy to extend and adapt this. • Snapshots & exporting: emit Prometheus or OTLP-compatible snapshots from any platform. I have not tested this extensively yet but seems to work. • Multiplatform: works across JVM, JS, Native, iOS, Android, WASM, etc. That's it. Useful enough that people might want to use it or take it further. It might have some bugs but so far so good. I'm planning to use this to propagate client metrics in kotlin-js. I've instrumented my ktor client API client with this so I can measure all the API calls. And I've done some quick tests with exporting prometheus metrics for our integration tests. All seems to work. It also seems to be nice as a wrapper around micrometer when used on the JVM.
🙌 5
🎉 4
🙌🏾 1