Fix issue with dotnet-counters not being able to target user-defined EventSource...
authorSung Yoon Whang <suwhang@microsoft.com>
Tue, 30 Apr 2019 01:28:06 +0000 (18:28 -0700)
committerGitHub <noreply@github.com>
Tue, 30 Apr 2019 01:28:06 +0000 (18:28 -0700)
src/Tools/dotnet-counters/ConsoleWriter.cs
src/Tools/dotnet-counters/CounterProvider.cs

index 2963d2f8426808120d043cdf609710dd7ba29dc4..1886dfd08f1cfdfad9a0c620c9aa118fbad45218 100644 (file)
@@ -83,8 +83,12 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 }
                 else
                 {
-                    // If it's from an provider, just append it at the end.
+                    // If it's from an unknown provider, just append it at the end.
                     string displayName = payload.GetDisplay();
+                    if (string.IsNullOrEmpty(displayName))
+                    {
+                        displayName = payload.GetName();
+                    }
                     int left = displayName.Length + 7; // displayName + " : "
                     int row = maxRow;
                     displayPosition[name] = (left, row);
index 03c8b68c39cac29648c891f6a1a36b6db92f5679..07400071b3c5689f7cf772337f40b7a0d2a1c617 100644 (file)
@@ -43,7 +43,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
 
         public static string SerializeUnknownProviderName(string unknownCounterProviderName, int interval)
         {
-            return $"{unknownCounterProviderName}:0xffffffff:0x4:EventCounterIntervalSec={interval}";
+            return $"{unknownCounterProviderName}:ffffffff:4:EventCounterIntervalSec={interval}";
         }
 
         public IReadOnlyList<CounterProfile> GetAllCounters() => Counters.Values.ToList();