1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Eliminate Application Insights

This commit is contained in:
Maksym Pavlenko
2017-01-09 12:11:32 -08:00
parent 2fb98647cb
commit 37e9b9fbed
8 changed files with 4 additions and 55 deletions

View File

@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.AspNetCore.Mvc;
using Podsync.Helpers;
using Podsync.Services.Links;
@@ -17,14 +15,12 @@ namespace Podsync.Controllers
private readonly IResolverService _resolverService;
private readonly ILinkService _linkService;
private readonly IStorageService _storageService;
private readonly TelemetryClient _telemetry;
public DownloadController(IResolverService resolverService, ILinkService linkService, IStorageService storageService, TelemetryClient telemetry)
public DownloadController(IResolverService resolverService, ILinkService linkService, IStorageService storageService)
{
_resolverService = resolverService;
_linkService = linkService;
_storageService = storageService;
_telemetry = telemetry;
}
// Main video download endpoint, don't forget to reflect any changes in LinkService.Download
@@ -49,12 +45,6 @@ namespace Podsync.Controllers
}
catch (Exception ex)
{
_telemetry.TrackException(ex, new Dictionary<string, string>
{
["FeedId"] = feedId,
["VideoId"] = videoId
});
var response = "Could nou resolve URL";
if (ex is InvalidOperationException)
{
@@ -64,9 +54,6 @@ namespace Podsync.Controllers
return BadRequest(response);
}
// Report metrics
_telemetry.TrackEvent("Download");
return Redirect(redirectUrl.ToString());
}
}

View File

@@ -5,7 +5,6 @@ using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Microsoft.ApplicationInsights;
using Microsoft.AspNetCore.Mvc;
using Podsync.Helpers;
using Podsync.Services;
@@ -34,14 +33,12 @@ namespace Podsync.Controllers
private readonly IRssBuilder _rssBuilder;
private readonly ILinkService _linkService;
private readonly IStorageService _storageService;
private readonly TelemetryClient _telemetry;
public FeedController(IRssBuilder rssBuilder, ILinkService linkService, IStorageService storageService, TelemetryClient telemetry)
public FeedController(IRssBuilder rssBuilder, ILinkService linkService, IStorageService storageService)
{
_rssBuilder = rssBuilder;
_linkService = linkService;
_storageService = storageService;
_telemetry = telemetry;
}
[HttpPost]
@@ -92,8 +89,6 @@ namespace Podsync.Controllers
properties.Add("Email", User.GetClaim(ClaimTypes.Email));
}
_telemetry.TrackEvent("CreateFeed", properties);
return url;
}
@@ -135,9 +130,6 @@ namespace Podsync.Controllers
body = writer.ToString();
}
// Report metrics
_telemetry.TrackEvent("GetFeed");
return Content(body, "application/rss+xml; charset=UTF-8");
}
}

View File

@@ -1,7 +0,0 @@
{
"ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider",
"Version": "7.15.1215.1",
"GettingStartedDocument": {
"Uri": "https://go.microsoft.com/fwlink/?LinkID=798432"
}
}

View File

@@ -1,7 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using System.Security.Claims;
using Microsoft.ApplicationInsights;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OAuth;
using Microsoft.AspNetCore.Builder;
@@ -36,7 +34,6 @@ namespace Podsync
if (env.IsDevelopment())
{
builder.AddUserSecrets();
builder.AddApplicationInsightsSettings(true);
}
Configuration = builder.Build();
@@ -62,7 +59,6 @@ namespace Podsync
services.AddAuthentication(config => config.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme);
// Add framework services
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
}
@@ -72,9 +68,6 @@ namespace Podsync
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
@@ -130,14 +123,6 @@ namespace Podsync
var amountCents = user.Pledges.Sum(x => x.AmountCents);
context.Identity.AddClaim(new Claim(Constants.Patreon.AmountDonated, amountCents.ToString()));
var telemetry = app.ApplicationServices.GetService<TelemetryClient>();
telemetry.TrackEvent("Login", new Dictionary<string, string>
{
["Email"] = user.Email,
["Url"] = user.Url,
["Donated"] = amountCents.ToString()
});
}
}
});

View File

@@ -30,8 +30,6 @@
asp-fallback-test-value="inline-block"
asp-append-version="true" />
</environment>
@Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
</head>
<body>
<div class="background-image">

View File

@@ -1,4 +1,2 @@
@using Podsync
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@@ -14,8 +14,5 @@
"BaseUrl": "",
"PatreonClientId": "",
"PatreonSecret": ""
},
"ApplicationInsights": {
"InstrumentationKey": "7250dc81-d025-4fa5-af49-6d8ea8024863"
}
}

View File

@@ -3,7 +3,6 @@
"Google.Apis.YouTube.v3": "1.16.0.582",
"Hashids.net": "1.2.2",
"MedallionShell": "1.2.1",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",