Skip to content

Conversation

Copy link

Copilot AI commented Jul 25, 2025

This PR implements support for aggregating resources from multiple providers simultaneously, enabling teams to monitor both Docker containers and Kubernetes pods through a single Aspire Dashboard interface.

Problem

Previously, the application only supported a single resource provider at a time, configured via "ResourceProvider": "docker" or "ResourceProvider": "k8s". This limitation prevented users from monitoring hybrid environments with both Docker containers and Kubernetes workloads.

Solution

Implemented a new ResourceNotificationService that acts as an aggregator for multiple IResourceProvider instances:

Key Changes

  1. New Service Architecture

    • Created IResourceNotificationService interface for provider aggregation
    • Implemented ResourceNotificationService that combines multiple providers
    • Maintains full backward compatibility with existing IResourceProvider interface
  2. Enhanced Configuration Support

    // Single provider (existing - still works)
    {
      "ResourceProvider": "docker"
    }
    
    // Multiple providers (new capability)
    {
      "ResourceProviders": ["docker", "k8s"],
      "KubernetesResourceProviderConfiguration": {
        "Namespace": "production",
        "Servicenames": "redis;rabbitmq"
      }
    }
  3. Resource Aggregation

    • Merges initial resources from all enabled providers
    • Combines real-time change streams using Channel<T> for efficient multiplexing
    • Maintains resource-to-provider mapping for intelligent log routing
  4. Robust Error Handling

    • Individual provider failures don't affect other providers
    • Graceful handling of provider lifecycle events
    • Comprehensive logging with structured LoggerMessage delegates

Testing

  • Added comprehensive unit tests for service registration scenarios
  • Created integration tests for resource aggregation and log routing
  • Verified backward compatibility with existing single-provider configurations
  • Manual testing confirms application starts correctly with both single and multiple provider configs

Example Usage

With this change, users can now monitor their entire infrastructure through a single dashboard:

# View both Docker containers and K8s pods in unified interface
curl http://localhost:7007/info
# Returns aggregated resources from all configured providers

The implementation ensures that log requests are automatically routed to the correct provider based on resource names, providing a seamless experience regardless of where the resource is hosted.

Fixes #38.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fetch resources from multiple providers Add support for multiple resource providers in ResourceNotificationService Jul 25, 2025
Copilot AI requested a review from kiapanahi July 25, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetch resources from multiple providers

2 participants