Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #6866][FOLLOWUP] Prevent register gauge conflicts if both thrift binary SSL and thrift http SSL enabled #6872

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class MetricsSystem extends CompositeService("MetricsSystem") {
meter.mark(value)
}

def getGauge[T](name: String): Option[Gauge[T]] = {
Option(registry.gauge(name))
}

def registerGauge[T](name: String, value: => T, default: T): Unit = {
registry.register(
MetricRegistry.name(name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ object SSLUtils extends Logging {
keyStorePath.get,
keyStorePassword.get,
keyStoreType).foreach { expiration =>
info(s"Thrift SSL Serve KeyStore ${keyStorePath.get} will expire at:" +
info(s"Thrift SSL Server KeyStore ${keyStorePath.get} will expire at:" +
s" ${Utils.getDateFromTimestamp(expiration)}")
MetricsSystem.tracing { ms =>
ms.registerGauge(
MetricsConstants.THRIFT_SSL_CERT_EXPIRATION,
expiration - System.currentTimeMillis(),
0L)
if (ms.getGauge(MetricsConstants.THRIFT_SSL_CERT_EXPIRATION).isEmpty) {
ms.registerGauge(
MetricsConstants.THRIFT_SSL_CERT_EXPIRATION,
expiration - System.currentTimeMillis(),
0L)
}
}
}
}
Expand Down
Loading