Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Monitor server implementation #5012

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
759d177
wip on #4973
dlmarion Oct 18, 2024
d9ad2a7
Got MetricsThriftRpcIT working
dlmarion Oct 22, 2024
72df86f
Wired up new monitor endpoint
dlmarion Oct 23, 2024
f01a636
Remove unused depedency
dlmarion Oct 23, 2024
d10d850
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Oct 24, 2024
7cf7d96
Made port static at 43331, added TLS like old monitor and test
dlmarion Oct 24, 2024
0543a48
Added endpoint for reporting problem hosts
dlmarion Oct 24, 2024
411f074
Added compactions, fetch delay
dlmarion Oct 25, 2024
d83f100
Fix formatting
dlmarion Oct 28, 2024
7b4cf01
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Oct 28, 2024
37be192
Fixed missing import
dlmarion Oct 28, 2024
6b24815
Add logging
dlmarion Oct 28, 2024
78f7367
Formatting
dlmarion Oct 28, 2024
8b90edf
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Oct 29, 2024
9b3c10a
Refactored metrics collection, added new paths, needs testing
dlmarion Oct 29, 2024
25ff6c5
Changes from refactoring and testing
dlmarion Oct 30, 2024
156a0be
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Nov 4, 2024
8918cf4
Return 404 on unknown resource group, empty object when known but no …
dlmarion Nov 5, 2024
1ef5083
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Nov 6, 2024
de0afb0
Map exception to http error code
dlmarion Nov 6, 2024
4cef91d
Added /metrics/tables and /metrics/tables/{name} endpoints
dlmarion Nov 7, 2024
9ea2f35
Moved compactions code, added /metrics/deployment
dlmarion Nov 7, 2024
4d3dfa0
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Nov 9, 2024
e7b1bb3
Initial commit of React frontend (#48)
DomGarguilo Nov 9, 2024
c9f2c37
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Nov 12, 2024
11978f1
Prevent NPEs
dlmarion Nov 12, 2024
0c8fc3d
Only process meters from one registry, removes duplicate meters
dlmarion Nov 13, 2024
da8a488
Fix metric aggregation
dlmarion Nov 13, 2024
77e27d5
Merge branch 'main' into 4973-new-monitor-metrics
dlmarion Nov 14, 2024
91ef9dd
Removed custom GC server type
dlmarion Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions assemble/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
<artifactId>jackson-databind</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-base</artifactId>
Expand All @@ -81,6 +86,11 @@
<artifactId>gson</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>failureaccess</artifactId>
Expand Down Expand Up @@ -121,6 +131,11 @@
<artifactId>commons-logging</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-commons</artifactId>
Expand Down Expand Up @@ -343,6 +358,36 @@
<artifactId>jetty-util</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-core-common</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-core-server</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jetty-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jetty-common</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jetty-server</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-servlet</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
Expand Down Expand Up @@ -468,6 +513,21 @@
<artifactId>jboss-logging</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
Expand Down
35 changes: 35 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -412,6 +416,37 @@
</plugins>
</build>
<profiles>
<profile>
<id>flatbuffers</id>
<build>
<plugins>
<plugin>
<groupId>com.sequsoft.maven.plugins</groupId>
<artifactId>flatbuffers-maven-plugin</artifactId>
Comment on lines +424 to +425
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty low-quality Maven plugin that hasn't been touched in 4 years. It doesn't publish generated maven plugin documentation to know what to configure, and it installs software (and compiles it) into the user's home directory, instead of following Maven best practices to use the target directory (or at least /tmp).

I am reluctant to buy in to using this plugin for these reasons, and am wondering if the goal of the plugin could be done with flatc on the command-line like we do with thrift, or if it could be achieved without using flatbuffers at all.

Also, why not just use Thrift for the internal type? It seems unnecessary to bring in another library that is essentially serving the same purpose, especially since you're also adding generated thrift types that do serialization in the same PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I'm using Flatbuffers vs Thrift is for the reason I mentioned in my initial comment - memory and time efficiency. IIRC, and I'm on my phone so I can't easily check, Thrift fully deserializes the the binary sent over the wire. Flatbuffers does not, it deserializes what you need when you need it. Deserializing all of the metrics from the servers would create a lot of objects which may potentially go unused if nobody is using the UI.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably right about how thrift deserializes. It's a safe assumption that if you've made an RPC call, you want to make use of the response, so that's probably what thrift does.

We've also used JSON in many places, which has similar benefits. I wonder what the difference in performance would be if we just used Gson or Jackson to handle the serialization of the objects, rather than introduce another dependency and workflow into the build. It'd be nice to be somewhat consistent with how we do serialization, and it would be nice to avoid the complexity of another IDL build workflow and dependency, especially if the plugin that makes the workflow easier isn't well maintained.

The way the monitor currently avoids unnecessary work is by only pulling stuff from the Manager when needed to serve content to a user request. It rate limits the frequency of the pulling to prevent excessive calls to the Manager. I don't know if it would eliminate the entire benefits of flatbuffers, but I'm thinking we should probably do the same here, because there's no reason for the monitor to constantly poll the whole cluster when nobody is querying any pages. If that alone is enough to eliminate the unnecessary deserialization when nobody's asking for it, then it might make things dramatically simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had mentioned the flatbuffers-maven-plugin in an earlier comment and I didn't address it. I have no issue with removing it and using the same mechanism that we use for generating the Thrift code. I added the plugin because it was the easiest way to solve the problem and continue moving forward on this idea.

<version>0.0.1</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version management should go in the parent POM's pluginManagement section.

<executions>
<execution>
<id>compile-flatbuffers</id>
<goals>
<goal>compile-flatbuffers</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<version>${version.flatbuffers}</version>
<sources>
<source>${basedir}/src/main/flatbuffers/metric.fbs</source>
</sources>
<generators>
<generator>all</generator>
</generators>
<destination>${basedir}/src/main/flatbuffers-gen-java</destination>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>thrift</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* https://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.
*/
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.accumulo.core.metrics.flatbuffers;

import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@SuppressWarnings("unused")
public final class FMetric extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
public static FMetric getRootAsFMetric(ByteBuffer _bb) { return getRootAsFMetric(_bb, new FMetric()); }
public static FMetric getRootAsFMetric(ByteBuffer _bb, FMetric obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public FMetric __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
public String type() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer typeAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
public ByteBuffer typeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
public org.apache.accumulo.core.metrics.flatbuffers.FTag tags(int j) { return tags(new org.apache.accumulo.core.metrics.flatbuffers.FTag(), j); }
public org.apache.accumulo.core.metrics.flatbuffers.FTag tags(org.apache.accumulo.core.metrics.flatbuffers.FTag obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
public int tagsLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
public org.apache.accumulo.core.metrics.flatbuffers.FTag.Vector tagsVector() { return tagsVector(new org.apache.accumulo.core.metrics.flatbuffers.FTag.Vector()); }
public org.apache.accumulo.core.metrics.flatbuffers.FTag.Vector tagsVector(org.apache.accumulo.core.metrics.flatbuffers.FTag.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
public double dvalue() { int o = __offset(10); return o != 0 ? bb.getDouble(o + bb_pos) : 0.0; }
public int ivalue() { int o = __offset(12); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public long lvalue() { int o = __offset(14); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }

public static int createFMetric(FlatBufferBuilder builder,
int nameOffset,
int typeOffset,
int tagsOffset,
double dvalue,
int ivalue,
long lvalue) {
builder.startTable(6);
FMetric.addLvalue(builder, lvalue);
FMetric.addDvalue(builder, dvalue);
FMetric.addIvalue(builder, ivalue);
FMetric.addTags(builder, tagsOffset);
FMetric.addType(builder, typeOffset);
FMetric.addName(builder, nameOffset);
return FMetric.endFMetric(builder);
}

public static void startFMetric(FlatBufferBuilder builder) { builder.startTable(6); }
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); }
public static void addType(FlatBufferBuilder builder, int typeOffset) { builder.addOffset(1, typeOffset, 0); }
public static void addTags(FlatBufferBuilder builder, int tagsOffset) { builder.addOffset(2, tagsOffset, 0); }
public static int createTagsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
public static void startTagsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addDvalue(FlatBufferBuilder builder, double dvalue) { builder.addDouble(3, dvalue, 0.0); }
public static void addIvalue(FlatBufferBuilder builder, int ivalue) { builder.addInt(4, ivalue, 0); }
public static void addLvalue(FlatBufferBuilder builder, long lvalue) { builder.addLong(5, lvalue, 0L); }
public static int endFMetric(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}
public static void finishFMetricBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
public static void finishSizePrefixedFMetricBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public FMetric get(int j) { return get(new FMetric(), j); }
public FMetric get(FMetric obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* https://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.
*/
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.accumulo.core.metrics.flatbuffers;

import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@SuppressWarnings("unused")
public final class FTag extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
public static FTag getRootAsFTag(ByteBuffer _bb) { return getRootAsFTag(_bb, new FTag()); }
public static FTag getRootAsFTag(ByteBuffer _bb, FTag obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public FTag __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

public String key() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer keyAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
public ByteBuffer keyInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
public String value() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer valueAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
public ByteBuffer valueInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }

public static int createFTag(FlatBufferBuilder builder,
int keyOffset,
int valueOffset) {
builder.startTable(2);
FTag.addValue(builder, valueOffset);
FTag.addKey(builder, keyOffset);
return FTag.endFTag(builder);
}

public static void startFTag(FlatBufferBuilder builder) { builder.startTable(2); }
public static void addKey(FlatBufferBuilder builder, int keyOffset) { builder.addOffset(0, keyOffset, 0); }
public static void addValue(FlatBufferBuilder builder, int valueOffset) { builder.addOffset(1, valueOffset, 0); }
public static int endFTag(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public FTag get(int j) { return get(new FTag(), j); }
public FTag get(FTag obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

35 changes: 35 additions & 0 deletions core/src/main/flatbuffers/metric.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* https://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.
*/
namespace org.apache.accumulo.core.metrics.flatbuffers;

table FTag {
key:string;
value:string;
}

table FMetric {
name:string;
type:string;
tags:[FTag];
dvalue:double;
ivalue:int;
lvalue:long;
}

root_type FMetric;
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @since 4.0.0
*/
public final class ServerId implements Comparable<ServerId> {
public class ServerId implements Comparable<ServerId> {

/**
* Server process type names.
Expand Down
Loading