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:
committed by
GitHub
parent
fdfc6c5a92
commit
adcf5a96e8
@@ -11,10 +11,7 @@ import { MessageEventBusLogWriter } from '../MessageEventBusWriter/MessageEventB
|
||||
import EventEmitter from 'events';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
messageEventBusDestinationFromDb,
|
||||
incrementPrometheusMetric,
|
||||
} from '../MessageEventBusDestination/Helpers.ee';
|
||||
import { messageEventBusDestinationFromDb } from '../MessageEventBusDestination/MessageEventBusDestinationFromDb';
|
||||
import uniqby from 'lodash/uniqBy';
|
||||
import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm';
|
||||
import type { EventMessageAuditOptions } from '../EventMessageClasses/EventMessageAudit';
|
||||
@@ -29,6 +26,7 @@ import {
|
||||
eventMessageGenericDestinationTestEvent,
|
||||
} from '../EventMessageClasses/EventMessageGeneric';
|
||||
import { recoverExecutionDataFromEventLogMessages } from './recoverEvents';
|
||||
import { METRICS_EVENT_NAME } from '../MessageEventBusDestination/Helpers.ee';
|
||||
|
||||
export type EventMessageReturnMode = 'sent' | 'unsent' | 'all' | 'unfinished';
|
||||
|
||||
@@ -224,9 +222,7 @@ export class MessageEventBus extends EventEmitter {
|
||||
}
|
||||
|
||||
private async emitMessage(msg: EventMessageTypes) {
|
||||
if (config.getEnv('endpoints.metrics.enable')) {
|
||||
await incrementPrometheusMetric(msg);
|
||||
}
|
||||
this.emit(METRICS_EVENT_NAME, msg);
|
||||
|
||||
// generic emit for external modules to capture events
|
||||
// this is for internal use ONLY and not for use with custom destinations!
|
||||
|
||||
Reference in New Issue
Block a user