This commit is contained in:
Martin Ptáček
2023-05-29 15:57:17 +02:00
parent 09358bd9a5
commit 848a9dfd9a
9 changed files with 13 additions and 22 deletions

View File

@@ -9,18 +9,16 @@ import androidx.work.Data
import androidx.work.ExistingWorkPolicy import androidx.work.ExistingWorkPolicy
import androidx.work.NetworkType import androidx.work.NetworkType
import androidx.work.OneTimeWorkRequestBuilder import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.Operation
import androidx.work.OutOfQuotaPolicy import androidx.work.OutOfQuotaPolicy
import androidx.work.WorkManager import androidx.work.WorkManager
import io.prometheus.client.CollectorRegistry import com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker.PushProxConfig
import io.prometheus.client.exporter.common.TextFormat import com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker.PushProxWorker
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.io.StringWriter
enum class ConfigFileState { enum class ConfigFileState {
LOADING, LOADING,

View File

@@ -1,12 +1,8 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import android.util.Log import android.util.Log
import io.prometheus.client.Collector import io.prometheus.client.Collector
import io.prometheus.client.Collector.MetricFamilySamples
import io.prometheus.client.GaugeMetricFamily import io.prometheus.client.GaugeMetricFamily
import kotlinx.coroutines.runBlocking
import java.util.Arrays
import kotlinx.coroutines.*
private val TAG = "ANDROID_EXPORTER" private val TAG = "ANDROID_EXPORTER"

View File

@@ -1,4 +1,4 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import androidx.work.Data import androidx.work.Data
@@ -7,7 +7,7 @@ data class PushProxConfig(
val pushProxFqdn : String, val pushProxFqdn : String,
){ ){
companion object{ companion object{
fun fromData(data : Data) : PushProxConfig{ fun fromData(data : Data) : PushProxConfig {
return PushProxConfig( return PushProxConfig(
data.getString("0")!!, data.getString("0")!!,
data.getString("1")!!, data.getString("1")!!,

View File

@@ -1,4 +1,4 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent

View File

@@ -1,2 +1,2 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker

View File

@@ -1,4 +1,4 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import android.util.Log import android.util.Log
import io.ktor.server.application.call import io.ktor.server.application.call

View File

@@ -1,4 +1,4 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import android.util.Log import android.util.Log
import io.github.reugn.kotlin.backoff.StrategyBackoff import io.github.reugn.kotlin.backoff.StrategyBackoff
@@ -13,8 +13,6 @@ import io.ktor.http.HttpMethod
import io.prometheus.client.CollectorRegistry import io.prometheus.client.CollectorRegistry
import io.prometheus.client.Counter import io.prometheus.client.Counter
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
/** /**
* Counters for monitoring the pushprox itself, compatible with the reference * Counters for monitoring the pushprox itself, compatible with the reference

View File

@@ -1,17 +1,16 @@
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.worker
import android.app.NotificationManager import android.app.NotificationManager
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.work.CoroutineWorker import androidx.work.CoroutineWorker
import androidx.work.Data
import androidx.work.ForegroundInfo import androidx.work.ForegroundInfo
import androidx.work.WorkManager import androidx.work.WorkManager
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import com.birdthedeveloper.prometheus.android.prometheus.android.exporter.R
import io.prometheus.client.CollectorRegistry import io.prometheus.client.CollectorRegistry
import io.prometheus.client.exporter.common.TextFormat import io.prometheus.client.exporter.common.TextFormat
import kotlinx.coroutines.delay
import java.io.StringWriter import java.io.StringWriter
private val TAG = "PUSH_PROX_WORKER" private val TAG = "PUSH_PROX_WORKER"

View File

@@ -4,7 +4,7 @@ buildscript {
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.0.1' apply false id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.1' apply false id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
} }