Skip to content

Commit a28ee7a

Browse files
pr feedback
1 parent 5054f44 commit a28ee7a

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

WEB/Src/Web/Web.Tests/SampleConfigValidationTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void SampleConfig_AllCommentedPropertiesParseCorrectly()
4141
content = content.Replace("<!-- <EnablePerformanceCounterCollectionModule>true</EnablePerformanceCounterCollectionModule> -->", "<EnablePerformanceCounterCollectionModule>true</EnablePerformanceCounterCollectionModule>");
4242
content = content.Replace("<!-- <AddAutoCollectedMetricExtractor>true</AddAutoCollectedMetricExtractor> -->", "<AddAutoCollectedMetricExtractor>true</AddAutoCollectedMetricExtractor>");
4343
content = content.Replace("<!-- <EnableDependencyTrackingTelemetryModule>true</EnableDependencyTrackingTelemetryModule> -->", "<EnableDependencyTrackingTelemetryModule>true</EnableDependencyTrackingTelemetryModule>");
44+
content = content.Replace("<!-- <EnableRequestTrackingTelemetryModule>true</EnableRequestTrackingTelemetryModule> -->", "<EnableRequestTrackingTelemetryModule>true</EnableRequestTrackingTelemetryModule>");
4445

4546
// Write to temp config file
4647
string tempConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ApplicationInsights.config");
@@ -65,6 +66,7 @@ public void SampleConfig_AllCommentedPropertiesParseCorrectly()
6566
Assert.True(options.EnablePerformanceCounterCollectionModule);
6667
Assert.True(options.AddAutoCollectedMetricExtractor);
6768
Assert.True(options.EnableDependencyTrackingTelemetryModule);
69+
Assert.True(options.EnableRequestTrackingTelemetryModule);
6870
}
6971
finally
7072
{
@@ -128,6 +130,7 @@ public void SampleConfig_AllPropertiesMatchImplementation()
128130
Assert.Contains("EnableQuickPulseMetricStream", propertyNames);
129131
Assert.Contains("EnablePerformanceCounterCollectionModule", propertyNames);
130132
Assert.Contains("AddAutoCollectedMetricExtractor", propertyNames);
133+
Assert.Contains("EnableRequestTrackingTelemetryModule", propertyNames);
131134
Assert.Contains("EnableDependencyTrackingTelemetryModule", propertyNames);
132135
Assert.Contains("ApplicationVersion", propertyNames);
133136

@@ -142,6 +145,7 @@ public void SampleConfig_AllPropertiesMatchImplementation()
142145
Assert.Contains("EnableQuickPulseMetricStream", content);
143146
Assert.Contains("EnablePerformanceCounterCollectionModule", content);
144147
Assert.Contains("AddAutoCollectedMetricExtractor", content);
148+
Assert.Contains("EnableRequestTrackingTelemetryModule", content);
145149
Assert.Contains("EnableDependencyTrackingTelemetryModule", content);
146150
Assert.Contains("ApplicationVersion", content);
147151
}

WEB/Src/Web/Web/Implementation/ApplicationInsightsConfigurationReader.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private static string GetConfigFilePath()
9494
}
9595

9696
/// <summary>
97-
/// Reads the connection string from the XML configuration file.
97+
/// Reads all configuration options from the XML ApplicationInsights configuration file.
9898
/// </summary>
9999
/// <param name="configPath">The path to the config file.</param>
100100
/// <returns>The configuration options if found; otherwise, null.</returns>
@@ -146,12 +146,13 @@ private static ApplicationInsightsConfigOptions ReadConfigurationFromFile(string
146146
options.EnableRequestTrackingTelemetryModule = ReadBoolElement(root, "EnableRequestTrackingTelemetryModule");
147147

148148
// Track if any value was set
149-
if (options.DisableTelemetry.HasValue || options.SamplingRatio.HasValue ||
150-
options.TracesPerSecond.HasValue || options.DisableOfflineStorage.HasValue ||
151-
options.EnableQuickPulseMetricStream.HasValue || options.EnableTraceBasedLogsSampler.HasValue ||
152-
options.EnablePerformanceCounterCollectionModule.HasValue || options.AddAutoCollectedMetricExtractor.HasValue ||
153-
options.EnableDependencyTrackingTelemetryModule.HasValue || options.EnableRequestTrackingTelemetryModule.HasValue ||
154-
!string.IsNullOrWhiteSpace(options.StorageDirectory) || !string.IsNullOrWhiteSpace(options.ApplicationVersion))
149+
if (!hasAnyValue &&
150+
(options.DisableTelemetry.HasValue || options.SamplingRatio.HasValue ||
151+
options.TracesPerSecond.HasValue || options.DisableOfflineStorage.HasValue ||
152+
options.EnableQuickPulseMetricStream.HasValue || options.EnableTraceBasedLogsSampler.HasValue ||
153+
options.EnablePerformanceCounterCollectionModule.HasValue || options.AddAutoCollectedMetricExtractor.HasValue ||
154+
options.EnableDependencyTrackingTelemetryModule.HasValue || options.EnableRequestTrackingTelemetryModule.HasValue ||
155+
!string.IsNullOrWhiteSpace(options.StorageDirectory) || !string.IsNullOrWhiteSpace(options.ApplicationVersion)))
155156
{
156157
hasAnyValue = true;
157158
}

WEB/Src/Web/Web/applicationinsights.config.sample

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
<!-- Enable adaptive (rate-limit) sampling (default: true)
3535
When false, disables rate-limit sampling by setting SamplingRatio to 1.0 -->
36-
<!-- <EnableAdaptiveSampling>true</EnableAdaptiveSampling> -->
3736

3837
<!-- Sampling ratio: 0.0 to 1.0, where 1.0 = 100% of telemetry sent (default: 1.0) -->
3938
<!-- <SamplingRatio>1.0</SamplingRatio> -->
@@ -59,10 +58,7 @@
5958
=======================================================================
6059
-->
6160

62-
<!-- Enable Live Metrics (default: true) -->
63-
<!-- <EnableLiveMetrics>true</EnableLiveMetrics> -->
64-
65-
<!-- Enable Quick Pulse Metric Stream - alias for EnableLiveMetrics (default: true) -->
61+
<!-- Enable Quick Pulse Metric Stream (default: true) -->
6662
<!-- <EnableQuickPulseMetricStream>true</EnableQuickPulseMetricStream> -->
6763

6864
<!-- Enable trace-based logs sampler (default: true) -->

WEB/Src/Web/Web/net462/ApplicationInsights.config.uninstall.xdt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
22
<!-- Core Configuration -->
33
<ConnectionString xdt:Transform="Remove" />
4+
<DisableTelemetry xdt:Transform="Remove" />
45

56
<!-- Sampling & Rate Limiting -->
67
<SamplingRatio xdt:Transform="Remove" />

0 commit comments

Comments
 (0)