Skip to content

Commit

Permalink
Do not add tracing headers in Azure SDK outgoing requests (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored Mar 11, 2022
1 parent 033d1f4 commit ebebcca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions AutoCollection/HttpDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ class AutoCollectHttpDependencies {
!(<any>request)[AutoCollectHttpDependencies.alreadyAutoCollectedFlag];

// If someone else patched traceparent headers onto this request
if ((<any>options).headers && (<any>options).headers["user-agent"] && (<any>options).headers["user-agent"].toString().indexOf("azsdk-js") !== -1) {
shouldCollect = false;
let userAgentHeader = null;

// Azure SDK special handling
if ((<any>options).headers) {
userAgentHeader = (<any>options).headers["User-Agent"] || (<any>options).headers["user-agent"];
if (userAgentHeader && userAgentHeader.toString().indexOf("azsdk-js") !== -1) {
shouldCollect = false;
}
}

(<any>request)[AutoCollectHttpDependencies.alreadyAutoCollectedFlag] = true;
Expand Down

0 comments on commit ebebcca

Please sign in to comment.