protected void handleStatsResetIfNeeded ( StatusData < NginxMetrics > status ) { StatValue previousHandled = getStatValue ( NginxMetrics . HANDLED ) ; Long currentHandled = Long . class . cast ( status . get ( NginxMetrics . HANDLED ) ) ; if ( previousHandled != null && currentHandled != null && previousHandled . getValueAsLong ( ) > currentHandled ) { for ( NginxMetrics metric : getAvailableMetrics ( ) ) { if ( metric . getType ( ) == StatValueTypes . DIFFLONG ) { StatValue stat = getStatValue ( metric ) ; if ( stat != null ) stat . reset ( ) ; } } } }
Check HANDLED metric and if its value is lower than the stored one - monitored Nginx server was restarted . In this case all DIFFLONG statValues need resetting .