Skip to content

Commit bacf425

Browse files
Merge pull request #102 from stackify/task/POPS-261
POPS-261: Fix custom metric issue when Apps is deployed to Kubernetes
2 parents d151cd9 + c570556 commit bacf425

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Src/StackifyLib/Models/EnvironmentDetail.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ private void GetAzureInfo()
109109

110110
public static string GetDeviceName()
111111
{
112-
var deviceName = Environment.MachineName;
112+
var deviceName = Environment.GetEnvironmentVariable("STACKIFY_DEVICE_NAME");
113+
if (!String.IsNullOrEmpty(deviceName))
114+
{
115+
return deviceName.Substring(0, deviceName.Length > 60 ? 60 : deviceName.Length);
116+
}
117+
118+
deviceName = Environment.MachineName;
113119

114120
if (AzureConfig.InAzure && ((AzureConfig.IsWebsite) || (AzureConfig.InAzure && Environment.MachineName.StartsWith("RD"))))
115121
{
@@ -194,7 +200,13 @@ public static string GetEC2InstanceId()
194200
#else
195201
public static string GetDeviceName()
196202
{
197-
var deviceName = Environment.MachineName;
203+
var deviceName = Environment.GetEnvironmentVariable("STACKIFY_DEVICE_NAME");
204+
if (!String.IsNullOrEmpty(deviceName))
205+
{
206+
return deviceName.Substring(0, deviceName.Length > 60 ? 60 : deviceName.Length);
207+
}
208+
209+
deviceName = Environment.MachineName;
198210

199211
if (AzureConfig.InAzure && ((AzureConfig.IsWebsite) || (AzureConfig.InAzure && Environment.MachineName.StartsWith("RD"))))
200212
{

0 commit comments

Comments
 (0)