1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

feat: log domain every time a webhook is invoked (#7962)

This commit is contained in:
David Leek 2024-08-22 11:26:53 +02:00 committed by GitHub
parent 4a4dafcc3f
commit e13f7eea63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,16 +103,21 @@ export default class Webhook extends Addon {
state = 'failed'; state = 'failed';
const failedMessage = `Webhook request failed with status code: ${res.status}.`; const failedMessage = `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: 'webhook',
});
}
this.logger.warn(failedMessage); this.logger.warn(failedMessage);
} }
if (this.flagResolver.isEnabled('addonUsageMetrics')) {
this.eventBus.emit(ADDON_EVENTS_HANDLED, {
result: state,
destination: 'webhook',
});
}
const domain = new URL(url).hostname;
this.logger.info(`Webhook invoked`, {
domain,
});
this.registerEvent({ this.registerEvent({
integrationId, integrationId,
state, state,