in src/ServiceProfiler.EventPipe.Otel/Microsoft.ApplicationInsights.Profiler.Shared/Orchestrations/OrchestratorEventPipe.cs [52:81]
public async override Task StartAsync(CancellationToken cancellationToken)
{
_logger.LogDebug("Starting the orchestrator.");
int activatedCount = ActivateSchedulePolicies();
if (activatedCount > 0)
{
_logger.LogDebug("{count} scheduling policies has been activated.", activatedCount);
if (_initialDelay != TimeSpan.Zero)
{
_logger.LogInformation("Initial delay for Application Insights Profiler.");
await DelaySource.Delay(_initialDelay, cancellationToken).ConfigureAwait(false);
_logger.LogInformation("Finish initial delay. Profiling is activated.");
}
// Go through each provided policy and start them
List<Task> policyAsync = [];
foreach (SchedulingPolicy policy in _policyCollection)
{
policyAsync.Add(policy.StartPolicyAsync(cancellationToken));
}
await Task.WhenAll(policyAsync).ConfigureAwait(false);
}
else
{
_logger.LogError("No scheduling policy has been activated.");
}
}