Skip to content

Commit a96fe3b

Browse files
dlmarionDomGarguiloddanielrkeith-turnerctubbsii
authored
Foundation for new Monitor server and UI (apache#5012)
Created the initial foundation for a new Monitor implementation for Accumulo 4.0. This change includes a new Thrift RPC endpoint in the ServerProcess thrift service. The new endpoint returns a MetricResponse object which contains information about the server and a set of Micrometer Meters serialized as Google Flatbuffers. The new Monitor implementation contains a class that periodically calls this Thrift RPC method on all the server processes. The new Monitor implementation makes this information, and other specific information that it gathers available via a new JAX-RS API (see the Endpoints class). Co-authored-by: Dom G. <domgarguilo@apache.org> Co-authored-by: Daniel Roberts ddanielr <ddanielr@gmail.com> Co-authored-by: Keith Turner <kturner@apache.org> Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
1 parent 3213646 commit a96fe3b

File tree

56 files changed

+7106
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7106
-265
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
#
1919

2020
core/src/main/thrift-gen-java/** linguist-generated=true
21+
core/src/main/flatbuffers-gen-java/** linguist-generated=true

assemble/pom.xml

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
<artifactId>jackson-databind</artifactId>
5757
<optional>true</optional>
5858
</dependency>
59+
<dependency>
60+
<groupId>com.fasterxml.jackson.datatype</groupId>
61+
<artifactId>jackson-datatype-jdk8</artifactId>
62+
<optional>true</optional>
63+
</dependency>
5964
<dependency>
6065
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
6166
<artifactId>jackson-jakarta-rs-base</artifactId>
@@ -81,6 +86,11 @@
8186
<artifactId>gson</artifactId>
8287
<optional>true</optional>
8388
</dependency>
89+
<dependency>
90+
<groupId>com.google.flatbuffers</groupId>
91+
<artifactId>flatbuffers-java</artifactId>
92+
<optional>true</optional>
93+
</dependency>
8494
<dependency>
8595
<groupId>com.google.guava</groupId>
8696
<artifactId>failureaccess</artifactId>

core/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<groupId>com.google.code.gson</groupId>
5252
<artifactId>gson</artifactId>
5353
</dependency>
54+
<dependency>
55+
<groupId>com.google.flatbuffers</groupId>
56+
<artifactId>flatbuffers-java</artifactId>
57+
</dependency>
5458
<dependency>
5559
<groupId>com.google.guava</groupId>
5660
<artifactId>guava</artifactId>

core/src/main/flatbuffers-gen-java/org/apache/accumulo/core/metrics/flatbuffers/FMetric.java

+103
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/main/flatbuffers-gen-java/org/apache/accumulo/core/metrics/flatbuffers/FTag.java

+79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/main/flatbuffers/metric.fbs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
* https://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
namespace org.apache.accumulo.core.metrics.flatbuffers;
20+
21+
table FTag {
22+
key:string;
23+
value:string;
24+
}
25+
26+
table FMetric {
27+
name:string;
28+
type:string;
29+
tags:[FTag];
30+
dvalue:double;
31+
ivalue:int;
32+
lvalue:long;
33+
}
34+
35+
root_type FMetric;

core/src/main/java/org/apache/accumulo/core/conf/Property.java

+6
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,12 @@ public enum Property {
828828
+ " The resources that are used by default can be seen in"
829829
+ " `accumulo/server/monitor/src/main/resources/templates/default.ftl`.",
830830
"2.0.0"),
831+
MONITOR_FETCH_TIMEOUT("monitor.fetch.timeout", "5m", PropertyType.TIMEDURATION,
832+
"The Monitor fetches information for display in a set of background threads. This property"
833+
+ " controls the amount of time that process should wait before cancelling any remaining"
834+
+ " tasks to fetch information. These background threads could end up waiting on servers"
835+
+ " to respond or for scans to complete.",
836+
"4.0.0"),
831837
MONITOR_DEAD_LIST_RG_EXCLUSIONS("monitor.dead.server.rg.exclusions", "", PropertyType.STRING,
832838
"The Monitor displays information about servers that it believes have died recently."
833839
+ " This property accepts a comma separated list of resource group names. If"

core/src/main/java/org/apache/accumulo/core/metrics/MetricsInfo.java

+16-6
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,23 @@
2323
import java.util.Collections;
2424
import java.util.List;
2525
import java.util.Objects;
26+
import java.util.Set;
2627

2728
import com.google.common.net.HostAndPort;
2829

2930
import io.micrometer.core.instrument.Tag;
3031

3132
public interface MetricsInfo {
3233

34+
String INSTANCE_NAME_TAG_KEY = "instance.name";
35+
String PROCESS_NAME_TAG_KEY = "process.name";
36+
String RESOURCE_GROUP_TAG_KEY = "resource.group";
37+
String HOST_TAG_KEY = "host";
38+
String PORT_TAG_KEY = "port";
39+
40+
Set<String> allTags = Set.of(INSTANCE_NAME_TAG_KEY, PROCESS_NAME_TAG_KEY, RESOURCE_GROUP_TAG_KEY,
41+
HOST_TAG_KEY, PORT_TAG_KEY);
42+
3343
/**
3444
* Convenience method to create tag name / value pair for the instance name
3545
*
@@ -38,7 +48,7 @@ public interface MetricsInfo {
3848
static Tag instanceNameTag(final String instanceName) {
3949
Objects.requireNonNull(instanceName,
4050
"cannot create the tag without providing the instance name");
41-
return Tag.of("instance.name", instanceName);
51+
return Tag.of(INSTANCE_NAME_TAG_KEY, instanceName);
4252
}
4353

4454
/**
@@ -48,7 +58,7 @@ static Tag instanceNameTag(final String instanceName) {
4858
*/
4959
static Tag processTag(final String processName) {
5060
Objects.requireNonNull(processName, "cannot create the tag without providing the process name");
51-
return Tag.of("process.name", processName);
61+
return Tag.of(PROCESS_NAME_TAG_KEY, processName);
5262
}
5363

5464
/**
@@ -58,9 +68,9 @@ static Tag processTag(final String processName) {
5868
*/
5969
static Tag resourceGroupTag(final String resourceGroupName) {
6070
if (resourceGroupName == null || resourceGroupName.isEmpty()) {
61-
return Tag.of("resource.group", "NOT_PROVIDED");
71+
return Tag.of(RESOURCE_GROUP_TAG_KEY, "NOT_PROVIDED");
6272
}
63-
return Tag.of("resource.group", resourceGroupName);
73+
return Tag.of(RESOURCE_GROUP_TAG_KEY, resourceGroupName);
6474
}
6575

6676
/**
@@ -72,10 +82,10 @@ static Tag resourceGroupTag(final String resourceGroupName) {
7282
static List<Tag> addressTags(final HostAndPort hostAndPort) {
7383
Objects.requireNonNull(hostAndPort, "cannot create the tag without providing the hostAndPort");
7484
List<Tag> tags = new ArrayList<>(2);
75-
tags.add(Tag.of("host", hostAndPort.getHost()));
85+
tags.add(Tag.of(HOST_TAG_KEY, hostAndPort.getHost()));
7686
int port = hostAndPort.getPort();
7787
if (port != 0) {
78-
tags.add(Tag.of("port", Integer.toString(hostAndPort.getPort())));
88+
tags.add(Tag.of(PORT_TAG_KEY, Integer.toString(hostAndPort.getPort())));
7989
}
8090
return Collections.unmodifiableList(tags);
8191
}

0 commit comments

Comments
 (0)