Skip to content

Commit

Permalink
feat: added prometheus host in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubxity committed Jul 24, 2021
1 parent d7be70e commit a04a87b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import dev.cubxity.plugins.metrics.api.metric.MetricsDriver
import dev.cubxity.plugins.metrics.prometheus.config.PrometheusConfig
import io.prometheus.client.CollectorRegistry
import io.prometheus.client.exporter.HTTPServer
import java.net.InetAddress
import java.net.InetSocketAddress

class PrometheusMetricsDriver(api: UnifiedMetrics, private val config: PrometheusConfig) : MetricsDriver {
Expand All @@ -33,7 +34,7 @@ class PrometheusMetricsDriver(api: UnifiedMetrics, private val config: Prometheu
}

override fun initialize() {
server = HTTPServer(InetSocketAddress(config.http.port), registry)
server = HTTPServer(InetSocketAddress(InetAddress.getByName(config.http.host), config.http.port), registry)
}

override fun close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ data class PrometheusConfig(

@Serializable
data class PrometheusHttpConfig(
val host: String = "0.0.0.0",
val port: Int = 9100
)

0 comments on commit a04a87b

Please sign in to comment.