diff --git a/src/Synchronizer.ts b/src/Synchronizer.ts index 98e846a..5b510a4 100644 --- a/src/Synchronizer.ts +++ b/src/Synchronizer.ts @@ -196,7 +196,7 @@ export class Synchronizer { private createErrorGroup(error: Error, sourceName: string): ErrorGroup { // truncate the error to the first 500 characters const maxNameLength = 500; - error.name = `[${sourceName}] ${error.name}`.substr(0, maxNameLength); + error.name = error.name.substr(0, maxNameLength); // wipe out line numbers let normalizedName = error.name; @@ -205,15 +205,16 @@ export class Synchronizer { // remove TypeError prefix from client errors that some browsers may emit normalizedName = normalizedName.replace(/(TypeError:\s*)/i, ''); - // generate clientId from the normalized name - const hash = crypto.createHash('md5').update(normalizedName).digest('hex'); + // generate clientId from the error source name and normalized error name + const clientIdInput = `${sourceName}:${normalizedName}`; + const clientId = crypto.createHash('md5').update(clientIdInput).digest('hex'); return { name: normalizedName, sourceName, type: error.type, priority: ErrorPriority.P5, - clientId: hash, + clientId, count: error.count, countType: error.countType, ticket: null, diff --git a/src/models/Error.ts b/src/models/Error.ts index 2167456..9e0e4ad 100644 --- a/src/models/Error.ts +++ b/src/models/Error.ts @@ -10,13 +10,13 @@ export enum ErrorPriority { } export enum ErrorCountType { - USERS = 'Users', - TRX = 'Transactions', + USERS = 'users', + TRX = 'transactions', } export enum ErrorType { - CLIENT = 'Client', - SERVER = 'Server', + CLIENT = 'client', + SERVER = 'server', } export type Error = { diff --git a/src/providers/JiraTicketProvider.ts b/src/providers/JiraTicketProvider.ts index 04557b1..b225c74 100644 --- a/src/providers/JiraTicketProvider.ts +++ b/src/providers/JiraTicketProvider.ts @@ -162,7 +162,7 @@ export class JiraTicketProvider implements TicketProviderInterface { public async generateTicketContent(errorGroup: ErrorGroup): Promise { const maxInstances = 10; - const summary = `[${errorGroup.type}] ${errorGroup.name}`; + const summary = `[${errorGroup.type}] [${errorGroup.sourceName}] ${errorGroup.name}`; let description = errorGroup.name + '\nh3.Frequency\n' + diff --git a/src/providers/OpsGenieAlertProvider.ts b/src/providers/OpsGenieAlertProvider.ts index 82105e3..dbdb7dc 100644 --- a/src/providers/OpsGenieAlertProvider.ts +++ b/src/providers/OpsGenieAlertProvider.ts @@ -96,7 +96,7 @@ export class OpsGenieAlertProvider implements AlertProviderInterface { } public async generateAlertContent(errorGroup: ErrorGroup): Promise { - const summary = `[BUG] ${errorGroup.name}`.substr(0, 130); + const summary = `[${errorGroup.type}] [${errorGroup.sourceName}] ${errorGroup.name}`.substr(0, 130); return { clientId: errorGroup.clientId,