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

Commit

Permalink
Remove local vs remote host selected metric (#4922)
Browse files Browse the repository at this point in the history
* remove local vs remote metric

* Add generated changelog entries

* remove unused imports
  • Loading branch information
Jolyon-S authored Jul 29, 2020
1 parent 73d464f commit df92086
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
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;
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

0 comments on commit df92086

Please sign in to comment.