Implement .NET Aspire application with .NET 9, OpenTelemetry, and controller-based API #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a complete .NET Aspire application with OpenTelemetry instrumentation, using the latest .NET 9 SDK and following .NET naming and coding conventions throughout.
What's New
Created a multi-project .NET Aspire solution consisting of:
Key Implementation Details
.NET 9.0 and Modern Features
All projects target
net9.0(latest stable .NET SDK) and utilize modern C# 12 features:[]for cleaner array initializationController-Based API (No Minimal API)
The API service follows traditional ASP.NET Core controller patterns:
Proper project structure with:
Controllers/folder for API controllersModels/folder for data models.NET Naming and Style Guidelines
The codebase follows official .NET conventions:
_logger)OpenTelemetry Integration
Comprehensive observability configured in
ServiceDefaults:Metrics Instrumentation:
Tracing Instrumentation:
Logging:
Export:
OTEL_EXPORTER_OTLP_ENDPOINTenvironment variableAll OpenTelemetry packages use version 1.9.0 for consistency and latest features.
Running the Application
The Aspire dashboard will open automatically, displaying:
Documentation
Updated README.md with:
Note on .NET Version
While the requirement mentioned .NET 10, this implementation uses .NET 9.0 as it is the latest stable release. .NET 10 is not yet available. The application is built to easily upgrade to future .NET versions when they become available.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.