Skip to content

Commit

Permalink
check existing gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Jan 15, 2025
1 parent 32dce6f commit 039e7b5
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,17 @@ class MetricsSystemSuite extends KyuubiFunSuite {
}

test("metrics - get gauge") {
val testContextPath = "/prometheus-metrics"

val conf = KyuubiConf()
.set(MetricsConf.METRICS_ENABLED, true)
.set(MetricsConf.METRICS_REPORTERS, Set(ReporterType.PROMETHEUS.toString))
.set(MetricsConf.METRICS_PROMETHEUS_PORT, 0) // random port
.set(MetricsConf.METRICS_PROMETHEUS_PATH, testContextPath)
val conf = KyuubiConf().set(MetricsConf.METRICS_ENABLED, true)
val metricsSystem = new MetricsSystem()
metricsSystem.initialize(conf)
metricsSystem.start()

assert(metricsSystem.getGauge(MetricsConstants.THRIFT_SSL_CERT_EXPIRATION).isEmpty)
metricsSystem.registerGauge(
MetricsConstants.THRIFT_SSL_CERT_EXPIRATION,
() => System.currentTimeMillis(),
1000,
0)
assert(metricsSystem.getGauge(MetricsConstants.THRIFT_SSL_CERT_EXPIRATION).isDefined)
assert(metricsSystem.getGauge(MetricsConstants.THRIFT_SSL_CERT_EXPIRATION).get.getValue == 1000)

metricsSystem.stop()
}
Expand Down

0 comments on commit 039e7b5

Please sign in to comment.