Skip to content

Commit 6f26ff9

Browse files
committed
Automatically set monitoring property
1 parent 68f8139 commit 6f26ff9

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

src/main/kotlin/eu/openanalytics/shinyproxyoperator/impl/docker/DockerOrchestrator.kt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,16 @@ class DockerOrchestrator(channel: Channel<ShinyProxyEvent>,
485485
}
486486

487487
private fun generateConfig(shinyProxy: ShinyProxy, networkName: String): String {
488-
val config = hashMapOf(
489-
"spring" to hashMapOf<String, Any>(
488+
val config = buildMap {
489+
put("spring", hashMapOf<String, Any>(
490490
"data" to mapOf(
491491
"redis" to mapOf(
492492
"password" to redisConfig.getRedisPassword(),
493493
"host" to "sp-redis"
494494
)
495495
)
496-
),
497-
"proxy" to buildMap {
496+
))
497+
put("proxy", buildMap {
498498
put("docker", buildMap {
499499
put("default-container-network", networkName)
500500
if (monitoringConfig.isEnabled()) {
@@ -504,14 +504,27 @@ class DockerOrchestrator(channel: Channel<ShinyProxyEvent>,
504504
put("template-path", "/opt/shinyproxy/templates")
505505
if (monitoringConfig.isEnabled()) {
506506
put("monitoring", mapOf("grafana-url" to monitoringConfig.grafanaConfig.getGrafanaUrl(shinyProxy)))
507+
put("log-as-json", "true")
508+
put("usage-stats-url", "micrometer")
507509
}
508-
},
509-
"logging" to buildMap {
510+
})
511+
put("logging", buildMap {
510512
put("file", buildMap {
511513
put("name", "/opt/shinyproxy/logs/shinyproxy.log")
512514
})
515+
})
516+
if (monitoringConfig.isEnabled()) {
517+
put("management", buildMap {
518+
put("prometheus", buildMap {
519+
put("metrics", buildMap {
520+
put("export", buildMap {
521+
put("enabled", true)
522+
})
523+
})
524+
})
525+
})
513526
}
514-
)
527+
}
515528
return objectMapper.writeValueAsString(config)
516529
}
517530

0 commit comments

Comments
 (0)