Skip to content

Commit

Permalink
fix: some integrations only counted errors not all results (#8295)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek authored Sep 27, 2024
1 parent 81840ed commit 530af3d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/lib/addons/datadog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ export default class DatadogAddon extends Addon {
state = 'failed';
const failedMessage = `Datadog Events API request failed with status code: ${res.status}.`;
stateDetails.push(failedMessage);
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'datadog',
});
}

this.logger.warn(failedMessage);
}

if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'datadog',
});
}

this.registerEvent({
integrationId,
state,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/addons/slack-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ export default class SlackAppAddon extends Addon {
stateDetails.push(eventErrorMessage);
this.logger.warn(eventErrorMessage);
const errorMessage = this.parseError(error);
stateDetails.push(errorMessage);
this.logger.warn(errorMessage, error);
} finally {
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'slack-app',
});
}

stateDetails.push(errorMessage);
this.logger.warn(errorMessage, error);
} finally {
this.registerEvent({
integrationId,
state,
Expand Down
14 changes: 7 additions & 7 deletions src/lib/addons/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ export default class SlackAddon extends Addon {
state = 'successWithErrors';
const successWithErrorsMessage = `Some (${failedRequests.length} of ${results.length}) Slack webhook requests failed. Status codes: ${codes}.`;
stateDetails.push(successWithErrorsMessage);
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'slack',
});
}

this.logger.warn(successWithErrorsMessage);
}

if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'slack',
});
}

this.registerEvent({
integrationId,
state,
Expand Down
14 changes: 7 additions & 7 deletions src/lib/addons/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ export default class TeamsAddon extends Addon {
state = 'failed';
const failedMessage = `Teams webhook request failed with status code: ${res.status}.`;
stateDetails.push(failedMessage);
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'teams',
});
}

this.logger.warn(failedMessage);
}

if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'teams',
});
}

this.registerEvent({
integrationId,
state,
Expand Down

0 comments on commit 530af3d

Please sign in to comment.