Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resource utilization warnings #4559

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Agent.Sdk/Knob/AgentKnobs.cs
Expand Up @@ -500,6 +500,13 @@ public class AgentKnobs
new EnvironmentKnobSource("AGENT_ENABLE_FETCHING_NET6_LIST"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob EnableResourceUtilizationWarnings = new Knob(
nameof(EnableResourceUtilizationWarnings),
"If true, the agent will throw the resource utilization warnings",
new RuntimeKnobSource("AZP_ENABLE_RESOURCE_UTILIZATION_WARNINGS"),
new EnvironmentKnobSource("AZP_ENABLE_RESOURCE_UTILIZATION_WARNINGS"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob ForceCreateTasksDirectory = new Knob(
nameof(ForceCreateTasksDirectory),
"Forces the agent to create _tasks folder for tasks.",
Expand Down
3 changes: 1 addition & 2 deletions src/Agent.Worker/JobRunner.cs
Expand Up @@ -111,15 +111,14 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
jobContext.Start();
jobContext.Section(StringUtil.Loc("StepStarting", message.JobDisplayName));


//Start Resource Diagnostics if enabled in the job message
jobContext.Variables.TryGetValue("system.debug", out var systemDebug);
resourceDiagnosticManager = HostContext.GetService<IResourceMetricsManager>();

if (string.Equals(systemDebug, "true", StringComparison.OrdinalIgnoreCase))
{
resourceDiagnosticManager.Setup(jobContext);
_ = resourceDiagnosticManager.Run();
_ = resourceDiagnosticManager.RunDebugResourceMonitor();
}

agentShutdownRegistration = HostContext.AgentShutdownToken.Register(() =>
Expand Down