UNPKG

newrelic-nestjs-instrumentation

Version:

Comprehensive New Relic instrumentation for NestJS applications - SQS, Kafka, HTTP/2, cron jobs and custom protocols

26 lines 897 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.customNewrelicContext = exports.InternalContext = void 0; const async_hooks_1 = require("async_hooks"); const internalContext = new async_hooks_1.AsyncLocalStorage(); class InternalContext { get store() { let store = internalContext.getStore(); if (!store) internalContext.enterWith((store = {})); return store; } get customTransactionId() { return this.store.traceData?.traceId; } setCustomTransaction(newTransaction, traceData) { this.store.newTransaction = newTransaction; this.store.traceData = traceData; } get transaction() { return this.store.newTransaction; } } exports.InternalContext = InternalContext; exports.customNewrelicContext = new InternalContext(); //# sourceMappingURL=internal-context.js.map