Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Aspire.Dashboard/DashboardWebApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.FluentUI.AspNetCore.Components;

namespace Aspire.Dashboard;
Expand All @@ -25,12 +26,22 @@ public class DashboardWebApplication : IHostedService

private readonly bool _isAllHttps;
private readonly WebApplication _app;
private readonly ILogger<DashboardWebApplication> _logger;

public DashboardWebApplication(Action<IServiceCollection> configureServices)
public DashboardWebApplication(ILogger<DashboardWebApplication> logger, Action<IServiceCollection> configureServices)
{
_logger = logger;
var builder = WebApplication.CreateBuilder();
builder.Logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.None);
builder.Logging.AddFilter("Microsoft.AspNetCore.Server.Kestrel", LogLevel.Error);

var dashboardUris = GetAddressUris(DashboardUrlVariableName, DashboardUrlDefaultValue);

if (dashboardUris.FirstOrDefault() is { } reportedDashboardUri)
{
_logger.LogInformation("Dashboard running at: {dashboardUri}", reportedDashboardUri);
}

var dashboardHttpsPort = dashboardUris.FirstOrDefault(IsHttps)?.Port;
var otlpUris = GetAddressUris(DashboardOtlpUrlVariableName, DashboardOtlpUrlDefaultValue);

Expand All @@ -39,6 +50,11 @@ public DashboardWebApplication(Action<IServiceCollection> configureServices)
throw new InvalidOperationException("Only one URL for Aspire dashboard OTLP endpoint is supported.");
}

if (otlpUris.FirstOrDefault() is { } reportedOtlpUri)
{
_logger.LogInformation("OTLP server running at: {dashboardUri}", reportedOtlpUri);
}

_isAllHttps = dashboardHttpsPort is not null && IsHttps(otlpUris[0]);

builder.WebHost.ConfigureKestrel(kestrelOptions =>
Expand Down
6 changes: 4 additions & 2 deletions src/Aspire.Hosting/Dcp/DcpHostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public DcpHostService(DistributedApplicationModel applicationModel,
_appExecutor = appExecutor;
_locations = locations;

if (options.DashboardEnabled)
// HACK: Manifest publisher check is temporary util DcpHostService is integrated with DcpPublisher.
if (options.DashboardEnabled && publishingOptions.Value.Publisher != "manifest")
{
_dashboard = new DashboardWebApplication(serviceCollection =>
var dashboardLogger = _loggerFactory.CreateLogger<DashboardWebApplication>();
_dashboard = new DashboardWebApplication(dashboardLogger, serviceCollection =>
{
serviceCollection.AddSingleton(_applicationModel);
serviceCollection.AddSingleton(kubernetesService);
Expand Down