Skip to content

Commit 570036b

Browse files
committed
Add OrleansDashboard from OrleansContrib
1 parent a3e6be8 commit 570036b

File tree

143 files changed

+12713
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+12713
-9
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<PackageVersion Include="Aspire.StackExchange.Redis" Version="9.0.0" />
6161
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
6262
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0" />
63+
<PackageVersion Include="OpenTelemetry" Version="1.9.0" />
6364
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
6465
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
6566
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />

Orleans.slnx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
<Project Path="playground/DashboardToy/DashboardToy.AppHost/DashboardToy.AppHost.csproj" />
1717
<Project Path="playground/DashboardToy/DashboardToy.Frontend/DashboardToy.Frontend.csproj" />
1818
</Folder>
19+
<Folder Name="/playground/Dashboard/">
20+
<Project Path="playground/DashboardCohosted/DashboardCohosted.csproj" />
21+
<Project Path="playground/DashboardSeparateHost/DashboardSeparateHost.csproj" />
22+
</Folder>
1923
<Folder Name="/Solution Items/">
2024
<File Path=".editorconfig" />
2125
<File Path="Directory.Build.props" />
@@ -48,6 +52,10 @@
4852
<Project Path="src/Orleans.TestingHost/Orleans.TestingHost.csproj" />
4953
<Project Path="src/Serializers/Orleans.Serialization.Protobuf/Orleans.Serialization.Protobuf.csproj" />
5054
</Folder>
55+
<Folder Name="/src/Dashboard/">
56+
<Project Path="src/Dashboard/Orleans.Dashboard.Abstractions/Orleans.Dashboard.Abstractions.csproj" />
57+
<Project Path="src/Dashboard/Orleans.Dashboard/Orleans.Dashboard.csproj" />
58+
</Folder>
5159
<Folder Name="/src/Extensions/">
5260
<Project Path="src/Orleans.Clustering.Consul/Orleans.Clustering.Consul.csproj" />
5361
<Project Path="src/Orleans.Clustering.ZooKeeper/Orleans.Clustering.ZooKeeper.csproj" />
@@ -112,18 +120,22 @@
112120
<Project Path="test/Tester/Tester.csproj" />
113121
<Project Path="test/TesterInternal/TesterInternal.csproj" />
114122
</Folder>
123+
<Folder Name="/test/Dashboard/">
124+
<Project Path="test/Orleans.Dashboard.Tests/Orleans.Dashboard.TestGrains/Orleans.Dashboard.TestGrains.csproj" />
125+
<Project Path="test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/Orleans.Dashboard.UnitTests.csproj" />
126+
</Folder>
115127
<Folder Name="/test/Benchmarks/">
116128
<Project Path="test/Benchmarks.AdoNet/Benchmarks.AdoNet.csproj" />
117129
<Project Path="test/Benchmarks/Benchmarks.csproj" />
118130
<Project Path="test/Grains/BenchmarkGrainInterfaces/BenchmarkGrainInterfaces.csproj" />
119131
<Project Path="test/Grains/BenchmarkGrains/BenchmarkGrains.csproj" />
120132
</Folder>
121133
<Folder Name="/test/DistributedTests/">
134+
<File Path="test/DistributedTests/README.md" />
122135
<Project Path="test/DistributedTests/DistributedTests.Client/DistributedTests.Client.csproj" />
123136
<Project Path="test/DistributedTests/DistributedTests.Common/DistributedTests.Common.csproj" />
124137
<Project Path="test/DistributedTests/DistributedTests.Grains/DistributedTests.Grains.csproj" />
125138
<Project Path="test/DistributedTests/DistributedTests.Server/DistributedTests.Server.csproj" />
126-
<File Path="test/DistributedTests/README.md" />
127139
</Folder>
128140
<Folder Name="/test/Extensions/">
129141
<Project Path="test/Extensions/AWSUtils.Tests/AWSUtils.Tests.csproj" />
@@ -161,4 +173,4 @@
161173
<Project Path="test/Transactions/Orleans.Transactions.Azure.Test/Orleans.Transactions.Azure.Test.csproj" />
162174
<Project Path="test/Transactions/Orleans.Transactions.Tests/Orleans.Transactions.Tests.csproj" />
163175
</Folder>
164-
</Solution>
176+
</Solution>

agent-framework3

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:/dev/agent-framework3

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
33
"rollForward": "major",
4-
"version": "9.0.306"
4+
"version": "9.0.303"
55
}
66
}

playground/ActivationRebalancing/ActivationRebalancing.AppHost/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Aspire.Hosting;
2+
13
var builder = DistributedApplication.CreateBuilder(args);
24

