Skip to content

Commit

Permalink
Use ServerCommon's Response Code Processor (#3999)
Browse files Browse the repository at this point in the history
* Added Nuget.Services.Logging; moved to TelemetryResponseCodeProcessor
* Added binding redirect for AI
  • Loading branch information
loic-sharma authored May 26, 2017
1 parent 863b88b commit 49747f1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 44 deletions.
13 changes: 11 additions & 2 deletions src/NuGetGallery/App_Start/OwinStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Microsoft.Owin.Logging;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using NuGet.Services.Logging;
using NuGetGallery.Authentication;
using NuGetGallery.Authentication.Providers;
using NuGetGallery.Authentication.Providers.Cookie;
Expand Down Expand Up @@ -64,8 +65,16 @@ public static void Configuration(IAppBuilder app)

var telemetryProcessorChainBuilder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;

// Add filters
telemetryProcessorChainBuilder.Use(next => new TelemetryResponseCodeFilter(next));
// Add processors
telemetryProcessorChainBuilder.Use(next =>
{
var processor = new TelemetryResponseCodeProcessor(next);
processor.SuccessfulResponseCodes.Add(400);
processor.SuccessfulResponseCodes.Add(404);
return processor;
});

// Note: sampling rate must be a factor 100/N where N is a whole number
// e.g.: 50 (= 100/2), 33.33 (= 100/3), 25 (= 100/4), ...
Expand Down
10 changes: 4 additions & 6 deletions src/NuGetGallery/NuGetGallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@
<Reference Include="NuGet.Frameworks, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\NuGet.Frameworks.4.3.0-preview1-2507\lib\net45\NuGet.Frameworks.dll</HintPath>
</Reference>
<Reference Include="NuGet.Logging, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NuGet.Logging.3.5.0-beta-1160\lib\net45\NuGet.Logging.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NuGet.Packaging, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\NuGet.Packaging.4.3.0-preview1-2507\lib\net45\NuGet.Packaging.dll</HintPath>
</Reference>
Expand All @@ -444,6 +439,10 @@
<HintPath>..\..\packages\NuGet.Services.KeyVault.1.0.0.0\lib\net45\NuGet.Services.KeyVault.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NuGet.Services.Logging, Version=2.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\NuGet.Services.Logging.2.2.1\lib\net452\NuGet.Services.Logging.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NuGet.Services.Platform.Client, Version=3.0.29.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NuGet.Services.Platform.Client.3.0.29-r-master\lib\portable-net45+wp80+win\NuGet.Services.Platform.Client.dll</HintPath>
Expand Down Expand Up @@ -774,7 +773,6 @@
<Compile Include="Security\UserSecurityPolicySubscriptionContext.cs" />
<Compile Include="Telemetry\ClientInformationTelemetryEnricher.cs" />
<Compile Include="Telemetry\QuietExceptionLogger.cs" />
<Compile Include="Telemetry\TelemetryResponseCodeFilter.cs" />
<Compile Include="Infrastructure\Authentication\CredentialBuilder.cs" />
<Compile Include="Infrastructure\Authentication\CredentialValidator.cs" />
<Compile Include="Infrastructure\Authentication\ICredentialBuilder.cs" />
Expand Down
35 changes: 0 additions & 35 deletions src/NuGetGallery/Telemetry/TelemetryResponseCodeFilter.cs

This file was deleted.

4 changes: 4 additions & 0 deletions src/NuGetGallery/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="NuGet.Common" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="NuGet.Frameworks" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="NuGet.Logging" version="3.5.0-beta-1160" targetFramework="net46" />
<package id="NuGet.Packaging" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="NuGet.Packaging.Core" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="NuGet.Protocol" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="NuGet.Services.KeyVault" version="1.0.0.0" targetFramework="net46" />
<package id="NuGet.Services.Logging" version="2.2.1.0" targetFramework="net46" />
<package id="NuGet.Services.Platform.Client" version="3.0.29-r-master" targetFramework="net46" />
<package id="NuGet.Versioning" version="4.3.0-preview1-2507" targetFramework="net46" />
<package id="ODataNullPropagationVisitor" version="0.5.4237.2641" targetFramework="net46" />
Expand Down

0 comments on commit 49747f1

Please sign in to comment.