Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Remove local vs remote host selected metric #4922

Merged
merged 4 commits into from
Jul 29, 2020
Merged
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 @@ -36,8 +36,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.codahale.metrics.Counter;
import com.codahale.metrics.MetricRegistry;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableRangeMap;
Expand All @@ -63,7 +61,6 @@
import com.palantir.common.base.Throwables;
import com.palantir.logsafe.SafeArg;
import com.palantir.logsafe.exceptions.SafeIllegalStateException;
import com.palantir.tritium.metrics.registry.MetricName;

public class CassandraService implements AutoCloseable {
// TODO(tboam): keep logging on old class?
Expand All @@ -82,9 +79,6 @@ public class CassandraService implements AutoCloseable {
private volatile Set<InetSocketAddress> localHosts = ImmutableSet.of();
private final Supplier<Optional<HostLocation>> myLocationSupplier;

private final Counter randomHostsSelected;
private final Counter localHostsSelected;

private final Random random = new Random();

public CassandraService(
Expand All @@ -93,10 +87,6 @@ public CassandraService(
Blacklist blacklist,
CassandraClientPoolMetrics poolMetrics) {
this.metricsManager = metricsManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if instead you could do @jeremyk-91 's filtering? So filter when this is 1, but publish when it's not?

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'm removing it more because I don't think I have ever used it after the initial rollout. So even if we filter it, would it be used in debugging?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've seen it go down and slowly recover before. But I think you might be right, there might not be any in keeping the complexity here

this.randomHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder()
.safeName(MetricRegistry.name(CassandraService.class, "randomHostsSelected")).build());
this.localHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder()
.safeName(MetricRegistry.name(CassandraService.class, "localHostsSelected")).build());
this.config = config;
this.myLocationSupplier = new HostLocationSupplier(this::getSnitch, config.overrideHostLocation());
this.blacklist = blacklist;
Expand Down Expand Up @@ -297,12 +287,10 @@ Set<InetSocketAddress> maybeFilterLocalHosts(Set<InetSocketAddress> hosts) {
if (random.nextDouble() < config.localHostWeighting()) {
Set<InetSocketAddress> localFilteredHosts = Sets.intersection(localHosts, hosts);
if (!localFilteredHosts.isEmpty()) {
localHostsSelected.inc();
return localFilteredHosts;
}
}

randomHostsSelected.inc();
return hosts;
}

Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-4922.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Remove local and remote host metrics.
links:
- https://github.com/palantir/atlasdb/pull/4922