HBASE-29640 Add metric for oldest procedure age - #8563
Conversation
| } | ||
|
|
||
| @Override | ||
| public long getOldestProcedureAge() { |
There was a problem hiding this comment.
OldestAge from all the procedures doesn't give much info IMHO. As there are procedure like LockProcedure that might run for a longer time compared to other procedures (In other words avarage time taken differs based on the type of procedure.). It would be great if we can fetch or expose metric/log for oldestAge prcedure of each type.
There was a problem hiding this comment.
Good point, thanks. A LockProcedure can naturally live much longer, so the global max may hide a stuck procedure of another type.
I updated the patch to calculate the oldest age per procedure class and expose gauges such as oldestProcedureAge_LockProcedure and oldestProcedureAge_ServerCrashProcedure. I kept oldestProcedureAge as the overall max for the original use case.
The test now covers two procedure types, multiple procedures of the same type, and finished procedures.
JIRA: https://issues.apache.org/jira/browse/HBASE-29640
What changes were proposed in this pull request?
This pull request adds an
oldestProcedureAgegauge to the existingMaster,sub=Proceduremetrics source. The gauge reports the age in milliseconds of the oldest unfinished master procedure, calculated from its submitted time.The metric returns zero when there are no active procedures or when the master procedure executor is not yet available. Finished procedures are ignored, and negative values caused by clock adjustments are clamped to zero.
Why are the changes needed?
Operators currently have no direct metric for identifying how long the oldest master procedure has been active. Exposing this value makes it easier to detect stuck or unexpectedly long-running procedures and to configure monitoring and alerting around procedure execution.
How was this patch tested?
A new
TestOldestProcedureMetricstest verifies:oldestProcedureAgegauge.mvn -pl hbase-server -am \ -Dtest=TestOldestProcedureMetrics \ -Dsurefire.failIfNoSpecifiedTests=false test