35
var redis = builder.AddRedis("orleans-redis");
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<IsPackable>false</IsPackable>
7+
<OrleansBuildTimeCodeGen>true</OrleansBuildTimeCodeGen>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\..\src\Dashboard\Orleans.Dashboard\Orleans.Dashboard.csproj" />
12+
<ProjectReference Include="..\..\test\Orleans.Dashboard.Tests\Orleans.Dashboard.TestGrains\Orleans.Dashboard.TestGrains.csproj" />
13+
<ProjectReference Include="..\..\src\Orleans.Client\Orleans.Client.csproj" />
14+
<ProjectReference Include="..\..\src\Orleans.Persistence.Memory\Orleans.Persistence.Memory.csproj" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Orleans.Dashboard;
2+
3+
var builder = WebApplication.CreateBuilder(args);
4+
5+
// Configure Orleans
6+
builder.UseOrleans(siloBuilder =>
7+
{
8+
siloBuilder.UseLocalhostClustering();
9+
siloBuilder.UseInMemoryReminderService();
10+
siloBuilder.AddMemoryGrainStorageAsDefault();
11+
12+
// Add the dashboard
13+
siloBuilder.AddDashboard();
14+
});
15+
16+
var app = builder.Build();
17+
18+
// Map dashboard endpoints at the root
19+
app.MapOrleansDashboard();
20+
21+
app.Run();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"profiles": {
3+
"DashboardCohosted": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"environmentVariables": {
7+
"ASPNETCORE_ENVIRONMENT": "Development"
8+
},
9+
"applicationUrl": "https://localhost:55355;http://localhost:55356"
10+
}
11+
}
12+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Orleans Dashboard - Cohosted Example
2+
3+
This example demonstrates how to cohost the Orleans Dashboard within the same web application that runs your Orleans silo.
4+
5+
## Overview
6+
7+
This is the simplest way to add the Orleans Dashboard to your application. The dashboard is hosted within the same process as your silo, using ASP.NET Core minimal APIs.
8+
9+
## Key Features
10+
11+
- **Single Process**: Both Orleans and the dashboard run in the same web application
12+
- **Minimal Configuration**: Simple setup with just a few lines of code
13+
- **ASP.NET Core Integration**: Uses `WebApplication.CreateBuilder()` and minimal APIs
14+
15+
## How It Works
16+
17+
The example shows:
18+
19+
1. Creating a web application with `WebApplication.CreateBuilder()`
20+
2. Configuring Orleans using `builder.UseOrleans()`
21+
3. Adding the dashboard with `siloBuilder.AddDashboard()`
22+
4. Mapping dashboard endpoints with `app.MapOrleansDashboard()`
23+
24+
## Running the Example
25+
26+
```bash
27+
dotnet run
28+
```
29+
30+
Once running, open your browser to:
31+
- **Dashboard**: https://localhost:55355/ (or http://localhost:55356/)
32+
33+
## Code Walkthrough
34+
35+
```csharp
36+
var builder = WebApplication.CreateBuilder(args);
37+
38+
// Configure Orleans
39+
builder.UseOrleans(siloBuilder =>
40+
{
41+
siloBuilder.UseLocalhostClustering();
42+
siloBuilder.UseInMemoryReminderService();
43+
siloBuilder.AddMemoryGrainStorageAsDefault();
44+
45+
// Add the dashboard
46+
siloBuilder.AddDashboard();
47+
});
48+
49+
var app = builder.Build();
50+
51+
// Map dashboard endpoints
52+
app.MapOrleansDashboard();
53+
54+
app.Run();
55+
```
56+
57+
## When to Use This Approach
58+
59+
Use this cohosted approach when:
60+
- You want the simplest setup
61+
- You're building a web application that also hosts Orleans
62+
- You want dashboard access on the same port as your web app
63+
- You're running a single silo or don't need a centralized dashboard
64+
65+
## Customization
66+
67+
### Custom Route Prefix
68+
69+
```csharp
70+
app.MapOrleansDashboard(routePrefix: "/dashboard");
71+
```
72+
73+
### Add Authentication
74+
75+
```csharp
76+
app.MapOrleansDashboard().RequireAuthorization();
77+
```
78+
79+
### Configure Update Interval
80+
81+
```csharp
82+
siloBuilder.AddDashboard(options =>
83+
{
84+
options.CounterUpdateIntervalMs = 2000; // Update every 2 seconds
85+
});
86+
```
87+
88+
## Important Notes
89+
90+
> [!WARNING]
91+
> The Orleans Dashboard is designed for **development and testing scenarios only**. It is not recommended for production deployments as it can have a significant performance impact on your cluster.
92+
93+
## Related Examples
94+
95+
- **DashboardSeparateHost**: Shows how to host the dashboard in a separate application
96+
- **DashboardToy**: Advanced example with .NET Aspire integration
97+
98+
## Learn More
99+
100+
- [Orleans Dashboard Documentation](../../../src/Dashboard/Orleans.Dashboard/README.md)
101+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<IsPackable>false</IsPackable>
7+
<OrleansBuildTimeCodeGen>true</OrleansBuildTimeCodeGen>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\..\src\Dashboard\Orleans.Dashboard\Orleans.Dashboard.csproj" />
12+
<ProjectReference Include="..\..\test\Orleans.Dashboard.Tests\Orleans.Dashboard.TestGrains\Orleans.Dashboard.TestGrains.csproj" />
13+
<ProjectReference Include="..\..\src\Orleans.Client\Orleans.Client.csproj" />
14+
<ProjectReference Include="..\..\src\Orleans.Persistence.Memory\Orleans.Persistence.Memory.csproj" />
15+
</ItemGroup>
16+
17+
</Project>

0 commit comments

Comments
 (0)