-
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.
Add support for collecting metrics on a node
This commit adds all the necessary bits to expose REST endpoints to retrieve tpstats, dropped messages and client requests metrics for a specific node.
- Loading branch information
1 parent
13732fb
commit 438ed51
Showing
14 changed files
with
1,413 additions
and
0 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
112 changes: 112 additions & 0 deletions
112
src/server/src/main/java/io/cassandrareaper/core/DroppedMessages.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,112 @@ | ||
/* | ||
* 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 com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; | ||
|
||
@JsonDeserialize(builder = DroppedMessages.Builder.class) | ||
public final class DroppedMessages { | ||
private final String name; | ||
private final Integer count; | ||
private final Double oneMinuteRate; | ||
private final Double fiveMinuteRate; | ||
private final Double fifteenMinuteRate; | ||
private final Double meanRate; | ||
|
||
private DroppedMessages(Builder builder) { | ||
this.name = builder.name; | ||
this.count = builder.count; | ||
this.oneMinuteRate = builder.oneMinuteRate; | ||
this.fiveMinuteRate = builder.fiveMinuteRate; | ||
this.fifteenMinuteRate = builder.fifteenMinuteRate; | ||
this.meanRate = builder.meanRate; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Integer getCount() { | ||
return count; | ||
} | ||
|
||
public Double getOneMinuteRate() { | ||
return oneMinuteRate; | ||
} | ||
|
||
public Double getFiveMinuteRate() { | ||
return fiveMinuteRate; | ||
} | ||
|
||
public Double getFifteenMinuteRate() { | ||
return fifteenMinuteRate; | ||
} | ||
|
||
public Double getMeanRate() { | ||
return meanRate; | ||
} | ||
|
||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with") | ||
public static final class Builder { | ||
private String name; | ||
private Integer count; | ||
private Double oneMinuteRate; | ||
private Double fiveMinuteRate; | ||
private Double fifteenMinuteRate; | ||
private Double meanRate; | ||
|
||
private Builder() {} | ||
|
||
public Builder withName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public Builder withCount(Integer count) { | ||
this.count = count; | ||
return this; | ||
} | ||
|
||
public Builder withOneMinuteRate(Double oneMinuteRate) { | ||
this.oneMinuteRate = oneMinuteRate; | ||
return this; | ||
} | ||
|
||
public Builder withFiveMinuteRate(Double fiveMinuteRate) { | ||
this.fiveMinuteRate = fiveMinuteRate; | ||
return this; | ||
} | ||
|
||
public Builder withFifteenMinuteRate(Double fifteenMinuteRate) { | ||
this.fifteenMinuteRate = fifteenMinuteRate; | ||
return this; | ||
} | ||
|
||
public Builder withMeanRate(Double meanRate) { | ||
this.meanRate = meanRate; | ||
return this; | ||
} | ||
|
||
public DroppedMessages build() { | ||
return new DroppedMessages(this); | ||
} | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
src/server/src/main/java/io/cassandrareaper/core/JmxStat.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,93 @@ | ||
/* | ||
* 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 com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; | ||
|
||
@JsonDeserialize(builder = JmxStat.Builder.class) | ||
public final class JmxStat { | ||
private final String scope; | ||
private final String name; | ||
private final String attribute; | ||
private final Double value; | ||
|
||
private JmxStat(Builder builder) { | ||
this.scope = builder.scope; | ||
this.name = builder.name; | ||
this.attribute = builder.attribute; | ||
this.value = builder.value; | ||
} | ||
|
||
public String getScope() { | ||
return scope; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getAttribute() { | ||
return attribute; | ||
} | ||
|
||
public Double getValue() { | ||
return value; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return scope + "/" + name + "/" + attribute + " = " + value; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with") | ||
public static final class Builder { | ||
private String scope; | ||
private String name; | ||
private String attribute; | ||
private Double value; | ||
|
||
private Builder() {} | ||
|
||
public Builder withScope(String scope) { | ||
this.scope = scope; | ||
return this; | ||
} | ||
|
||
public Builder withName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public Builder withAttribute(String attribute) { | ||
this.attribute = attribute; | ||
return this; | ||
} | ||
|
||
public Builder withValue(Double value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public JmxStat build() { | ||
return new JmxStat(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.