Better rundown defaults and parameterization (#2732)
authorWiktor Kopec <wiktork@microsoft.com>
Tue, 9 Nov 2021 23:15:32 +0000 (15:15 -0800)
committerGitHub <noreply@github.com>
Tue, 9 Nov 2021 23:15:32 +0000 (15:15 -0800)
* Better rundown defaults and parameterization

* PR Feedback

* Bring back rundown for http trace profile

src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/AggregateSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/AspNetTriggerSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/EventPipeProviderSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/GCDumpSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/HttpRequestSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/LoggingSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MonitoringSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/SampleProfilerConfiguration.cs

index d002d73677359d4c99bb4640150cd9f815ac6297..1466f02a5315b30e870d7131778e095f4c0e55fb 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using Microsoft.Diagnostics.NETCore.Client;
@@ -22,5 +23,11 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
             // CONSIDER: Might have to deduplicate providers and merge them together.
             return _configurations.SelectMany(c => c.GetProviders()).ToList();
         }
+
+        public override bool RequestRundown
+        {
+            get => _configurations.Any(c => c.RequestRundown);
+            set => throw new NotSupportedException();
+        }
     }
 }
index 415c29bf519c18489a201cf3a1b11a835fac9c3d..99d9bc4231a5a163b01ae7fd820987c463514d6b 100644 (file)
@@ -19,6 +19,7 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public AspNetTriggerSourceConfiguration(float? heartbeatIntervalSeconds = null)
         {
+            RequestRundown = false;
             _heartbeatIntervalSeconds = heartbeatIntervalSeconds;
         }
 
index 11a4a88f94c27edaa8d12bf7ea091111fc267431..6d8109f80b26f8b2d5218f8d04eb8e969595e915 100644 (file)
@@ -11,13 +11,12 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
     public sealed class EventPipeProviderSourceConfiguration : MonitoringSourceConfiguration
     {
         private readonly IEnumerable<EventPipeProvider> _providers;
-        private readonly bool _requestRundown;
         private readonly int _bufferSizeInMB;
 
         public EventPipeProviderSourceConfiguration(bool requestRundown = true, int bufferSizeInMB = 256, params EventPipeProvider[] providers)
         {
             _providers = providers;
-            _requestRundown = requestRundown;
+            RequestRundown = requestRundown;
             _bufferSizeInMB = bufferSizeInMB;
         }
 
@@ -26,8 +25,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
             return _providers.ToList();
         }
 
-        public override bool RequestRundown => _requestRundown;
-
         public override int BufferSizeInMB => _bufferSizeInMB;
     }
 }
index afcf9be8ff87cf19c088411e6f487832763fbd14..8ddad7ff5d5595eead1e8fc4c4747200928e29d1 100644 (file)
@@ -11,6 +11,11 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 {
     public sealed class GCDumpSourceConfiguration : MonitoringSourceConfiguration
     {
+        public GCDumpSourceConfiguration()
+        {
+            RequestRundown = false;
+        }
+
         public override IList<EventPipeProvider> GetProviders()
         {
             var providers = new List<EventPipeProvider>()
index 904e8d843f87d76a75355fdb9805c7cb02ae2cac..ef58ab5b6eb76870f7c0b0deed9e78a5165a08a1 100644 (file)
@@ -10,6 +10,12 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 {
     public sealed class HttpRequestSourceConfiguration : MonitoringSourceConfiguration
     {
+        public HttpRequestSourceConfiguration()
+        {
+            //CONSIDER removing rundown for this scenario.
+            RequestRundown = true;
+        }
+
         private const string DiagnosticFilterString =
                 "Microsoft.AspNetCore/Microsoft.AspNetCore.Hosting.HttpRequestIn.Start@Activity1Start:-" +
                     "Request.Scheme" +
index 3cd63d20f11a390ccf8db01308272194c560734d..f30749b193f4953a39d7d66af2bff7d462b60951 100644 (file)
@@ -22,6 +22,7 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
         /// </summary>
         public LoggingSourceConfiguration(LogLevel level, LogMessageType messageType, IDictionary<string, LogLevel?> filterSpecs, bool useAppFilters)
         {
+            RequestRundown = false;
             _filterSpecs = ToFilterSpecsString(filterSpecs, useAppFilters);
             _keywords = (long)ToKeywords(messageType);
             _level = ToEventLevel(level);
index 30d4f970f8095e65ae94cb49b876ae7a03fc9297..4047e1124228f0e39ec00545e1be70eddac00b89 100644 (file)
@@ -19,6 +19,7 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public MetricSourceConfiguration(float metricIntervalSeconds, IEnumerable<string> customProviderNames)
         {
+            RequestRundown = false;
             if (customProviderNames == null)
             {
                 throw new ArgumentNullException(nameof(customProviderNames));
index 2fc5c24d80ae36ddf06c36571262827a7e349d8a..00486370f5c491089ecffdd39f5f08600dddf66a 100644 (file)
@@ -32,7 +32,7 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public abstract IList<EventPipeProvider> GetProviders();
 
-        public virtual bool RequestRundown => true;
+        public virtual bool RequestRundown { get; set; } = true;
 
         public virtual int BufferSizeInMB => 256;
     }
index 62b5a97974bf3c32e561f7535f6e6cbc17b1cba0..f7079791ffa83a4fd07aee17ad502d1e60297d13 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using Microsoft.Diagnostics.NETCore.Client;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics.Tracing;
 
@@ -18,6 +19,10 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public override int BufferSizeInMB => 1;
 
-        public override bool RequestRundown => false;
+        public override bool RequestRundown
+        {
+            get => false;
+            set => throw new NotSupportedException();
+        }
     }
 }