This is an automated email from the ASF dual-hosted git repository.
jlli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new d8d0bb5 Add metrics on Helix and Pinot controller leadership (#4561)
d8d0bb5 is described below
commit d8d0bb56d9ec82555ca0777afe29741d14d1d652
Author: Jialiang Li <[email protected]>
AuthorDate: Sat Aug 24 19:02:03 2019 -0700
Add metrics on Helix and Pinot controller leadership (#4561)
* Add metrics on Helix and Pinot controller leadership
---
.../java/org/apache/pinot/common/metrics/ControllerGauge.java | 6 ++++++
.../org/apache/pinot/controller/LeadControllerManager.java | 10 ++++++++++
2 files changed, 16 insertions(+)
diff --git
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
index 97fc4b6..d99564f 100644
---
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
+++
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
@@ -48,6 +48,12 @@ public enum ControllerGauge implements AbstractMetrics.Gauge
{
// Pinot controller leader
PINOT_CONTROLLER_LEADER("PinotControllerLeader", true),
+ // Pinot controller partition leader
+ PINOT_CONTROLLER_PARTITION_LEADER("PinotControllerPartitionLeader", true),
+
+ // Pinot controller resource enabled
+ PINOT_LEAD_CONTROLLER_RESOURCE_ENABLED("PinotLeadControllerResourceEnabled",
true),
+
// Number of extra live instances needed
SHORT_OF_LIVE_INSTANCES("ShortOfLiveInstances", false),
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
index b03268c..0ca89c4 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
@@ -27,6 +27,7 @@ import org.apache.helix.PropertyKey;
import org.apache.helix.model.LiveInstance;
import org.apache.helix.model.ResourceConfig;
import org.apache.pinot.common.config.TableNameBuilder;
+import org.apache.pinot.common.metrics.ControllerGauge;
import org.apache.pinot.common.metrics.ControllerMeter;
import org.apache.pinot.common.metrics.ControllerMetrics;
import org.apache.pinot.common.utils.CommonConstants.Helix;
@@ -34,6 +35,7 @@ import
org.apache.pinot.common.utils.helix.LeadControllerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
* Class for handling lead controller assignments given the table names. This
should be created at controller startup.
*/
@@ -75,6 +77,7 @@ public class LeadControllerManager {
_controllerMetrics
.addMeteredGlobalValue(ControllerMeter.CONTROLLER_LEADERSHIP_CHANGE_WITHOUT_CALLBACK,
1L);
}
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_LEADER,
1L);
} else {
if (_amIHelixLeader) {
_amIHelixLeader = false;
@@ -82,6 +85,7 @@ public class LeadControllerManager {
_controllerMetrics
.addMeteredGlobalValue(ControllerMeter.CONTROLLER_LEADERSHIP_CHANGE_WITHOUT_CALLBACK,
1L);
}
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_LEADER,
0L);
}
LeadControllerManager.this.wait(CONTROLLER_LEADERSHIP_FETCH_INTERVAL_MS);
}
@@ -118,6 +122,7 @@ public class LeadControllerManager {
LOGGER.info("Add Partition: {} to LeadControllerManager", partitionName);
int partitionId = LeadControllerUtils.extractPartitionId(partitionName);
_leadForPartitions.add(partitionId);
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_PARTITION_LEADER,
partitionName, 1L);
}
/**
@@ -128,6 +133,7 @@ public class LeadControllerManager {
LOGGER.info("Remove Partition: {} from LeadControllerManager",
partitionName);
int partitionId = LeadControllerUtils.extractPartitionId(partitionName);
_leadForPartitions.remove(partitionId);
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_PARTITION_LEADER,
partitionName, 0L);
}
/**
@@ -201,6 +207,7 @@ public class LeadControllerManager {
} else {
LOGGER.info("Already Helix leader. Duplicate notification");
}
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_LEADER,
1L);
} else {
if (_amIHelixLeader) {
_amIHelixLeader = false;
@@ -208,6 +215,7 @@ public class LeadControllerManager {
} else {
LOGGER.info("Already not Helix leader. Duplicate notification");
}
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_CONTROLLER_LEADER,
0L);
}
}
@@ -221,9 +229,11 @@ public class LeadControllerManager {
if (isLeadControllerResourceEnabled()) {
LOGGER.info("Lead controller resource is enabled.");
_isLeadControllerResourceEnabled = true;
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_LEAD_CONTROLLER_RESOURCE_ENABLED,
1L);
} else {
LOGGER.info("Lead controller resource is disabled.");
_isLeadControllerResourceEnabled = false;
+
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.PINOT_LEAD_CONTROLLER_RESOURCE_ENABLED,
0L);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]