Skip to content

Instantly share code, notes, and snippets.

View patkleef's full-sized avatar

Patrick van Kleef patkleef

View GitHub Profile
@patkleef
patkleef / ApplicationInsightsFilterConfig.cs
Created March 19, 2017 18:38
Application Insights Blog - ApplicationInsightsFilterConfig.cs
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new ErrorHandler.AiHandleErrorAttribute());
}
}
@patkleef
patkleef / ApplicationInsightsExceptionTrackingTelemetryModule.config
Created March 19, 2017 18:40
Application Insights Blog - ApplicationInsightsExceptionTrackingTelemetryModule.config
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector" />
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector"></Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
<Handlers>
<Add>System.Web.Handlers.TransferRequestHandler</Add>
@patkleef
patkleef / ApplicationInsightsHomeActionMethod.cs
Created March 19, 2017 18:40
Application Insights Blog - ApplicationInsightsHomeActionMethod.cs
public ActionResult Index()
{
var arr = new string[2];
try
{
arr[0] = "value 1";
arr[1] = "value 2";
arr[2] = "value 3";
var result = arr[3];
@patkleef
patkleef / ApplicationInsightsRegisterActionMethod.cs
Created March 19, 2017 18:41
Application Insights Blog - ApplicationInsightsRegisterActionMethod.cs
[System.Web.Mvc.HttpPost]
public ActionResult Register([FromBody]RegisterModel model)
{
var dic = new Dictionary<string, string>();
dic.Add("email", model.Email);
dic.Add("name", model.Name);
dic.Add("category", Session["selectedCategory"]?.ToString());
_telemetryClient.TrackEvent("Registration form entered event", dic);
@patkleef
patkleef / ApplicationInsightsDataService.cs
Created March 19, 2017 18:42
Application Insights Blog - ApplicationInsightsDataService.cs
public class DataService
{
private readonly TelemetryClient _telemetryClient;
private readonly IDictionary<string, int> _dic;
public DataService()
{
_telemetryClient = new TelemetryClient();
_dic = new Dictionary<string, int>();
@patkleef
patkleef / payment-request-page.ts
Created January 4, 2019 08:45
Modern Storefront - Payment Request API
export class PaymentRequestPageViewModel extends ViewModelBase {
repository = repositoryFactory.get();
paymentRequest: PaymentRequest;
shippingOptions: PaymentShippingOption[];
totalPrice: number;
constructor() {
super();
this.initPayment();
}