Skip to content

Commit e633b1e

Browse files
committed
Don't send heartbeat when there are compressed stats
We keep durations per operation (to measure the time our algo takes to detect attacks) After 5000 samples we compress them into percentiles. 5000 invocations is not much. This means that we will send a heartbeat almost every checkIfHeartbeatIsNeededEveryMS for normal production traffic Which is currently set at 60s So every minute we would send a heartbeat...
1 parent 192443f commit e633b1e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

library/agent/Agent.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,10 @@ export class Agent {
352352
const now = performance.now();
353353
const diff = now - this.lastHeartbeat;
354354
const shouldSendHeartbeat = diff > this.sendHeartbeatEveryMS;
355-
const hasCompressedStats = this.statistics.hasCompressedStats();
356355
const canSendInitialStats =
357356
!this.serviceConfig.hasReceivedAnyStats() && !this.statistics.isEmpty();
358357
const shouldReportInitialStats =
359-
!this.reportedInitialStats &&
360-
(hasCompressedStats || canSendInitialStats);
358+
!this.reportedInitialStats && canSendInitialStats;
361359

362360
if (shouldSendHeartbeat || shouldReportInitialStats) {
363361
this.heartbeat();

0 commit comments

Comments
 (0)