Skip to content

Commit

Permalink
refactor(context): remove debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Nov 8, 2022
1 parent cdf2d1a commit ffd2660
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
14 changes: 0 additions & 14 deletions packages/core/src/tracing/clsHooked/async_local_storage_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const unset = require('./unset');

const CONTEXTS_SYMBOL = 'instanaClsHooked@contexts';

const DEBUG_CLS = !!process.env.DEBUG_CLS;

const storage = new AsyncLocalStorage();

module.exports = {
Expand Down Expand Up @@ -130,7 +128,6 @@ class Namespace {
* @returns {InstanaCLSContext}
*/
createRootContext() {
// Prototype inherit existing context if created a new child context within existing context.
const context = Object.create(Object.prototype);
context._ns_name = this.name;
context.id = executionAsyncId();
Expand All @@ -147,7 +144,6 @@ class Namespace {
*/
run(fn, ctx) {
const context = ctx || this.createContext();
debug('ALS run enter', context.id, 'active:', this.active ? this.active.id : 'ROOT');

storage.run(context, () => fn(context));
return context;
Expand Down Expand Up @@ -180,7 +176,6 @@ class Namespace {
*/
runPromise(fn, ctx) {
const context = ctx || this.createContext();
debug('ALS runPromise enter', context.id, 'active:', this.active ? this.active.id : 'ROOT');

/**
* We need the new context to be set as the active context before the promise is called.
Expand Down Expand Up @@ -354,12 +349,3 @@ function reset() {

// @ts-ignore: Property 'instanaNamespaces' does not exist on type 'Process'
process.instanaNamespaces = process.instanaNamespaces || {};

// @ts-ignore
function debug(...args) {
if (DEBUG_CLS) {
// fs.writeSync(1, `${util.format(...args)}\n`);
// @ts-ignore
process._rawDebug(`${util.format(...args)}`);
}
}
14 changes: 0 additions & 14 deletions packages/core/src/tracing/clsHooked/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const unset = require('./unset');

const CONTEXTS_SYMBOL = 'instanaClsHooked@contexts';

const DEBUG_CLS = !!process.env.DEBUG_CLS;

let currentUid = -1;

module.exports = {
Expand Down Expand Up @@ -120,8 +118,6 @@ Namespace.prototype.createRootContext = function createRootContext() {
*/
Namespace.prototype.run = function run(fn, ctx) {
let context = ctx || this.createContext();
debug('CLS-HOOKED run enter', context.id, 'active:', this.active ? this.active.id : 'ROOT');

this.enter(context);

try {
Expand Down Expand Up @@ -159,7 +155,6 @@ Namespace.prototype.runAndReturn = function runAndReturn(fn, ctx) {
*/
Namespace.prototype.runPromise = function runPromise(fn, ctx) {
let context = ctx || this.createContext();
debug('CLS-HOOKED runPromise enter', context.id, 'active:', this.active ? this.active.id : 'ROOT');
this.enter(context);

let promise = fn(context);
Expand Down Expand Up @@ -424,12 +419,3 @@ function reset() {
}
// @ts-ignore
process.instanaNamespaces = process.instanaNamespaces || {};

// @ts-ignore
function debug(...args) {
if (DEBUG_CLS) {
// fs.writeSync(1, `${util.format(...args)}\n`);
// @ts-ignore
process._rawDebug(`${util.format(...args)}`);
}
}

0 comments on commit ffd2660

Please sign in to comment.