Skip to content

Commit 02888af

Browse files
Merge pull request #380 from Azure/chgagnon/addProperties
Add site event properties
2 parents 2e1df38 + 84d6d66 commit 02888af

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Telemetry/TelemetryCommonProperties.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ public class TelemetryCommonProperties
1414
private readonly string _productVersion;
1515
private readonly string _azureFunctionsEnvironment;
1616
private readonly bool _hasWebsiteInstanceId;
17+
private readonly string _websiteInstanceId;
18+
private readonly string _websiteSiteName;
1719
private readonly string _functionsWorkerRuntime;
1820

1921
public TelemetryCommonProperties(string productVersion, TelemetryClient telemetryClient, IConfiguration config)
2022
{
2123
this._productVersion = productVersion;
2224
this._userLevelCacheWriter = new UserLevelCacheWriter(telemetryClient);
2325
this._azureFunctionsEnvironment = config.GetValue(AZURE_FUNCTIONS_ENVIRONMENT_KEY, "");
24-
this._hasWebsiteInstanceId = config.GetValue(WEBSITE_INSTANCE_ID_KEY, "") != "";
26+
this._websiteInstanceId = config.GetValue(WEBSITE_INSTANCE_ID_KEY, "");
27+
this._hasWebsiteInstanceId = !string.IsNullOrEmpty(this._websiteInstanceId);
28+
this._websiteSiteName = config.GetValue(WEBSITE_SITE_NAME_KEY, "");
2529
this._functionsWorkerRuntime = config.GetValue(FUNCTIONS_WORKER_RUNTIME_KEY, "");
2630
}
2731

@@ -32,10 +36,13 @@ public TelemetryCommonProperties(string productVersion, TelemetryClient telemetr
3236
private const string MachineId = "MachineId";
3337
private const string AzureFunctionsEnvironment = "AzureFunctionsEnvironment";
3438
private const string HasWebsiteInstanceId = "HasWebsiteInstanceId";
39+
private const string WebsiteInstanceId = "WebsiteInstanceId";
40+
private const string WebsiteSiteName = "WebsiteSiteName";
3541
private const string FunctionsWorkerRuntime = "FunctionsWorkerRuntime";
3642

3743
private const string AZURE_FUNCTIONS_ENVIRONMENT_KEY = "AZURE_FUNCTIONS_ENVIRONMENT";
3844
private const string WEBSITE_INSTANCE_ID_KEY = "WEBSITE_INSTANCE_ID";
45+
private const string WEBSITE_SITE_NAME_KEY = "WEBSITE_SITE_NAME";
3946
private const string FUNCTIONS_WORKER_RUNTIME_KEY = "FUNCTIONS_WORKER_RUNTIME";
4047

4148
public Dictionary<string, string> GetTelemetryCommonProperties()
@@ -47,6 +54,8 @@ public Dictionary<string, string> GetTelemetryCommonProperties()
4754
{MachineId, this.GetMachineId()},
4855
{AzureFunctionsEnvironment, this._azureFunctionsEnvironment},
4956
{HasWebsiteInstanceId, this._hasWebsiteInstanceId.ToString()},
57+
{WebsiteInstanceId, this._websiteInstanceId },
58+
{WebsiteSiteName, this._websiteSiteName},
5059
{FunctionsWorkerRuntime, this._functionsWorkerRuntime}
5160
};
5261
}

0 commit comments

Comments
 (0)