-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
replace servo with spectator in the client #1523
Conversation
69dd733
to
291ad28
Compare
@@ -67,6 +69,7 @@ public class TimeConsumingInstanceRegistryTest extends AbstractTester { | |||
* Note that there is a thread retrieving and printing out registry status for debugging purpose. | |||
*/ | |||
@Test | |||
@Ignore("NumOfRenewsPerMinThreshold should be updated to 256") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was already failing in the master branch
@@ -27,6 +27,8 @@ dependencies { | |||
compile project(':eureka-client') | |||
compile 'org.glassfish.jersey.core:jersey-client:2.23.1' | |||
compile 'org.glassfish.jersey.connectors:jersey-apache-connector:2.23.1' | |||
compile "org.slf4j:slf4j-api:1.7.36" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slf4j apparently pulled in transitively via servo
@@ -27,6 +27,8 @@ dependencies { | |||
compile project(':eureka-client') | |||
compile 'org.glassfish.jersey.core:jersey-client:2.23.1' | |||
compile 'org.glassfish.jersey.connectors:jersey-apache-connector:2.23.1' | |||
compile "org.slf4j:slf4j-api:1.7.36" | |||
compile 'com.netflix.spectator:spectator-api:1.7.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it also use ${spectatorVersion}
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this sub project didn't adopt the version substitution like the others 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May just need to use double quotes
} catch (Exception e) { | ||
s_logger.error("Unable to register with servo.", e); | ||
} | ||
final CompositeRegistry registry = Spectator.globalRegistry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to just use the base Registry
type for instrumentation. It makes it easier to swap out which implementation is used later if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, this was my IDE autocompleting the type, will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
final CompositeRegistry registry = globalRegistry(); | ||
PolledMeter.using(registry) | ||
.withName(METRIC_REGISTRY_PREFIX + "lastSuccessfulRegistryFetchTimePeriod") | ||
.monitorValue(getLastSuccessfulRegistryFetchTimePeriodInternal()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As written it would just report the initial value. The method that takes a Number
is meant for things like AtomicInteger
that would get updated over time. Unfortunately though, primitive types are implicitly cast so this compiles. Pass in the lambda so it can be invoked each time to get the updated value. For example:
.monitorValue(this, DiscoveryClient::getLastSuccessfulRegistryFetchTimePeriodInternal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch. I was going to ping you to see if I managed to convert the monitors correctly, will make this change 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
if (config.shouldRegisterWithEureka()) { | ||
this.heartbeatStalenessMonitor = new ThresholdLevelsMetric(this, METRIC_REGISTRATION_PREFIX + "lastHeartbeatSec_", new long[]{15L, 30L, 60L, 120L, 240L, 480L}); | ||
} else { | ||
this.heartbeatStalenessMonitor = ThresholdLevelsMetric.NO_OP_METRIC; | ||
} | ||
PolledMeter.using(registry) | ||
.withName(METRIC_REGISTRATION_PREFIX + "lastSuccessfulHeartbeatTimePeriod") | ||
.monitorValue(getLastSuccessfulHeartbeatTimePeriodInternal()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
@@ -387,6 +395,9 @@ public synchronized BackupRegistry get() { | |||
initTimestampMs = System.currentTimeMillis(); | |||
initRegistrySize = this.getApplications().size(); | |||
registrySize = initRegistrySize; | |||
PolledMeter.using(registry) | |||
.withName(METRIC_REGISTRY_PREFIX + "localRegistrySize") | |||
.monitorValue(registrySize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
final CompositeRegistry registry = Spectator.globalRegistry(); | ||
PolledMeter.using(registry) | ||
.withName(METRIC_RESOLVER_PREFIX + "lastLoadTimestamp") | ||
.monitorValue(getLastLoadTimestamp()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
Monitors.registerObject(name, this); | ||
PolledMeter.using(registry) | ||
.withName(METRIC_RESOLVER_PREFIX + "endpointsSize") | ||
.monitorValue(getEndpointsSize()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
} | ||
PolledMeter.using(Spectator.globalRegistry()) | ||
.withName(METRIC_RESOLVER_PREFIX + "lastReloadTimestamp") | ||
.monitorValue(getLastReloadTimestamp()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
Monitors.registerObject(name, this); | ||
PolledMeter.using(Spectator.globalRegistry()) | ||
.withName(METRIC_TRANSPORT_PREFIX + "currentSessionDuration") | ||
.monitorValue(getCurrentSessionDuration()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note on using lambda
} | ||
final CompositeRegistry registry = Spectator.globalRegistry(); | ||
executionTimeStats = registry.timer("Eureka-Connection-Cleaner-Time"); | ||
cleanupFailed = registry.counter("Eureka-Connection-Cleaner-Failure"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
@@ -27,6 +27,8 @@ dependencies { | |||
compile project(':eureka-client') | |||
compile 'org.glassfish.jersey.core:jersey-client:2.23.1' | |||
compile 'org.glassfish.jersey.connectors:jersey-apache-connector:2.23.1' | |||
compile "org.slf4j:slf4j-api:1.7.36" | |||
compile 'com.netflix.spectator:spectator-api:1.7.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May just need to use double quotes
No description provided.