-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encapsulate jmx interactions in a proxy class
This allows us to hide the logic behind connecting to JMX and better handle the sidecar mode. Notably, it will hide the choices between connecting directly through JMX, getting info from the backend or using an async request/response pattern. JMX communication changes for the sidecar mode I added a set of accessible datacenters that are useful to determine if a node is accessible from a Reaper instance in EACH mode notably. The set is populated during the JMX connection initialization phase where we try to connect to all nodes. The active compactions are now polled and stored into the backend every 10 seconds so they can be retrieved from any reaper in sidecar mode. add a guava cache inside `EndpointSnitchInfoProxy.getDataCenter(host)` as it's a static and low-cardinality lookup
- Loading branch information
1 parent
d001c47
commit f6c451b
Showing
42 changed files
with
1,887 additions
and
820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
src/server/src/main/java/io/cassandrareaper/core/GenericMetric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
/* | ||
* | ||
* Copyright 2019-2019 The Last Pickle Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.cassandrareaper.core; | ||
|
||
import org.joda.time.DateTime; | ||
|
||
public final class GenericMetric { | ||
|
||
private final String clusterName; | ||
private final String metricDomain; | ||
private final String metricType; | ||
private final String metricScope; | ||
private final String metricName; | ||
private final String metricAttribute; | ||
private final String host; | ||
private final DateTime ts; | ||
private final double value; | ||
|
||
private GenericMetric(Builder builder) { | ||
this.clusterName = builder.clusterName; | ||
this.metricDomain = builder.metricDomain; | ||
this.metricType = builder.metricType; | ||
this.metricScope = builder.metricScope; | ||
this.metricName = builder.metricName; | ||
this.metricAttribute = builder.metricAttribute; | ||
this.host = builder.host; | ||
this.ts = builder.ts; | ||
this.value = builder.value; | ||
} | ||
|
||
public String getClusterName() { | ||
return clusterName; | ||
} | ||
|
||
public String getMetricDomain() { | ||
return metricDomain; | ||
} | ||
|
||
public String getMetricType() { | ||
return metricType; | ||
} | ||
|
||
public String getMetricScope() { | ||
return metricScope; | ||
} | ||
|
||
public String getMetricName() { | ||
return metricName; | ||
} | ||
|
||
public String getMetricAttribute() { | ||
return metricAttribute; | ||
} | ||
|
||
public String getMetricFullId() { | ||
return metricDomain + ":type=" + metricType + ",scope=" + metricScope + ",name=" + metricName; | ||
} | ||
|
||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public DateTime getTs() { | ||
return ts; | ||
} | ||
|
||
public double getValue() { | ||
return value; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static final class Builder { | ||
private String clusterName; | ||
private String metricDomain; | ||
private String metricType; | ||
private String metricScope; | ||
private String metricName; | ||
private String metricAttribute; | ||
private String host; | ||
private DateTime ts; | ||
private double value; | ||
|
||
private Builder() {} | ||
|
||
public Builder withClusterName(String clusterName) { | ||
this.clusterName = clusterName; | ||
return this; | ||
} | ||
|
||
public Builder withMetricDomain(String metricDomain) { | ||
this.metricDomain = metricDomain; | ||
return this; | ||
} | ||
|
||
public Builder withMetricType(String metricType) { | ||
this.metricType = metricType; | ||
return this; | ||
} | ||
|
||
public Builder withMetricScope(String metricScope) { | ||
this.metricScope = metricScope == null ? " " : metricScope; | ||
return this; | ||
} | ||
|
||
public Builder withMetricName(String metricName) { | ||
this.metricName = metricName; | ||
return this; | ||
} | ||
|
||
public Builder withMetricAttribute(String metricAttribute) { | ||
this.metricAttribute = metricAttribute; | ||
return this; | ||
} | ||
|
||
public Builder withHost(String host) { | ||
this.host = host; | ||
return this; | ||
} | ||
|
||
public Builder withTs(DateTime ts) { | ||
this.ts = ts; | ||
return this; | ||
} | ||
|
||
public Builder withValue(double value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public GenericMetric build() { | ||
return new GenericMetric(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.