Skip to content

Commit

Permalink
HDDS-9377. Remove blocking metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
juncevich committed Jan 16, 2025
1 parent b024a6b commit 2f66e63
Show file tree
Hide file tree
Showing 86 changed files with 1,975 additions and 367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
import org.apache.hadoop.metrics2.annotation.Metric;
import org.apache.hadoop.metrics2.annotation.Metrics;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.Interns;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.apache.hadoop.metrics2.lib.MutableQuantiles;
import org.apache.hadoop.metrics2.lib.MutableRate;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.metrics.MutableQuantiles;
import org.apache.hadoop.ozone.metrics.OzoneMutableRate;
import org.apache.hadoop.ozone.util.MetricUtil;
import org.apache.hadoop.ozone.metrics.OzoneMetricsSystem;

import java.util.Map;
import java.util.UUID;
Expand All @@ -56,13 +56,13 @@ public final class ContainerClientMetrics {
private MutableCounterLong totalWriteChunkBytes;

@Metric
private MutableRate hsyncSynchronizedWorkNs;
private OzoneMutableRate hsyncSynchronizedWorkNs;
@Metric
private MutableRate hsyncSendWriteChunkNs;
private OzoneMutableRate hsyncSendWriteChunkNs;
@Metric
private MutableRate hsyncWaitForFlushNs;
private OzoneMutableRate hsyncWaitForFlushNs;
@Metric
private MutableRate hsyncWatchForCommitNs;
private OzoneMutableRate hsyncWatchForCommitNs;
@Metric
private MutableCounterLong writeChunksDuringWrite;
@Metric
Expand All @@ -85,7 +85,7 @@ public final class ContainerClientMetrics {
public static synchronized ContainerClientMetrics acquire() {
if (instance == null) {
instanceCount++;
instance = DefaultMetricsSystem.instance().register(
instance = OzoneMetricsSystem.instance().register(
SOURCE_NAME + instanceCount,
"Ozone Client Metrics", new ContainerClientMetrics());
}
Expand All @@ -100,7 +100,7 @@ public static synchronized void release() {
referenceCount--;
if (referenceCount == 0) {
instance.stop();
DefaultMetricsSystem.instance().unregisterSource(
OzoneMetricsSystem.instance().unregisterSource(
SOURCE_NAME + instanceCount);
instance = null;
}
Expand All @@ -123,36 +123,37 @@ private ContainerClientMetrics() {
int[] intervals = {60, 300, 900};
for (int i = 0; i < intervals.length; i++) {
int interval = intervals[i];
listBlockLatency[i] = registry
.newQuantiles("listBlockLatency" + interval
listBlockLatency[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"listBlockLatency" + interval
+ "s", "ListBlock latency in microseconds", "ops",
"latency", interval);
getBlockLatency[i] = registry
.newQuantiles("getBlockLatency" + interval
getBlockLatency[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"getBlockLatency" + interval
+ "s", "GetBlock latency in microseconds", "ops",
"latency", interval);
getCommittedBlockLengthLatency[i] = registry
.newQuantiles("getCommittedBlockLengthLatency" + interval
getCommittedBlockLengthLatency[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"getCommittedBlockLengthLatency" + interval
+ "s", "GetCommittedBlockLength latency in microseconds",
"ops", "latency", interval);
readChunkLatency[i] = registry
.newQuantiles("readChunkLatency" + interval
readChunkLatency[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"readChunkLatency" + interval
+ "s", "ReadChunk latency in microseconds", "ops",
"latency", interval);
getSmallFileLatency[i] = registry
.newQuantiles("getSmallFileLatency" + interval
getSmallFileLatency[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"getSmallFileLatency" + interval
+ "s", "GetSmallFile latency in microseconds", "ops",
"latency", interval);
hsyncLatencyNs[i] = registry
.newQuantiles("hsyncLatency" + interval
hsyncLatencyNs[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"hsyncLatency" + interval
+ "s", "client hsync latency in nanoseconds", "ops",
"latency", interval);
omHsyncLatencyNs[i] = registry
.newQuantiles("omHsyncLatency" + interval
omHsyncLatencyNs[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"omHsyncLatency" + interval
+ "s", "client hsync latency to OM in nanoseconds", "ops",
"latency", interval);
datanodeHsyncLatencyNs[i] = registry
.newQuantiles("dnHsyncLatency" + interval
datanodeHsyncLatencyNs[i] = OzoneMetricsSystem.registerNewMutableQuantiles(
registry,
"dnHsyncLatency" + interval
+ "s", "client hsync latency to DN in nanoseconds", "ops",
"latency", interval);
}
Expand Down Expand Up @@ -279,19 +280,19 @@ Map<UUID, MutableCounterLong> getWriteChunksCallsByLeaders() {
return writeChunksCallsByLeaders;
}

public MutableRate getHsyncSynchronizedWorkNs() {
public OzoneMutableRate getHsyncSynchronizedWorkNs() {
return hsyncSynchronizedWorkNs;
}

public MutableRate getHsyncSendWriteChunkNs() {
public OzoneMutableRate getHsyncSendWriteChunkNs() {
return hsyncSendWriteChunkNs;
}

public MutableRate getHsyncWaitForFlushNs() {
public OzoneMutableRate getHsyncWaitForFlushNs() {
return hsyncWaitForFlushNs;
}

public MutableRate getHsyncWatchForCommitNs() {
public OzoneMutableRate getHsyncWatchForCommitNs() {
return hsyncWatchForCommitNs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import org.apache.hadoop.metrics2.MetricsSystem;
import org.apache.hadoop.metrics2.annotation.Metric;
import org.apache.hadoop.metrics2.annotation.Metrics;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.apache.hadoop.ozone.OzoneConfigKeys;
import org.apache.hadoop.ozone.util.PerformanceMetrics;
import org.apache.hadoop.ozone.metrics.OzoneMetricsSystem;

import java.util.EnumMap;

Expand Down Expand Up @@ -79,9 +79,8 @@ public void init() {
}

public static XceiverClientMetrics create() {
DefaultMetricsSystem.initialize(SOURCE_NAME);
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "Storage Container Client Metrics",
OzoneMetricsSystem.initialize(SOURCE_NAME);
return OzoneMetricsSystem.register(SOURCE_NAME, "Storage Container Client Metrics",
new XceiverClientMetrics());
}

Expand Down Expand Up @@ -131,7 +130,7 @@ public void reset() {

public void unRegister() {
IOUtils.closeQuietly(containerOpsLatency.values());
MetricsSystem ms = DefaultMetricsSystem.instance();
MetricsSystem ms = OzoneMetricsSystem.instance();
ms.unregisterSource(SOURCE_NAME);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import org.apache.hadoop.metrics2.lib.Interns;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableQuantiles;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MutableRate;
import org.apache.hadoop.ozone.OzoneConfigKeys;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.metrics.MutableQuantiles;
import org.apache.hadoop.ozone.util.MetricUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.ozone.metrics.OzoneMetricsSystem;
import org.apache.hadoop.ozone.metrics.OzoneMutableRate;

/**
* Class which maintains metrics related to using GRPC.
Expand Down Expand Up @@ -72,11 +72,11 @@ public GrpcMetrics(Configuration conf) {
new MutableQuantiles[intervals.length];
for (int i = 0; i < intervals.length; i++) {
int interval = intervals[i];
grpcQueueTimeMillisQuantiles[i] = registry
.newQuantiles("grpcQueueTime" + interval
grpcQueueTimeMillisQuantiles[i] = OzoneMetricsSystem
.registerNewMutableQuantiles(registry, "grpcQueueTime" + interval
+ "s", "grpc queue time in millisecond", "ops",
"latency", interval);
grpcProcessingTimeMillisQuantiles[i] = registry.newQuantiles(
grpcProcessingTimeMillisQuantiles[i] = OzoneMetricsSystem.registerNewMutableQuantiles(registry,
"grpcProcessingTime" + interval + "s",
"grpc processing time in millisecond",
"ops", "latency", interval);
Expand All @@ -92,15 +92,15 @@ public GrpcMetrics(Configuration conf) {
*/
public static synchronized GrpcMetrics create(Configuration conf) {
GrpcMetrics metrics = new GrpcMetrics(conf);
return DefaultMetricsSystem.instance().register(SOURCE_NAME,
return OzoneMetricsSystem.instance().register(SOURCE_NAME,
"Metrics for using gRPC", metrics);
}

/**
* Unregister the metrics instance.
*/
public void unRegister() {
DefaultMetricsSystem.instance().unregisterSource(SOURCE_NAME);
OzoneMetricsSystem.instance().unregisterSource(SOURCE_NAME);
MetricUtil.stop(grpcProcessingTimeMillisQuantiles);
MetricUtil.stop(grpcQueueTimeMillisQuantiles);
}
Expand All @@ -125,14 +125,14 @@ public synchronized void getMetrics(MetricsCollector collector, boolean all) {
private MutableCounterLong unknownMessagesReceived;

@Metric("Queue time")
private MutableRate grpcQueueTime;
private OzoneMutableRate grpcQueueTime;

// There should be no getter method to avoid
// exposing internal representation. FindBugs error raised.
private MutableQuantiles[] grpcQueueTimeMillisQuantiles;

@Metric("Processsing time")
private MutableRate grpcProcessingTime;
private OzoneMutableRate grpcProcessingTime;

// There should be no getter method to avoid
// exposing internal representation. FindBugs error raised.
Expand Down Expand Up @@ -202,12 +202,12 @@ public long getUnknownMessagesSent() {
public long getUnknownMessagesReceived() {
return unknownMessagesReceived.value();
}
MutableRate getGrpcQueueTime() {

OzoneMutableRate getGrpcQueueTime() {
return grpcQueueTime;
}

MutableRate getGrpcProcessingTime() {
OzoneMutableRate getGrpcProcessingTime() {
return grpcProcessingTime;
}

Expand Down
Loading

0 comments on commit 2f66e63

Please sign in to comment.