mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: some integrations only counted errors not all results (#8295)
This commit is contained in:
parent
81840ed574
commit
530af3d7d6
@ -113,16 +113,16 @@ export default class DatadogAddon extends Addon {
|
|||||||
state = 'failed';
|
state = 'failed';
|
||||||
const failedMessage = `Datadog Events API request failed with status code: ${res.status}.`;
|
const failedMessage = `Datadog Events API request failed with status code: ${res.status}.`;
|
||||||
stateDetails.push(failedMessage);
|
stateDetails.push(failedMessage);
|
||||||
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
|
||||||
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
|
||||||
result: state,
|
|
||||||
destination: 'datadog',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.warn(failedMessage);
|
this.logger.warn(failedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
||||||
|
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
||||||
|
result: state,
|
||||||
|
destination: 'datadog',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.registerEvent({
|
this.registerEvent({
|
||||||
integrationId,
|
integrationId,
|
||||||
state,
|
state,
|
||||||
|
@ -179,6 +179,9 @@ export default class SlackAppAddon extends Addon {
|
|||||||
stateDetails.push(eventErrorMessage);
|
stateDetails.push(eventErrorMessage);
|
||||||
this.logger.warn(eventErrorMessage);
|
this.logger.warn(eventErrorMessage);
|
||||||
const errorMessage = this.parseError(error);
|
const errorMessage = this.parseError(error);
|
||||||
|
stateDetails.push(errorMessage);
|
||||||
|
this.logger.warn(errorMessage, error);
|
||||||
|
} finally {
|
||||||
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
||||||
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
||||||
result: state,
|
result: state,
|
||||||
@ -186,9 +189,6 @@ export default class SlackAppAddon extends Addon {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
stateDetails.push(errorMessage);
|
|
||||||
this.logger.warn(errorMessage, error);
|
|
||||||
} finally {
|
|
||||||
this.registerEvent({
|
this.registerEvent({
|
||||||
integrationId,
|
integrationId,
|
||||||
state,
|
state,
|
||||||
|
@ -131,16 +131,16 @@ export default class SlackAddon extends Addon {
|
|||||||
state = 'successWithErrors';
|
state = 'successWithErrors';
|
||||||
const successWithErrorsMessage = `Some (${failedRequests.length} of ${results.length}) Slack webhook requests failed. Status codes: ${codes}.`;
|
const successWithErrorsMessage = `Some (${failedRequests.length} of ${results.length}) Slack webhook requests failed. Status codes: ${codes}.`;
|
||||||
stateDetails.push(successWithErrorsMessage);
|
stateDetails.push(successWithErrorsMessage);
|
||||||
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
|
||||||
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
|
||||||
result: state,
|
|
||||||
destination: 'slack',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.warn(successWithErrorsMessage);
|
this.logger.warn(successWithErrorsMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
||||||
|
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
||||||
|
result: state,
|
||||||
|
destination: 'slack',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.registerEvent({
|
this.registerEvent({
|
||||||
integrationId,
|
integrationId,
|
||||||
state,
|
state,
|
||||||
|
@ -107,16 +107,16 @@ export default class TeamsAddon extends Addon {
|
|||||||
state = 'failed';
|
state = 'failed';
|
||||||
const failedMessage = `Teams webhook request failed with status code: ${res.status}.`;
|
const failedMessage = `Teams webhook request failed with status code: ${res.status}.`;
|
||||||
stateDetails.push(failedMessage);
|
stateDetails.push(failedMessage);
|
||||||
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
|
||||||
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
|
||||||
result: state,
|
|
||||||
destination: 'teams',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.warn(failedMessage);
|
this.logger.warn(failedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
|
||||||
|
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
|
||||||
|
result: state,
|
||||||
|
destination: 'teams',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.registerEvent({
|
this.registerEvent({
|
||||||
integrationId,
|
integrationId,
|
||||||
state,
|
state,
|
||||||
|
Loading…
Reference in New Issue
Block a user