private static async Task <double> GetValueOfPi() { InternalServiceReference.InternalServiceClient serviceClient = new InternalServiceReference.InternalServiceClient(); double pi; bool shouldGetValueFromServiceConfig = Convert.ToBoolean(ConfigurationManager.AppSettings["ShouldGetPiFromService"]); bool shouldGetPiFromService = shouldGetValueFromServiceConfig | random.Next() % 2 == 0; //shouldGetPiFromService = false; // Hack if the netPipeService is not working. if (shouldGetPiFromService) { pi = await serviceClient.GetValueOfPiAsync(); //This public URL will also give the valyue. https://api.pi.delivery/v1/pi?start=0&numberOfDigits=10 } else { pi = 3.14; } await Task.Delay(1000); EventTelemetry et = new EventTelemetry(); et.Name = "FrontEndService.GetValueOfPi()"; et.Properties.Add("message", $"value of pi obtained= {pi}"); GetTelemetryClient().TrackTrace($"{nameof(GetValueOfPi)}Value of pi obtained= {pi}"); return(pi); }
private static async Task <double> GetValueOfPi() { InternalServiceReference.InternalServiceClient serviceClient = new InternalServiceReference.InternalServiceClient(); double pi; bool shouldGetPiFromService = random.Next() % 2 == 0; shouldGetPiFromService = false; // Hack if the netPipeService is not working. if (shouldGetPiFromService) { pi = await serviceClient.GetValueOfPiAsync(); //This public URL will also give the valyue. https://api.pi.delivery/v1/pi?start=0&numberOfDigits=10 } else { pi = 3.14; } await Task.Delay(1000); GetTelemetryClient().TrackEvent($"FrontEndService.GetValueOfPi() = {pi}"); return(pi); }