diff --git a/brokerserver.js b/brokerserver.js index 6b38340..92d58f4 100644 --- a/brokerserver.js +++ b/brokerserver.js @@ -12,7 +12,7 @@ var config = common.getConfigurations(); var broker = new Broker(config); var log = common.getLogger(common.LOG_CONSTANTS.BROKER); -msRestRequest.init(config.azure); +msRestRequest.init(config.azure, common.getISVTrackingGUID()); // Brokers listen for '-' ex: 'poll-fb9bc99e-0aa9-11e6-8a8a-000d3a002ed5' var addListeners = function(serviceId, serviceModule) { diff --git a/lib/common/index.js b/lib/common/index.js index 124675b..b5d625f 100644 --- a/lib/common/index.js +++ b/lib/common/index.js @@ -119,6 +119,10 @@ var validateConfigurations = function() { }); }; +module.exports.getISVTrackingGUID = function() { + return process.env['ISV_TRACKING_GUID']; +}; + module.exports.getConfigurations = function() { validateConfigurations(); diff --git a/lib/common/msRestRequest.js b/lib/common/msRestRequest.js index 860f619..d691b72 100644 --- a/lib/common/msRestRequest.js +++ b/lib/common/msRestRequest.js @@ -14,9 +14,19 @@ var DEFAULT_RETRY_INTERVAL = 3000; //ms var AZURE_RETRY_ERROR_CODES = [408, 429, 500, 502, 503, 504]; -exports.init = function(azureProperties) { +var DEFAULT_ISV_TRACKING_GUID = '563bbbca-7944-4791-b9c6-8af0928114ac'; + +var ISVTrackingGUID; + +exports.init = function(azureProperties, _ISVTrackingGUID) { var environmentName = azureProperties.environment; var environment = common.getEnvironment(environmentName); + + if (_ISVTrackingGUID !== undefined && _ISVTrackingGUID !== '') { + ISVTrackingGUID = _ISVTrackingGUID; + } else { + ISVTrackingGUID = DEFAULT_ISV_TRACKING_GUID; + } Token.init(environment, azureProperties, common.API_VERSION[environmentName]['AZURE_ACTIVE_DIRECTORY']); }; @@ -26,6 +36,7 @@ function msRestRequest(url, qs, method, headers, data, callback) { var tokenExpired = false; _.extend(headers, {'Authorization': ''}); + _.extend(headers, {'User-Agent': 'pid-' + ISVTrackingGUID}); var requestObject = { url: url, qs: qs, method: method, headers: headers}; if (data) { diff --git a/pcf-tile/tile.yml b/pcf-tile/tile.yml index 2bb9408..dcfb902 100644 --- a/pcf-tile/tile.yml +++ b/pcf-tile/tile.yml @@ -309,6 +309,11 @@ forms: "userRoles": ["db_owner"] } label: Default Parameters of Azure SQL Database Failover Group service + - name: isv_tracking_guid + configurable: false + type: string + label: ISV Tracking GUID + default: f09bfe12-4077-4c05-8801-5038e052f399 # Add any dependencies your tile has on other installed products. # This is often appropriate when using automatic service provisioning