Class ParticipantStateTransitionStats


public class ParticipantStateTransitionStats extends ThreadPoolStats
Tracks partition state transition metrics for the Helix participant. Extends ThreadPoolStats (which already has OTel for thread pool metrics) and adds:
  • Blocked thread count per (from, to) state pair (currently only OFFLINE→DROPPED)
  • In-progress partition counts per (from, to) state pair
  • Active partition counts per Helix state: ERROR, STANDBY, LEADER

All three OTel metrics use UP_DOWN_COUNTER (+1/-1 at call sites). Tehuti uses AsyncGauge polling AtomicInteger trackers. The AtomicIntegers are Tehuti-only artifacts — they will be removed when Tehuti is retired.

  • Constructor Details

    • ParticipantStateTransitionStats

      public ParticipantStateTransitionStats(io.tehuti.metrics.MetricsRepository metricsRepository, ThreadPoolExecutor threadPoolExecutor, String name)
  • Method Details

    • incrementThreadBlockedOnOfflineToDroppedTransitionCount

      public void incrementThreadBlockedOnOfflineToDroppedTransitionCount()
      Increments the blocked-thread count for the OFFLINE→DROPPED transition. Only call from OFFLINE→DROPPED transitions — the OTel dimensions are hardcoded to that pair.
    • decrementThreadBlockedOnOfflineToDroppedTransitionCount

      public void decrementThreadBlockedOnOfflineToDroppedTransitionCount()
      Decrements the blocked-thread count for the OFFLINE→DROPPED transition. Only call from OFFLINE→DROPPED transitions — the OTel dimensions are hardcoded to that pair.
    • trackStateTransitionStarted

      public void trackStateTransitionStarted(String fromState, String toState)
    • trackStateTransitionCompleted

      public void trackStateTransitionCompleted(String fromState, String toState)
    • trackStateTransitionFailed

      public void trackStateTransitionFailed(String fromState, String toState)
      Called when a state transition handler throws. Decrements the in-progress counter to avoid leaking +1 forever for (fromState, toState). Steady-state for toState is NOT incremented because the partition did not reach toState; steady-state for fromState was already decremented in trackStateTransitionStarted(java.lang.String, java.lang.String) and stays decremented because the partition has left fromState (Helix typically marks it ERROR and a follow-up transition will track that).