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

[Optimize]Jmx相关日志优化 #1082

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public class JmxConnectorWrap {
private JmxAuthConfig jmxConfig;

public JmxConnectorWrap(String clientLogIdent, Long brokerStartupTime, String jmxHost, Integer jmxPort, JmxAuthConfig jmxConfig) {
this.clientLogIdent=clientLogIdent;
LOGGER.info(
"method=JmxConnectorWrap||clientLogIdent={}||brokerStartupTime={}||jmxHost={}||jmxPort={}||jmxConfig={}||msg=start construct JmxWrap.",
clientLogIdent, brokerStartupTime, jmxHost, jmxPort, jmxConfig
);

this.clientLogIdent = clientLogIdent;
this.brokerStartupTime = brokerStartupTime;
this.jmxHost = jmxHost;
this.jmxPort = (jmxPort == null? JmxEnum.UNKNOWN.getPort() : jmxPort);
Expand Down Expand Up @@ -160,6 +165,11 @@ private synchronized boolean createJmxConnector() {
if (jmxConnector != null) {
return true;
}
LOGGER.info(
"method=createJmxConnector||clientLogIdent={}||brokerStartupTime={}||jmxHost={}||jmxPort={}||jmxConfig={}||msg=start create jmx connector.",
clientLogIdent, brokerStartupTime, jmxHost, jmxPort, jmxConfig
);

String jmxUrl = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", jmxHost, jmxPort);
try {
Map<String, Object> environment = new HashMap<String, Object>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ private JmxConnectorWrap createJmxConnectorWrap(ConnectCluster connectCluster, S
return jmxConnectorWrap;
}

log.debug("method=createJmxConnectorWrap||connectClusterId={}||workerId={}||msg=create JmxConnectorWrap starting", connectCluster.getId(), workerId);
log.info("method=createJmxConnectorWrap||connectClusterId={}||workerId={}||msg=create JmxConnectorWrap starting", connectCluster.getId(), workerId);

JmxConfig jmxConfig = ConvertUtil.str2ObjByJson(connectCluster.getJmxProperties(), JmxConfig.class);
if (jmxConfig == null) {
jmxConfig = new JmxConfig();
}


jmxConnectorWrap = new JmxConnectorWrap(
"connectClusterId: " + connectCluster.getId() + " workerId: " + workerId,
String.format("clusterPhyId=%s,workerId=%s", connectCluster.getId(), workerId),
null,
connectWorker.getHost(),
jmxConfig.getFinallyJmxPort(workerId, connectWorker.getJmxPort()),
Expand All @@ -97,12 +96,16 @@ private JmxConnectorWrap createJmxConnectorWrap(ConnectCluster connectCluster, S
Map<String, JmxConnectorWrap> workerMap = JMX_MAP.getOrDefault(connectCluster.getId(), new ConcurrentHashMap<>());
workerMap.put(workerId, jmxConnectorWrap);
JMX_MAP.put(connectCluster.getId(), workerMap);

log.info("method=createJmxConnectorWrap||clusterPhyId={}||workerId={}||msg=create JmxConnectorWrap success", connectCluster.getId(), workerId);

return jmxConnectorWrap;
} catch (Exception e) {
log.debug("method=createJmxConnectorWrap||connectClusterId={}||workerId={}||msg=create JmxConnectorWrap failed||errMsg=exception||", connectCluster.getId(), workerId, e);
log.error("method=createJmxConnectorWrap||connectClusterId={}||workerId={}||msg=create JmxConnectorWrap failed||errMsg=exception||", connectCluster.getId(), workerId, e);
} finally {
modifyClientMapLock.unlock();
}

return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ private JmxConnectorWrap createJmxConnectorWrap(ClusterPhy clusterPhy, Integer b
return jmxMap;
}

log.debug("method=createJmxConnectorWrap||clusterPhyId={}||brokerId={}||msg=create JmxConnectorWrap starting", clusterPhy.getId(), brokerId);
log.info("method=createJmxConnectorWrap||clusterPhyId={}||brokerId={}||msg=create JmxConnectorWrap starting", clusterPhy.getId(), brokerId);

JmxConfig jmxConfig = ConvertUtil.str2ObjByJson(clusterPhy.getJmxProperties(), JmxConfig.class);
if (jmxConfig == null) {
jmxConfig = new JmxConfig();
}

JmxConnectorWrap jmxConnectorWrap = new JmxConnectorWrap(
"clusterPhyId: " + clusterPhy.getId() + " brokerId: " + brokerId,
String.format("clusterPhyId=%s,brokerId=%d", clusterPhy.getId(), brokerId),
broker.getStartTimestamp(),
broker.getJmxHost(jmxConfig.getUseWhichEndpoint()),
jmxConfig.getFinallyJmxPort(String.valueOf(brokerId), broker.getJmxPort()),
Expand Down