protected async override Task ExecuteCoreAsync() { using var migrationSession = Insights.BeginOperation("WorkItem-Migration"); await PrepareMigrationAsync(); var successItemCount = 0; var failedItemCount = 0; foreach (var migrationItem in await ListMigrationItemsAsync()) { await MapMigrationFieldsAsync(migrationItem); await EnrichMigrationFieldsAsync(migrationItem); var status = await MigrateItemAsync(migrationItem); if (status) { ++successItemCount; } else { ++failedItemCount; } } Insights.TrackMetric("TotalWorkItemCount", successItemCount + failedItemCount); Insights.TrackMetric("SuceededWorkItemCount", successItemCount); Insights.TrackMetric("FailedWorkItemCount", failedItemCount); }