private static void WithOperationNameBasedOn(this Telemetry telemetry, HttpRequestMessage request) { if (request.HasActionDescriptor()) { telemetry.OperationName = request.GetActionDescriptor().ActionName; } else { var leftPart = request.RequestUri.GetLeftPart(UriPartial.Authority); telemetry.OperationName = new Uri(leftPart).MakeRelativeUri(request.RequestUri).ToString(); } }