"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logTransactionMetrics = exports.trackTransactionMetrics = void 0;
const logger_1 = require("../../logger.js");
const METRICS_KEY = 'metrics';
const trackTransactionMetrics = (tr, type, meta) => {
    tr.setMeta(METRICS_KEY, { type, meta });
    return tr;
};
exports.trackTransactionMetrics = trackTransactionMetrics;
const logTransactionMetrics = (tr) => {
    const metrics = tr.getMeta(METRICS_KEY);
    if (metrics) {
        logger_1.logger.metrics({
            component: 'transaction',
            event: metrics.type,
            duration: Date.now() - tr.time,
            meta: metrics.meta,
        });
    }
};
exports.logTransactionMetrics = logTransactionMetrics;
//# sourceMappingURL=metrics.js.map
