@awarns/tracing
Version:
AwarNS Framework package that eases the tracing and debugging of complex task execution workflows
25 lines • 993 B
JavaScript
import { syncedTracesStore } from './internal/stores';
import { getLogger } from '@awarns/core/utils/logger';
export * from './entities';
export * from './tasks';
export * from './stores';
export * from './exporters';
export function registerTracingPlugin(config = {}) {
return () => {
if (config.externalTracesStore) {
syncedTracesStore.setExternalStore(config.externalTracesStore);
}
if (config.oldTracesMaxAgeHours !== undefined) {
syncedTracesStore.setClearOldThreshold(config.oldTracesMaxAgeHours);
}
const detachedDBMaintenance = async () => {
await syncedTracesStore.sync();
await syncedTracesStore.clearOld();
};
detachedDBMaintenance().catch((err) => {
var _a;
getLogger('TracingPlugin').error(`Could not complete DB maintenance. Reason: ${(_a = err.stack) !== null && _a !== void 0 ? _a : err}`);
});
};
}
//# sourceMappingURL=index.js.map