Skip to content

Commit 15b1ad2

Browse files
Update the App Insights version. (#7253)
Update the AppInsights version to 2.10
1 parent 5b7c505 commit 15b1ad2

8 files changed

Lines changed: 80 additions & 65 deletions

File tree

src/NuGetGallery.Core/NuGetGallery.Core.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,19 @@
223223
</ItemGroup>
224224
<ItemGroup>
225225
<PackageReference Include="NuGet.Services.Entities">
226-
<Version>2.49.0</Version>
226+
<Version>2.50.0-cmanu-ai23-2746063</Version>
227227
</PackageReference>
228228
<PackageReference Include="NuGet.Services.FeatureFlags">
229-
<Version>2.49.0</Version>
229+
<Version>2.50.0-cmanu-ai23-2746063</Version>
230230
</PackageReference>
231231
<PackageReference Include="NuGet.Services.Messaging.Email">
232-
<Version>2.49.0</Version>
232+
<Version>2.50.0-cmanu-ai23-2746063</Version>
233233
</PackageReference>
234234
<PackageReference Include="NuGet.Services.Validation">
235-
<Version>2.49.0</Version>
235+
<Version>2.50.0-cmanu-ai23-2746063</Version>
236236
</PackageReference>
237237
<PackageReference Include="NuGet.Services.Validation.Issues">
238-
<Version>2.49.0</Version>
238+
<Version>2.50.0-cmanu-ai23-2746063</Version>
239239
</PackageReference>
240240
<PackageReference Include="NuGet.StrongName.AnglicanGeek.MarkdownMailer">
241241
<Version>1.2.0</Version>

src/NuGetGallery.Services/NuGetGallery.Services.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<PrivateAssets>all</PrivateAssets>
111111
</PackageReference>
112112
<PackageReference Include="Microsoft.ApplicationInsights">
113-
<Version>2.2.0</Version>
113+
<Version>2.10.0</Version>
114114
</PackageReference>
115115
<PackageReference Include="Microsoft.AspNet.Mvc">
116116
<Version>5.2.3</Version>
@@ -125,7 +125,7 @@
125125
<Version>5.0.0-preview1.5665</Version>
126126
</PackageReference>
127127
<PackageReference Include="NuGet.Services.Logging">
128-
<Version>2.49.0</Version>
128+
<Version>2.50.0-cmanu-ai23-2746063</Version>
129129
</PackageReference>
130130
<PackageReference Include="System.Runtime">
131131
<Version>4.3.1</Version>

src/NuGetGallery/ApplicationInsights.config

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
3-
<!--
4-
Learn more about Application Insights configuration with ApplicationInsights.config here:
5-
http://go.microsoft.com/fwlink/?LinkID=513840
6-
7-
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
8-
-->
9-
<TelemetryProcessors>
10-
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
11-
</TelemetryProcessors>
123
<TelemetryInitializers>
134
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
145
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
@@ -50,6 +41,36 @@
5041
-->
5142
</Add>
5243
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
44+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AppServicesHeartbeatTelemetryModule, Microsoft.AI.WindowsServer"/>
45+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureInstanceMetadataTelemetryModule, Microsoft.AI.WindowsServer">
46+
<!--
47+
Remove individual fields collected here by adding them to the ApplicationInsighs.HeartbeatProvider
48+
with the following syntax:
49+
50+
<Add Type="Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights">
51+
<ExcludedHeartbeatProperties>
52+
<Add>osType</Add>
53+
<Add>location</Add>
54+
<Add>name</Add>
55+
<Add>offer</Add>
56+
<Add>platformFaultDomain</Add>
57+
<Add>platformUpdateDomain</Add>
58+
<Add>publisher</Add>
59+
<Add>sku</Add>
60+
<Add>version</Add>
61+
<Add>vmId</Add>
62+
<Add>vmSize</Add>
63+
<Add>subscriptionId</Add>
64+
<Add>resourceGroupName</Add>
65+
<Add>placementGroupId</Add>
66+
<Add>tags</Add>
67+
<Add>vmScaleSetName</Add>
68+
</ExcludedHeartbeatProperties>
69+
</Add>
70+
71+
NOTE: exclusions will be lost upon upgrade.
72+
-->
73+
</Add>
5374
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
5475
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
5576
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
@@ -60,7 +81,6 @@
6081
6182
NOTE: handler configuration will be lost upon NuGet upgrade.
6283
-->
63-
<Add>System.Web.Handlers.TransferRequestHandler</Add>
6484
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
6585
<Add>System.Web.StaticFileHandler</Add>
6686
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
@@ -72,11 +92,23 @@
7292
</Handlers>
7393
</Add>
7494
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
95+
<Add Type="Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule, Microsoft.AI.Web"/>
7596
</TelemetryModules>
76-
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
77-
<!--
97+
<ApplicationIdProvider Type="Microsoft.ApplicationInsights.Extensibility.Implementation.ApplicationId.ApplicationInsightsApplicationIdProvider, Microsoft.ApplicationInsights"/>
98+
<TelemetrySinks>
99+
<Add Name="default">
100+
<TelemetryProcessors>
101+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
102+
<Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
103+
</TelemetryProcessors>
104+
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
105+
</Add>
106+
</TelemetrySinks>
107+
<!--
78108
Learn more about Application Insights configuration with ApplicationInsights.config here:
79109
http://go.microsoft.com/fwlink/?LinkID=513840
80110
81111
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
82-
--></ApplicationInsights>
112+
-->
113+
</ApplicationInsights>
114+

src/NuGetGallery/NuGetGallery.csproj

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,13 @@
21142114
<PackageReference Include="Markdig.Signed">
21152115
<Version>0.15.4</Version>
21162116
</PackageReference>
2117+
<PackageReference Include="Microsoft.ApplicationInsights.TraceListener">
2118+
<Version>2.10.0</Version>
2119+
<ExcludeAssets>contentFiles</ExcludeAssets>
2120+
</PackageReference>
2121+
<PackageReference Include="Microsoft.ApplicationInsights.Web">
2122+
<Version>2.10.0</Version>
2123+
</PackageReference>
21172124
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
21182125
<Version>2.2.0</Version>
21192126
</PackageReference>
@@ -2124,7 +2131,7 @@
21242131
<Version>2.2.0</Version>
21252132
</PackageReference>
21262133
<PackageReference Include="NuGet.Services.Licenses">
2127-
<Version>2.49.0</Version>
2134+
<Version>2.50.0-cmanu-ai23-2746063</Version>
21282135
</PackageReference>
21292136
<PackageReference Include="NuGet.StrongName.AnglicanGeek.MarkdownMailer">
21302137
<Version>1.2.0</Version>
@@ -2191,30 +2198,6 @@
21912198
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
21922199
<PrivateAssets>all</PrivateAssets>
21932200
</PackageReference>
2194-
<PackageReference Include="Microsoft.ApplicationInsights">
2195-
<Version>2.2.0</Version>
2196-
</PackageReference>
2197-
<PackageReference Include="Microsoft.ApplicationInsights.Agent.Intercept">
2198-
<Version>2.0.6</Version>
2199-
</PackageReference>
2200-
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector">
2201-
<Version>2.2.0</Version>
2202-
</PackageReference>
2203-
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector">
2204-
<Version>2.2.0</Version>
2205-
</PackageReference>
2206-
<PackageReference Include="Microsoft.ApplicationInsights.TraceListener">
2207-
<Version>2.2.0</Version>
2208-
</PackageReference>
2209-
<PackageReference Include="Microsoft.ApplicationInsights.Web">
2210-
<Version>2.2.0</Version>
2211-
</PackageReference>
2212-
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer">
2213-
<Version>2.2.0</Version>
2214-
</PackageReference>
2215-
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel">
2216-
<Version>2.2.0</Version>
2217-
</PackageReference>
22182201
<PackageReference Include="Microsoft.AspNet.DynamicData.EFProvider">
22192202
<Version>6.0.0</Version>
22202203
</PackageReference>
@@ -2348,16 +2331,16 @@
23482331
<Version>5.0.0-preview1.5665</Version>
23492332
</PackageReference>
23502333
<PackageReference Include="NuGet.Services.KeyVault">
2351-
<Version>2.49.0</Version>
2334+
<Version>2.50.0-cmanu-ai23-2746063</Version>
23522335
</PackageReference>
23532336
<PackageReference Include="NuGet.Services.Logging">
2354-
<Version>2.49.0</Version>
2337+
<Version>2.50.0-cmanu-ai23-2746063</Version>
23552338
</PackageReference>
23562339
<PackageReference Include="NuGet.Services.Owin">
2357-
<Version>2.49.0</Version>
2340+
<Version>2.50.0-cmanu-ai23-2746063</Version>
23582341
</PackageReference>
23592342
<PackageReference Include="NuGet.Services.Sql">
2360-
<Version>2.49.0</Version>
2343+
<Version>2.50.0-cmanu-ai23-2746063</Version>
23612344
</PackageReference>
23622345
<PackageReference Include="Owin">
23632346
<Version>1.0.0</Version>
@@ -2377,9 +2360,6 @@
23772360
<PackageReference Include="System.Diagnostics.Debug">
23782361
<Version>4.3.0</Version>
23792362
</PackageReference>
2380-
<PackageReference Include="System.Diagnostics.DiagnosticSource">
2381-
<Version>4.3.0</Version>
2382-
</PackageReference>
23832363
<PackageReference Include="System.Linq.Expressions">
23842364
<Version>4.3.0</Version>
23852365
</PackageReference>

src/NuGetGallery/Telemetry/ClientInformationTelemetryEnricher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ public void Initialize(ITelemetry telemetry)
2121
{
2222
// ClientVersion is available for NuGet clients starting version 4.1.0-~4.5.0
2323
// Was deprecated and replaced by Protocol version
24-
telemetry.Context.Properties.Add(
24+
telemetry.Context.GlobalProperties.Add(
2525
TelemetryService.ClientVersion,
2626
httpContext.Request.Headers[GalleryConstants.ClientVersionHeaderName]);
2727

28-
telemetry.Context.Properties.Add(
28+
telemetry.Context.GlobalProperties.Add(
2929
TelemetryService.ProtocolVersion,
3030
httpContext.Request.Headers[GalleryConstants.NuGetProtocolHeaderName]);
3131

32-
telemetry.Context.Properties.Add(TelemetryService.ClientInformation, httpContext.GetClientInformation());
32+
telemetry.Context.GlobalProperties.Add(TelemetryService.ClientInformation, httpContext.GetClientInformation());
3333

3434
// Is the user authenticated or this is an anonymous request?
35-
telemetry.Context.Properties.Add(TelemetryService.IsAuthenticated, httpContext.Request.IsAuthenticated.ToString());
35+
telemetry.Context.GlobalProperties.Add(TelemetryService.IsAuthenticated, httpContext.Request.IsAuthenticated.ToString());
3636
}
3737
}
3838
}

src/NuGetGallery/Telemetry/ClientTelemetryPIIProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Process(ITelemetry item)
2828
private void ModifyItem(ITelemetry item)
2929
{
3030
var requestTelemetryItem = item as RequestTelemetry;
31-
if(requestTelemetryItem != null)
31+
if(requestTelemetryItem != null && requestTelemetryItem.Url != null)
3232
{
3333
var route = GetCurrentRoute();
3434
if(route == null)

src/NuGetGallery/Web.config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@
319319
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah, Version=1.2.14706.0, Culture=neutral, PublicKeyToken=57eac04b2e0f138e, processorArchitecture=MSIL"/>
320320
<add name="AsyncFileUpload" type="NuGetGallery.AsyncFileUpload.AsyncFileUploadModule, NuGetGallery"/>
321321
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
322+
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"/>
322323
</httpModules>
323324
<httpHandlers>
324325
<!-- Remove Default HTTP Handler -->
@@ -369,6 +370,8 @@
369370
<remove name="RoleManager"/>
370371
<remove name="ApplicationInsightsWebTracking"/>
371372
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler"/>
373+
<remove name="TelemetryCorrelationHttpModule"/>
374+
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="managedHandler"/>
372375
</modules>
373376
<validation validateIntegratedModeConfiguration="false"/>
374377
<httpErrors errorMode="DetailedLocalOnly">
@@ -766,7 +769,7 @@
766769
</dependentAssembly>
767770
<dependentAssembly>
768771
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
769-
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/>
772+
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0"/>
770773
</dependentAssembly>
771774
<dependentAssembly>
772775
<assemblyIdentity name="System.IO.Compression" publicKeyToken="B77A5C561934E089" culture="neutral"/>

tests/NuGetGallery.Facts/Telemetry/ClientInformationTelemetryEnricherTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void EnrichesOnlyRequestsTelemetry(Type telemetryType)
3737
{
3838
// Arrange
3939
var telemetry = (ITelemetry)telemetryType.GetConstructor(new Type[] { }).Invoke(new object[] { });
40-
telemetry.Context.Properties.Add("Test", "blala");
40+
telemetry.Context.GlobalProperties.Add("Test", "blala");
4141

4242
var headers = new NameValueCollection
4343
{
@@ -54,11 +54,11 @@ public void EnrichesOnlyRequestsTelemetry(Type telemetryType)
5454
// Assert
5555
if (telemetry is RequestTelemetry)
5656
{
57-
Assert.Equal(5, telemetry.Context.Properties.Count);
57+
Assert.Equal(5, telemetry.Context.GlobalProperties.Count);
5858
}
5959
else
6060
{
61-
Assert.Equal(1, telemetry.Context.Properties.Count);
61+
Assert.Equal(1, telemetry.Context.GlobalProperties.Count);
6262
}
6363
}
6464

@@ -79,7 +79,7 @@ public void EnrichesTelemetryWithClientVersion()
7979
enricher.Initialize(telemetry);
8080

8181
// Assert
82-
Assert.Equal("5.0.0", telemetry.Properties[TelemetryService.ClientVersion]);
82+
Assert.Equal("5.0.0", telemetry.Context.GlobalProperties[TelemetryService.ClientVersion]);
8383
}
8484

8585
[Fact]
@@ -99,7 +99,7 @@ public void EnrichesTelemetryWithProtocolVersion()
9999
enricher.Initialize(telemetry);
100100

101101
// Assert
102-
Assert.Equal("5.0.0", telemetry.Properties[TelemetryService.ProtocolVersion]);
102+
Assert.Equal("5.0.0", telemetry.Context.GlobalProperties[TelemetryService.ProtocolVersion]);
103103
}
104104

105105
[Fact]
@@ -119,7 +119,7 @@ public void EnrichesTelemetryWithClientInfo()
119119
enricher.Initialize(telemetry);
120120

121121
// Assert
122-
Assert.NotEmpty(telemetry.Properties[TelemetryService.ClientInformation]);
122+
Assert.NotEmpty(telemetry.Context.GlobalProperties[TelemetryService.ClientInformation]);
123123
}
124124

125125
[Theory]
@@ -135,7 +135,7 @@ public void EnrichesTelemetryWithIsAuthenticated(bool isAuthenticated)
135135
enricher.Initialize(telemetry);
136136

137137
// Assert
138-
Assert.Equal(isAuthenticated, bool.Parse(telemetry.Properties[TelemetryService.IsAuthenticated]));
138+
Assert.Equal(isAuthenticated, bool.Parse(telemetry.Context.GlobalProperties[TelemetryService.IsAuthenticated]));
139139
}
140140

141141
private TestableClientInformationTelemetryEnricher CreateTestEnricher(NameValueCollection headers, bool isAuthenticated = false)

0 commit comments

Comments
 (0)