feat(core): Add metrics option to cache (#6846)

* add metrics to cache

* use events for metrics

* pr comments / broken test

* lint fix

* update the test

* improve tests

* Update packages/cli/src/config/schema.ts

* disable flaky test

* lint fix

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
This commit is contained in:
Michael Auerswald
2023-08-04 20:51:07 +02:00
committed by GitHub
parent fdfc6c5a92
commit adcf5a96e8
12 changed files with 315 additions and 159 deletions

View File

@@ -0,0 +1,27 @@
import { MessageEventBusDestinationTypeNames, LoggerProxy } from 'n8n-workflow';
import type { EventDestinations } from '@/databases/entities/EventDestinations';
import type { MessageEventBus } from '../MessageEventBus/MessageEventBus';
import type { MessageEventBusDestination } from './MessageEventBusDestination.ee';
import { MessageEventBusDestinationSentry } from './MessageEventBusDestinationSentry.ee';
import { MessageEventBusDestinationSyslog } from './MessageEventBusDestinationSyslog.ee';
import { MessageEventBusDestinationWebhook } from './MessageEventBusDestinationWebhook.ee';
export function messageEventBusDestinationFromDb(
eventBusInstance: MessageEventBus,
dbData: EventDestinations,
): MessageEventBusDestination | null {
const destinationData = dbData.destination;
if ('__type' in destinationData) {
switch (destinationData.__type) {
case MessageEventBusDestinationTypeNames.sentry:
return MessageEventBusDestinationSentry.deserialize(eventBusInstance, destinationData);
case MessageEventBusDestinationTypeNames.syslog:
return MessageEventBusDestinationSyslog.deserialize(eventBusInstance, destinationData);
case MessageEventBusDestinationTypeNames.webhook:
return MessageEventBusDestinationWebhook.deserialize(eventBusInstance, destinationData);
default:
LoggerProxy.debug('MessageEventBusDestination __type unknown');
}
}
return null;
}