anti-social / prometheus-kt

Prometheus for Kotlin
Apache License 2.0
8 stars 3 forks source link

Fit for use on Android? #11

Open gcleaves opened 2 years ago

gcleaves commented 2 years ago

Hi. Is this fit for use on Android?

My goal is to expose some basic battery/temperature/memory metrics from multiple Android devices. The devices will be on a Wireguard VPN so that they can be reached and scraped.

bhargavms commented 2 years ago

I dont think its possible to use this on android, as it expects your android client to expose metrics like below

import dev.evo.prometheus.ktor.metricsModule

import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty

suspend fun main(args: Array<String>) {
    val metricsApp = embeddedServer(
        Netty,
        port = 9090,
        module = {
            metricsModule(AppMetrics)
        }
    )
            .start(wait = false)

    // Start processing
    startProcessing()

    metricsApp.stop(1000, 2000)
}
gcleaves commented 2 years ago

I'm not (yet) an Android developer but I assumed that the Netty endpoint would be accesible on the WiFi interface.

On Fri, 16 Sept 2022, 08:26 Bhargav Mogra, @.***> wrote:

I dont think its possible to use this on android, as it expects your android client to expose metrics like below

import dev.evo.prometheus.ktor.metricsModule import io.ktor.server.engine.embeddedServerimport io.ktor.server.netty.Netty suspend fun main(args: Array) { val metricsApp = embeddedServer( Netty, port = 9090, module = { metricsModule(AppMetrics) } ) .start(wait = false)

// Start processing
startProcessing()

metricsApp.stop(1000, 2000)

}

— Reply to this email directly, view it on GitHub https://github.com/anti-social/prometheus-kt/issues/11#issuecomment-1248967054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH6GZJ5M26T2YMP4PL4BO3V6QHJ3ANCNFSM56IKWEEQ . You are receiving this because you authored the thread.Message ID: @.***>