public boolean record(final Throwable observation)
    {
        final long timestampMs;
        DistinctObservation distinctObservation;

        timestampMs = clock.time();
        synchronized (this)
        {
            distinctObservation = find(distinctObservations, observation);

            if (null == distinctObservation)
            {
                distinctObservation = newObservation(timestampMs, 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, timestampMs);

        return true;
    }
@Test
    void shouldTestRecordingWithoutStackTrace()
    {
        final CachedEpochClock clock = new CachedEpochClock();
        final DistinctErrorLog log = new DistinctErrorLog(DIRECT_BUFFER, clock);

        clock.advance(10);
        log.record(new TestEvent("event one"));

        clock.advance(10);
        log.record(new TestEvent("event one"));

        clock.advance(10);
        log.record(new TestEvent("event two"));

        assertTrue(ErrorLogReader.hasErrors(DIRECT_BUFFER));

        final StringBuilder sb = new StringBuilder();
        final int errorCount = ErrorLogReader.read(
            DIRECT_BUFFER,
            (observationCount, firstObservationTimestamp, lastObservationTimestamp, encodedException) ->
            {
                sb
                    .append(observationCount)
                    .append(',')
                    .append(firstObservationTimestamp)
                    .append(',')
                    .append(lastObservationTimestamp)
                    .append(',')
                    .append(encodedException);
            });

        assertEquals(2, errorCount);

        final String expectedOutput =
            "2,10,20,org.agrona.concurrent.errors.DistinctErrorLogTest$TestEvent: event one" + System.lineSeparator() +
            "1,30,30,org.agrona.concurrent.errors.DistinctErrorLogTest$TestEvent: event two" + System.lineSeparator();
        assertEquals(expectedOutput, sb.toString());
    }