public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, [Inject] IServerStatisticsIngressor serverStatisticsIngressor, [Inject] IServerStatisticsSummarizer serverStatisticsSummarizer, [Inject] IDnsServerStatisticsSender dnsServerStatisticsSender) { var logger = Log.ForContext("SourceContext", nameof(ServerStatisticsIngressDebug)); await ServerStatisticsIngress.Run(new TimerInfo(null, null), serverStatisticsIngressor, serverStatisticsSummarizer, dnsServerStatisticsSender); return(new OkObjectResult("OK")); }
public static async Task Run( [TimerTrigger("0 */15 * * * *")] TimerInfo timerInfo, [Inject] IServerStatisticsIngressor serverStatisticsIngressor, [Inject] IServerStatisticsSummarizer serverStatisticsSummarizer, [Inject] IDnsServerStatisticsSender dnsServerStatisticsSender) { var logger = Log.ForContext("SourceContext", FunctionName); logger.Information("Executing function {Function}", FunctionName); await serverStatisticsIngressor.IngressDnsServerStatistics(); var summarizedStatisticsPerServer = await serverStatisticsSummarizer.Summarize24h(); await dnsServerStatisticsSender.SendSummarizedStatistics(summarizedStatisticsPerServer); logger.Information("Function {Function} executed successfully", FunctionName); }