HDDS-5536. Add metrics for ReplicationSupervisor#2493
HDDS-5536. Add metrics for ReplicationSupervisor#2493ChenSammi merged 3 commits intoapache:masterfrom
Conversation
...rc/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
Show resolved
Hide resolved
| public static ReplicationSupervisorMetrics create(ReplicationSupervisor | ||
| supervisor) { | ||
| MetricsSystem ms = DefaultMetricsSystem.instance(); | ||
| return ms.register(SOURCE, "Container Replication Supervisor Metrics", |
There was a problem hiding this comment.
we create and register one MetricsSystem per DN, which is not a problem for typical deployments.
But i imagine it can potentially be problematic for unit tests because there are multiple DN objects in unit test heap and only one of them will successfully register.
There was a problem hiding this comment.
Other than that the code looks good to me.
There was a problem hiding this comment.
Yea, that will be a "metrics already exists" warning in unit test, not only for this metrics, but also for other DN metries.
What's a general way to handle this? Maybe we can append DN's hostname+port to each metrics source name?
I'm not sure how HDFS handle this.
There was a problem hiding this comment.
HDFS DataNodeMetrics.java
dnName is host name + port. So yeah, it would be a good idea to try to make them unique.
public static DataNodeMetrics create(Configuration conf, String dnName) {
String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
MetricsSystem ms = DefaultMetricsSystem.instance();
JvmMetrics jm = JvmMetrics.create("DataNode", sessionId, ms);
String name = "DataNodeActivity-"+ (dnName.isEmpty()
? "UndefinedDataNodeName"+ ThreadLocalRandom.current().nextInt()
: dnName.replace(':', '-'));
// Percentile measurement is off by default, by watching no intervals
int[] intervals =
conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
return ms.register(name, null, new DataNodeMetrics(name, sessionId,
intervals, jm));
}
There was a problem hiding this comment.
I see. @jojochuang , can we do it in a followup JIRA? since other DN metrics also need be improved.
There was a problem hiding this comment.
@jojochuang can we commit this and file a follow-up task?
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @ChenSammi for the patch.
|
Thanks @jojochuang and @adoroszlai for the code review. |
https://issues.apache.org/jira/browse/HDDS-5536