Would it be useful to add some origin labels to containers spun up by Aspire to help identify where they came form? (e.g. the project name & the resource name). Whilst I imagine this wouldn't be of much help in regular use, it could be of help in diagnostic scenarios to know where containers came from.
These labels could also be used with the "long running" container idea been thrown around, in which you can identify if an existing isntance is running by looking for containers with these labels
For example, the following could be done in IDistributedApplicationLifecycleHook.BeforeStartAsync
var projectLabel = $"net.dot.aspire.project={Assembly.GetEntryAssembly()?.GetName().Name}";
foreach (var container in appModel.GetContainerResources())
{
var resourceLabel = $"net.dot.aspire.resource={container.Name}";
container.Annotations.Add(new ContainerRunArgsCallbackAnnotation(x => {
x.Add($"--label");
x.Add(projectLabel);
x.Add($"--label");
x.Add(resourceLabel);
}));
}
Would it be useful to add some origin labels to containers spun up by Aspire to help identify where they came form? (e.g. the project name & the resource name). Whilst I imagine this wouldn't be of much help in regular use, it could be of help in diagnostic scenarios to know where containers came from.
These labels could also be used with the "long running" container idea been thrown around, in which you can identify if an existing isntance is running by looking for containers with these labels
For example, the following could be done in
IDistributedApplicationLifecycleHook.BeforeStartAsync
(For context, this idea comes out of https://github.com/dotnet/aspire/issues/4066#issuecomment-2155877090 )