-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29289: Make hbase master ui show cluster client connections info #8058
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /* | ||
| * 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 | ||
| * | ||
| * 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 org.apache.hadoop.hbase.ipc; | ||
|
|
||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
||
| /** | ||
| * Holds information about a client connection including IP address, username, client version, and | ||
| * service name. | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public class ClientConnectionInfo { | ||
| private final String hostAddress; | ||
| private final int port; | ||
| private final String userName; | ||
| private final String clientVersion; | ||
| private final String serviceName; | ||
|
|
||
| private ClientConnectionInfo(Builder builder) { | ||
| this.hostAddress = builder.hostAddress; | ||
| this.port = builder.port; | ||
| this.userName = builder.userName; | ||
| this.clientVersion = builder.clientVersion; | ||
| this.serviceName = builder.serviceName; | ||
| } | ||
|
|
||
| public String getHostAddress() { | ||
| return hostAddress; | ||
| } | ||
|
|
||
| public String getUserName() { | ||
| return userName; | ||
| } | ||
|
|
||
| public String getClientVersion() { | ||
| return clientVersion; | ||
| } | ||
|
|
||
| public String getServiceName() { | ||
| return serviceName; | ||
| } | ||
|
|
||
| public String getClientId() { | ||
| return hostAddress + ":" + port; | ||
| } | ||
|
|
||
| public String getClientPort() { | ||
| return String.valueOf(port); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "ClientConnectionInfo{" + "hostAddress='" + hostAddress + '\'' + ", port='" + port + '\'' | ||
| + ", userName='" + userName + '\'' + ", clientVersion='" + clientVersion + '\'' | ||
| + ", serviceName='" + serviceName + '\'' + '}'; | ||
| } | ||
|
|
||
| public static class Builder { | ||
| private String hostAddress; | ||
| private int port; | ||
| private String userName; | ||
| private String clientVersion; | ||
| private String serviceName; | ||
|
|
||
| public Builder hostAddress(String hostAddress) { | ||
| this.hostAddress = hostAddress; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder port(int port) { | ||
| this.port = port; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder userName(String userName) { | ||
| this.userName = userName; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder clientVersion(String clientVersion) { | ||
| this.clientVersion = clientVersion; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder serviceName(String serviceName) { | ||
| this.serviceName = serviceName; | ||
| return this; | ||
| } | ||
|
|
||
| public ClientConnectionInfo build() { | ||
| return new ClientConnectionInfo(this); | ||
| } | ||
| } | ||
|
|
||
| public static Builder newBuilder() { | ||
| return new Builder(); | ||
| } | ||
| } |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another reason to try integrate this into the already existing client metrics: MetricsUserAggregateImpl already provides its own maps and tracking mechanisms, which would dismiss the need for changes in the rpc layer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @wchevreuil for the comments, Let me go through the existing implementation and try to use that for this purpose. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * 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 | ||
| * | ||
| * 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 org.apache.hadoop.hbase.ipc; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
||
| /** | ||
| * Registry for tracking active client connections to the RPC server. Maintains a thread-safe map of | ||
| * client connection information. | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public class ClientConnectionRegistry { | ||
|
|
||
| private final ConcurrentHashMap<String, ClientConnectionInfo> clientConnections; | ||
|
|
||
| public ClientConnectionRegistry() { | ||
| this.clientConnections = new ConcurrentHashMap<>(); | ||
| } | ||
|
|
||
| public void registerClientConnection(ClientConnectionInfo connectionInfo) { | ||
| clientConnections.put(connectionInfo.getClientId(), connectionInfo); | ||
| } | ||
|
|
||
| public void unregisterClientConnection(String clientId) { | ||
| clientConnections.remove(clientId); | ||
| } | ||
|
|
||
| public Collection<ClientConnectionInfo> getClientConnections() { | ||
| return clientConnections.values(); | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a ClientMetrics object defined in ClusterStatus.proto, which is used by the hbtop tool to provide some client related information. I think we should add these there and reuse that object on this UI, while also update hbtop to report the additional information.