fix performance reset bug
This commit is contained in:
@@ -138,7 +138,7 @@ async function clickhouseQuery(
|
||||
const chart = await rawQuery<{ t: string; p50: number; p75: number; p95: number }[]>(
|
||||
`
|
||||
select
|
||||
${getDateSQL('created_at', 'minute', timezone)} t,
|
||||
${getDateSQL('created_at', unit, timezone)} t,
|
||||
quantile(0.5)(${metric}) as p50,
|
||||
quantile(0.75)(${metric}) as p75,
|
||||
quantile(0.95)(${metric}) as p95
|
||||
|
||||
+11
-1
@@ -331,7 +331,17 @@
|
||||
send({ ...getPayload(), ...metrics }, 'performance');
|
||||
};
|
||||
|
||||
flushPerformance = sendPerformance;
|
||||
flushPerformance = () => {
|
||||
sendPerformance();
|
||||
Object.keys(metrics).forEach(k => {
|
||||
delete metrics[k];
|
||||
});
|
||||
clsValue = 0;
|
||||
inpValue = 0;
|
||||
sent = false;
|
||||
if (timeoutId) clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(sendPerformance, 10000);
|
||||
};
|
||||
timeoutId = setTimeout(sendPerformance, 10000);
|
||||
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
|
||||
Reference in New Issue
Block a user