amaliujia commented on code in PR #12079:
URL: https://github.com/apache/ozone/pull/12079#discussion_r4690934823
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineMetrics.java:
##########
@@ -104,6 +124,61 @@ public void getMetrics(MetricsCollector collector, boolean
all) {
pipelineCreationLatencyNs.snapshot(recordBuilder, true);
numBlocksAllocated
.forEach((pid, metric) -> metric.snapshot(recordBuilder, true));
+ tierPlacementFailures.forEach((tier, counters) ->
counters.forEach((reason, counter) ->
+ collector.addRecord(SOURCE_NAME)
+ .tag(REQUESTED_TIER, tier)
+ .tag(REASON, reason.label)
+ .addCounter(TIER_PLACEMENT_FAILURES, counter.value())));
+ }
+
+ private void addTierPlacementCounters(String tier) {
+ Map<PlacementFailureReason, MutableCounterLong> counters = new
EnumMap<>(PlacementFailureReason.class);
+ for (PlacementFailureReason reason : PlacementFailureReason.values()) {
+ counters.put(reason, new MutableCounterLong(TIER_PLACEMENT_FAILURES, 0));
+ }
+ tierPlacementFailures.put(tier, counters);
+ }
+
+ /**
+ * Counts one unsuccessful RATIS/standalone tier allocation after all
provider retries. A later allocation on a
+ * fallback tier may still succeed. This does not count background pipeline
creation or change aggregate counters.
+ * Missing/empty tiers are UNKNOWN. Reasons use SCM result codes, never
exception messages; no_space includes
+ * insufficient eligible storage of the requested type, not just full
volumes. Unclassified failures are other.
+ *
+ * @param tier tier of this allocation attempt, including a fallback tier
when it is attempted
+ * @param failure last unsuccessful creation/wait operation, or null when no
structured failure is available
+ */
+ void incTierPlacementFailure(StorageTier tier, IOException failure) {
+ String requestedTier = tier == null || tier == StorageTier.EMPTY ?
UNKNOWN_TIER : tier.name();
+
tierPlacementFailures.get(requestedTier).get(PlacementFailureReason.fromException(failure)).incr();
+ }
+
+ private enum PlacementFailureReason {
+ NO_SPACE("no_space"),
+ NO_SUITABLE_NODE("no_suitable_node"),
+ OTHER("other");
Review Comment:
Why don't we break `OTHER` down to the concrete cases? Is it because we do
not care for now?
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableRatisContainerProvider.java:
##########
@@ -53,6 +54,7 @@ public WritableRatisContainerProvider(
this.pipelineManager = pipelineManager;
this.containerManager = containerManager;
this.pipelineChoosePolicy = pipelineChoosePolicy;
+ this.metrics = SCMPipelineMetrics.create();
Review Comment:
PipelineManager has already `SCMPipelineMetrics`. Can we reuse that one?
https://github.com/apache/ozone/blob/e707ac51788cbe15bb246c299a9875ee93e65ba2/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManager.java#L219
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]