Skip to content

Commit

Permalink
Merge branch 'develop' into jacksonweber/fix-auto-attach-version
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonWeber authored Feb 26, 2024
2 parents 5a68d40 + 1b53f5a commit 7f66f40
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
17 changes: 14 additions & 3 deletions AutoCollection/CorrelationContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,13 @@ export class CorrelationContextManager {
this.cls = require("continuation-local-storage");
}
}

CorrelationContextManager.session = this.cls.createNamespace("AI-CLS-Session");
try {
CorrelationContextManager.session = this.cls.createNamespace("AI-CLS-Session");
} catch (error) {
Logging.warn("Failed to create AI-CLS-Session namespace. Correlation of requests may be lost", Util.dumpObj(error));
this.enabled = false;
return;
}

DiagChannel.registerContextPreservation((cb) => {
try {
Expand Down Expand Up @@ -295,7 +300,13 @@ export class CorrelationContextManager {
public static reset() {
if (CorrelationContextManager.hasEverEnabled) {
CorrelationContextManager.session = null;
CorrelationContextManager.session = this.cls.createNamespace("AI-CLS-Session");
try {
CorrelationContextManager.session = this.cls.createNamespace("AI-CLS-Session");
} catch (error) {
Logging.warn("Failed to create AI-CLS-Session namespace. Correlation of requests may be lost", Util.dumpObj(error));
this.enabled = false;
return;
}
}
}

Expand Down
46 changes: 29 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7f66f40

Please sign in to comment.