Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Add ISV tracking GUID #212

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion brokerserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<operation>-<serviceId>' ex: 'poll-fb9bc99e-0aa9-11e6-8a8a-000d3a002ed5'
var addListeners = function(serviceId, serviceModule) {
Expand Down
4 changes: 4 additions & 0 deletions lib/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ var validateConfigurations = function() {
});
};

module.exports.getISVTrackingGUID = function() {
return process.env['ISV_TRACKING_GUID'];
};

module.exports.getConfigurations = function() {
validateConfigurations();

Expand Down
13 changes: 12 additions & 1 deletion lib/common/msRestRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
};
Expand All @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions pcf-tile/tile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down