Skip to content

Commit b466ec8

Browse files
committed
Add Metrics to instance API
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-16136
1 parent 3d36cd1 commit b466ec8

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.0.7
2+
3+
CASSANDRA-16136: Add Metrics to instance API
4+
CASSANDRA-16272: Nodetool assert apis do not include the new stdout and stderr in the failure message
5+
16
# 0.0.6
27

38
CASSANDRA-16148: Add IInstance#getReleaseVersionString

src/main/java/org/apache/cassandra/distributed/api/IInstance.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.UUID;
2424
import java.util.concurrent.Future;
2525

26+
import org.apache.cassandra.distributed.shared.Metrics;
27+
2628
// The cross-version API requires that an Instance has a constructor signature of (IInstanceConfig, ClassLoader)
2729
public interface IInstance extends IIsolatedExecutor
2830
{
@@ -55,6 +57,8 @@ default Object[][] executeInternal(String query, Object... args)
5557

5658
int liveMemberCount();
5759

60+
Metrics metrics();
61+
5862
NodeToolResult nodetoolResult(boolean withNotifications, String... commandAndArgs);
5963

6064
default NodeToolResult nodetoolResult(String... commandAndArgs)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.cassandra.distributed.shared;
20+
21+
import java.util.List;
22+
import java.util.Map;
23+
import java.util.function.Predicate;
24+
25+
public interface Metrics
26+
{
27+
List<String> getNames();
28+
29+
long getCounter(String name);
30+
Map<String, Long> getCounters(Predicate<String> filter);
31+
32+
double getHistogram(String name, MetricValue value);
33+
Map<String, Double> getHistograms(Predicate<String> filter, MetricValue value);
34+
35+
Object getGauge(String name);
36+
Map<String, Object> getGauges(Predicate<String> filter);
37+
38+
double getMeter(String name, Rate value);
39+
Map<String, Double> getMeters(Predicate<String> filter, Rate value);
40+
41+
double getTimer(String name, MetricValue value);
42+
Map<String, Double> getTimers(Predicate<String> filter, MetricValue value);
43+
44+
enum MetricValue
45+
{
46+
COUNT,
47+
MEDIAN, P75, P95, P98, P99, P999,
48+
MAX, MEAN, MIN, STDDEV
49+
}
50+
51+
enum Rate
52+
{
53+
RATE15_MIN,
54+
RATE5_MIN,
55+
RATE1_MIN,
56+
RATE_MEAN
57+
}
58+
}

0 commit comments

Comments
 (0)