/// <summary> /// Post-Request processing /// </summary> /// <param name="context">type: IOwinContext</param> private void EndRequest(IOwinContext context) { if (HttpContext.Current == null) { return; } var startTime = ItemDecorator.GetInspectorInstance()[ItemDecorator.RequestStartTime]; if (startTime != null //// ignore non-user pings && TelemetryState.IsTelemetryEnabledUserAgent() //// ignore requests to specific paths && TelemetryState.IsTelemetryEnabledRequestPath() //// ignore requests to specific extensions && TelemetryState.IsTelemetryEnabledRequestExtension() //// make sure the portal is configured && this.IsPortalConfigured()) { var requestStartTime = (DateTime)startTime; var elapsedTime = DateTime.UtcNow - requestStartTime; MdmMetrics.RequestExecutionTimeMetric.LogValue((long)elapsedTime.TotalMilliseconds); var ag = PerformanceAggregateLogger.GetPerformanceAggregate(); if (ag != null) { PerformanceEventSource.Log.PerformanceAggregate(ag, elapsedTime); } } }
protected void Session_Start(object sender, EventArgs e) { Session["init"] = 0; if (FeatureCheckHelper.IsFeatureEnabled(FeatureNames.TelemetryFeatureUsage) // ignore non-user pings && TelemetryState.IsTelemetryEnabledUserAgent() // ignore requests to and referred requests from specific paths && TelemetryState.IsTelemetryEnabledRequestPage() // only report this telemetry when the portal is configured && SetupConfig.IsPortalConfigured()) { PortalFeatureTrace.TraceInstance.LogSessionInfo(FeatureTraceCategory.SessionStart); } }