Skip to content

Commit

Permalink
Update telemetry processors (#4059)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtivel committed Jun 6, 2017
1 parent 95f00cd commit 0aea0dd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/NuGetGallery/App_Start/OwinStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ public static void Configuration(IAppBuilder app)
// Add processors
telemetryProcessorChainBuilder.Use(next =>
{
var processor = new TelemetryResponseCodeProcessor(next);
var processor = new RequestTelemetryProcessor(next);
processor.SuccessfulResponseCodes.Add(400);
processor.SuccessfulResponseCodes.Add(404);
return processor;
});

telemetryProcessorChainBuilder.Use(
next => new ExceptionTelemetryProcessor(next, Telemetry.TelemetryClient));

// 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), ...
// https://azure.microsoft.com/en-us/documentation/articles/app-insights-sampling/
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetGallery/NuGetGallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@
<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>
<Reference Include="NuGet.Services.Logging, Version=2.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\NuGet.Services.Logging.2.2.3\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">
Expand Down
11 changes: 8 additions & 3 deletions src/NuGetGallery/Telemetry/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ namespace NuGetGallery
{
internal static class Telemetry
{
private static readonly TelemetryClient _telemetryClient = new TelemetryClient();
static Telemetry()
{
TelemetryClient = new TelemetryClient();
}

internal static TelemetryClient TelemetryClient { get; }

public static void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
{
try
{
_telemetryClient.TrackEvent(eventName, properties, metrics);
TelemetryClient.TrackEvent(eventName, properties, metrics);
}
catch
{
Expand All @@ -27,7 +32,7 @@ public static void TrackException(Exception exception, IDictionary<string, strin
{
try
{
_telemetryClient.TrackException(exception, properties, metrics);
TelemetryClient.TrackException(exception, properties, metrics);
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<package id="NuGet.Packaging.Core" version="4.3.0-preview1-2524" targetFramework="net46" />
<package id="NuGet.Protocol" version="4.3.0-preview1-2524" 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.Logging" version="2.2.3.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-2524" targetFramework="net46" />
<package id="ODataNullPropagationVisitor" version="0.5.4237.2641" targetFramework="net46" />
Expand Down

0 comments on commit 0aea0dd

Please sign in to comment.