Enter Case number reference for associated cases.

Case #

Type: APM as a Service

Include any information that is for INTERNAL use only

Detail the contextual information specific to the issue; i.e. Product, Version, Agent, System, etc.

  • Dynatrace Recorder

 

Describe the problem, from the user perspective

I want to generate unique host headers every time a script runs. How can I do it?

Clearly list the Steps to resolve the issue

Add a GUID to a host header by using JavaScript, such as the example below, in a Custom action.

See Custom actions in the help pages for more information.

 var guidSequence4 = function () { 
 return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); 
}; 
alert(guidSequence4()); 
var generateFakeGuid = function () { 

 return (guidSequence4() + guidSequence4() + "-" + guidSequence4() + "-"
 + guidSequence4() + "-" + guidSequence4() + "-" + guidSequence4() + 
guidSequence4() + guidSequence4()); 
}; 
id = generateFakeGuid(); 
alert(id);