fix(telemetry): 3 bugs — Slack Block Kit text key, cluster reopen clears resolution, affectedInstallIds uses correct ID
This commit is contained in:
parent
ae2dae4413
commit
08b9642408
@ -116,7 +116,7 @@ async function sendClusterAlert(
|
|||||||
type: 'section',
|
type: 'section',
|
||||||
text: {
|
text: {
|
||||||
type: 'mrkdwn',
|
type: 'mrkdwn',
|
||||||
value: [
|
text: [
|
||||||
`*Telemetry Error Cluster Escalated*`,
|
`*Telemetry Error Cluster Escalated*`,
|
||||||
`*Event:* ${cluster.module}/${cluster.eventName}`,
|
`*Event:* ${cluster.module}/${cluster.eventName}`,
|
||||||
`*Platform:* ${cluster.platform} (${cluster.channel})`,
|
`*Platform:* ${cluster.platform} (${cluster.channel})`,
|
||||||
@ -424,8 +424,12 @@ async function updateClusterForEvent(event: TelemetryEventDoc): Promise<void> {
|
|||||||
if (uid && event.userId && !existing.affectedUserIds.includes(uid)) {
|
if (uid && event.userId && !existing.affectedUserIds.includes(uid)) {
|
||||||
if (existing.affectedUserIds.length < 100) existing.affectedUserIds.push(uid);
|
if (existing.affectedUserIds.length < 100) existing.affectedUserIds.push(uid);
|
||||||
}
|
}
|
||||||
if (uid && event.anonymousInstallId && !existing.affectedInstallIds.includes(uid)) {
|
if (
|
||||||
if (existing.affectedInstallIds.length < 100) existing.affectedInstallIds.push(uid);
|
event.anonymousInstallId &&
|
||||||
|
!existing.affectedInstallIds.includes(event.anonymousInstallId)
|
||||||
|
) {
|
||||||
|
if (existing.affectedInstallIds.length < 100)
|
||||||
|
existing.affectedInstallIds.push(event.anonymousInstallId);
|
||||||
}
|
}
|
||||||
if (!existing.affectedOsFamilies.includes(event.osFamily)) {
|
if (!existing.affectedOsFamilies.includes(event.osFamily)) {
|
||||||
existing.affectedOsFamilies.push(event.osFamily);
|
existing.affectedOsFamilies.push(event.osFamily);
|
||||||
@ -861,6 +865,10 @@ export async function telemetryRoutes(app: FastifyInstance) {
|
|||||||
if (parsed.data.status === 'resolved' || parsed.data.status === 'ignored') {
|
if (parsed.data.status === 'resolved' || parsed.data.status === 'ignored') {
|
||||||
updates.resolvedBy = req.jwtPayload?.sub ?? 'unknown';
|
updates.resolvedBy = req.jwtPayload?.sub ?? 'unknown';
|
||||||
updates.resolvedAt = new Date().toISOString();
|
updates.resolvedAt = new Date().toISOString();
|
||||||
|
} else if (parsed.data.status === 'open') {
|
||||||
|
// Clear resolution metadata when reopening
|
||||||
|
updates.resolvedBy = undefined;
|
||||||
|
updates.resolvedAt = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updated = await repo.updateCluster(id, pk, updates);
|
const updated = await repo.updateCluster(id, pk, updates);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user