public boolean record ( final Throwable observation ) { final long timestamp = clock . time ( ) ; DistinctObservation distinctObservation ; synchronized ( this ) { distinctObservation = find ( distinctObservations , observation ) ; if ( null == distinctObservation ) { distinctObservation = newObservation ( timestamp , observation ) ; if ( INSUFFICIENT_SPACE == distinctObservation ) { return false ; } } } final int offset = distinctObservation . offset ; buffer . getAndAddInt ( offset + OBSERVATION_COUNT_OFFSET , 1 ) ; buffer . putLongOrdered ( offset + LAST_OBSERVATION_TIMESTAMP_OFFSET , timestamp ) ; return true ; }
Record an observation of an error . If it is the first observation of this error type for a stack trace then a new entry will be created . For subsequent observations of the same error type and stack trace a counter and time of last observation will be updated .