@Test void shouldRecordDelayWhenAttestationIsPublishedLate() { final UInt64 slotNumber = UInt64.valueOf(30); final UInt64 expectedAttestationTime = expectedAttestationTime(slotNumber); final int publicationDelay = 575; timeProvider.advanceTimeByMillis(expectedAttestationTime.plus(publicationDelay).longValue()); metrics.onAttestationPublished(UInt64.valueOf(30)); verify(attestationHistogram).recordValue(publicationDelay); }
public void onAttestationPublished(final UInt64 slot) { final UInt64 currentTime = timeProvider.getTimeInMillis(); final UInt64 expectedTime = calculateExpectedAttestationTimeInMillis(slot); if (currentTime.isGreaterThanOrEqualTo(expectedTime)) { attestationHistogram.recordValue(currentTime.minus(expectedTime).longValue()); } else { attestationHistogram.recordValue(0); } }
DutyMetrics { public void onAttestationPublished(final UInt64 slot) { final UInt64 currentTime = timeProvider.getTimeInMillis(); final UInt64 expectedTime = calculateExpectedAttestationTimeInMillis(slot); if (currentTime.isGreaterThanOrEqualTo(expectedTime)) { attestationHistogram.recordValue(currentTime.minus(expectedTime).longValue()); } else { attestationHistogram.recordValue(0); } } }
DutyMetrics { public void onAttestationPublished(final UInt64 slot) { final UInt64 currentTime = timeProvider.getTimeInMillis(); final UInt64 expectedTime = calculateExpectedAttestationTimeInMillis(slot); if (currentTime.isGreaterThanOrEqualTo(expectedTime)) { attestationHistogram.recordValue(currentTime.minus(expectedTime).longValue()); } else { attestationHistogram.recordValue(0); } } @VisibleForTesting  DutyMetrics(
      final TimeProvider timeProvider,
      final RecentChainData recentChainData,
      final MetricsHistogram attestationHistogram); }
DutyMetrics { public void onAttestationPublished(final UInt64 slot) { final UInt64 currentTime = timeProvider.getTimeInMillis(); final UInt64 expectedTime = calculateExpectedAttestationTimeInMillis(slot); if (currentTime.isGreaterThanOrEqualTo(expectedTime)) { attestationHistogram.recordValue(currentTime.minus(expectedTime).longValue()); } else { attestationHistogram.recordValue(0); } } @VisibleForTesting  DutyMetrics(
      final TimeProvider timeProvider,
      final RecentChainData recentChainData,
      final MetricsHistogram attestationHistogram); static DutyMetrics create(
      final MetricsSystem metricsSystem,
      final TimeProvider timeProvider,
      final RecentChainData recentChainData); void onAttestationPublished(final UInt64 slot); }
DutyMetrics { public void onAttestationPublished(final UInt64 slot) { final UInt64 currentTime = timeProvider.getTimeInMillis(); final UInt64 expectedTime = calculateExpectedAttestationTimeInMillis(slot); if (currentTime.isGreaterThanOrEqualTo(expectedTime)) { attestationHistogram.recordValue(currentTime.minus(expectedTime).longValue()); } else { attestationHistogram.recordValue(0); } } @VisibleForTesting  DutyMetrics(
      final TimeProvider timeProvider,
      final RecentChainData recentChainData,
      final MetricsHistogram attestationHistogram); static DutyMetrics create(
      final MetricsSystem metricsSystem,
      final TimeProvider timeProvider,
      final RecentChainData recentChainData); void onAttestationPublished(final UInt64 slot);  }