Created ECN# autocomplete for PCR3 docs
This commit is contained in:
@ -53,4 +53,36 @@ public class ECNController : ControllerBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("ecn/allNumbers")]
|
||||
public async Task<IActionResult> GetAllECNNumbers() {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to get all ECN#s");
|
||||
|
||||
IEnumerable<int> allEcnNumbers = await _ecnService.GetAllECNNumbers();
|
||||
|
||||
return Ok(allEcnNumbers);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get all ECN#s, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetAllECNNumbers";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user