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

replace servo with spectator #1526

Merged
merged 1 commit into from
May 31, 2024
Merged

replace servo with spectator #1526

merged 1 commit into from
May 31, 2024

Conversation

joshgord
Copy link
Contributor

@joshgord joshgord commented Jan 5, 2024

This is a port of this PR to the 2.x branch #1523

In general when trivial I changed direct usages of guava with their replacements. I did leave guava in the eureka-core project because we'll have to reimplement some caches.

@@ -87,11 +86,11 @@ private EurekaMonitors(String name, String description) {
}
}

@com.netflix.servo.annotations.Monitor(name = "count", type = DataSourceType.COUNTER)
Copy link
Contributor Author

@joshgord joshgord Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a curiously named metric "count", is there something that gets added with the servo Monitor that allows us to disambiguate such a generically named id @brharrington?

Looks like there is a className dimension for a Monitor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, should I add this dimension to the metrics? Will there be any gotchas about emitting that dimension manually?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better compatibility with the previous data it would be good to add it explicitly. There shouldn't be any issues with adding it directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will go ahead and do that to attempt to avoid any external changes in the metrics. Thanks @brharrington

.withPublishStdDev(true)
.build();
final MonitorConfig config = MonitorConfig.builder(METRIC_REPLICATION_PREFIX + "batchSize").build();
this.batchSizeMetric = new StatsTimer(config, statsConfig);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to do with StatsTimer and the docs just say it's "not supported". Seems like PercentileTimer is a decent replacement

https://netflix.github.io/atlas-docs/spectator/lang/java/servo-migration/#statstimer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If percentiles are really needed, then PercentileTimer or PercentileDistributionSummary would need to be used. Either way, it wouldn't be fully backwards compatible, so the user may need to tune their queries.

I'm not sure sure how this metric is used. The name is batchSize which doesn't seem like it would be measuring time, so PercentileDistributionSummary may be more appropriate. It was using a timer though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this one to a PercentileDistributionSummary but left another one as percentiletimer but noted that something is going to break if people are using this metric

@drobertduke drobertduke self-requested a review January 5, 2024 19:59
@@ -10,7 +10,8 @@ dependencies {
api "com.amazonaws:aws-java-sdk-route53:${awsVersion}"
api "jakarta.servlet:jakarta.servlet-api:${servletVersion}"
api 'jakarta.inject:jakarta.inject-api:2.0.1'
api 'com.thoughtworks.xstream:xstream:1.4.19'
api 'com.thoughtworks.xstream:xstream:1.4.20'
implementation 'com.google.guava:guava:33.0.0-jre'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this PR is about servo->spectator I'm leaving the guava dependency in place (but updating to the latest version), I can follow up with another PR that will replace the guava usages

api "com.netflix.servo:servo-core:${servoVersion}"
api "com.netflix.spectator:spectator-api:${spectatorVersion}"
api "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "com.netflix.netflix-commons:netflix-eventbus:0.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netflix-commons is also legacy stuff that brings in dependencies that can be problematic, e.g. servlet-api.

Copy link
Contributor Author

@joshgord joshgord Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like an issue with the cherry pick from my old commit, this is already present in the build.gradle, I agree netflix-common is not ideal but for now we'll leave that for future pull request 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it from api->implementation which should help a little bit for now

@@ -87,11 +86,11 @@ private EurekaMonitors(String name, String description) {
}
}

@com.netflix.servo.annotations.Monitor(name = "count", type = DataSourceType.COUNTER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.withPublishStdDev(true)
.build();
final MonitorConfig config = MonitorConfig.builder(METRIC_REPLICATION_PREFIX + "batchSize").build();
this.batchSizeMetric = new StatsTimer(config, statsConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If percentiles are really needed, then PercentileTimer or PercentileDistributionSummary would need to be used. Either way, it wouldn't be fully backwards compatible, so the user may need to tune their queries.

I'm not sure sure how this metric is used. The name is batchSize which doesn't seem like it would be measuring time, so PercentileDistributionSummary may be more appropriate. It was using a timer though.

@joshgord joshgord force-pushed the josh/guava2x branch 3 times, most recently from 9dd4af4 to 8517b46 Compare January 6, 2024 01:08

private ServoUtil() {
}
public static <T> T monitoredValue(@Nonnull String name, @Nonnull T obj,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this helper value that adds the class dimension to the metric by default

@joshgord joshgord force-pushed the josh/guava2x branch 3 times, most recently from 59c157c to 3a4d9f9 Compare January 6, 2024 05:00
@cancecen cancecen merged commit 9b3df32 into 2.x May 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants