mirror of
https://github.com/mii443/prometheus-android-exporter.git
synced 2025-08-22 15:15:35 +00:00
serialization of work data
This commit is contained in:
1
client/.idea/misc.xml
generated
1
client/.idea/misc.xml
generated
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
|
@ -81,6 +81,8 @@ dependencies {
|
||||
// custom - yaml configuration parsing
|
||||
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.1")
|
||||
implementation("com.charleskorn.kaml:kaml:0.54.0")
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1'
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@ import com.charleskorn.kaml.Yaml
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import java.io.File
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.decodeFromString
|
||||
|
||||
private const val TAG : String = "CONFIGURATION"
|
||||
|
||||
@ -53,6 +55,8 @@ data class RemoteWriteConfigFile(
|
||||
val scrape_interval : Int?,
|
||||
val remote_write_endpoint : String?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PromConfiguration(
|
||||
// the following are default values for various configuration settings
|
||||
val prometheusServerEnabled : Boolean = true,
|
||||
@ -104,6 +108,9 @@ data class PromConfiguration(
|
||||
remoteWriteScrapeInterval = data.getInt("6", defaultRemoteWriteScrapeInterval),
|
||||
remoteWriteEndpoint = data.getString("7") ?: "",
|
||||
)
|
||||
|
||||
// val data : String? = data.getString("json")
|
||||
// return Json.decodeFromString<PromConfiguration>()
|
||||
}
|
||||
|
||||
suspend fun loadFromConfigFile(context : Context): PromConfiguration {
|
||||
|
Reference in New Issue
Block a user