cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add manually x-dynatrace headers into Load Runner REST API script?

nayeem_sm
Newcomer
 
1 REPLY 1

nayeem_sm
Newcomer

Hello Folks,

Eventually, I had added the custom piece of code under global.h file and written the function in front of web_custom_request. However, for monitoring purposes we are using Dyna trace as web, but unfortunately we were unable to seeing the Tagged requests from Load Runner script.

Please find the custom code & function written in front of custom request for the same.

addDynaTraceHeader("NA=Transaction Name;PC= Transaction Name");

Custom code under global.h

void addDynaTraceHeader(char* header){

char* headerValue;

int headerValueLength;

int vuserid, scid;

char *groupid, *timestamp;

char* vuserstring=(char*) malloc(sizeof(char) * 10);



web_save_timestamp_param("TimeStamp", LAST);

timestamp=lr_eval_string("{TimeStamp}");



lr_whoami(&vuserid, &groupid, &scid);

itoa(vuserid,vuserstring,10);



headerValueLength = strlen(header) + 4 + strlen(vuserstring) + 4 + strlen(timestamp) + 1;

headerValue = (char*) malloc(sizeof(char) * headerValueLength);

strcpy(headerValue, header);

strcat(headerValue,";VU=");

strcat(headerValue,vuserstring);

strcat(headerValue,";ID=");

strcat(headerValue,timestamp);



web_add_header("X-dynaTrace", headerValue);

free(headerValue);

free(vuserstring);

}

Please do the needful help to us...!!!!!