public Task GetMetricsAsync()

in Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/Trigger/CosmosDBMongoMetricsProvider.cs [24:33]


        public Task<CosmosDBMongoTriggerMetrics> GetMetricsAsync()
        {
            var metricsHistory = CosmosDBMongoMetricsStore.GetMetricsHistory(_functionId, _databaseName, _collectionName);
            var latestMetrics = metricsHistory.Length > 0
                ? metricsHistory[metricsHistory.Length - 1]
                : CosmosDBMongoMetricsStore.GetMetrics(_functionId, _databaseName, _collectionName);

            _logger.LogDebug($"Retrieved latest metrics with pending count: {latestMetrics.PendingEventsCount} for function {_functionId}");
            return Task.FromResult(latestMetrics);
        }