Skip to content

Commit 9a8e9f4

Browse files
authored
Support for Dapr 1.12.0+ (#62)
* #61 : Updated target frameworks, package versions, and method for adding headers Updated the target frameworks across multiple projects to `net8.0` and updated various package versions in `dapr_sidekick_csharp.props`, `ActorSample.ActorClient.csproj`, `ActorSample.DemoActor.csproj`, `ActorSample.IDemoActor.csproj`, `AppConfigurationSample.csproj`, `ConsulSample.Receiver.csproj`, `ConsulSample.Sender.csproj`, `ControllerSample.csproj`, `ServiceInvocationSample.csproj`, `Directory.build.props`, `Man.Dapr.Sidekick.csproj`, `Man.Dapr.Sidekick.AspNetCore.Tests.csproj`, `Man.Dapr.Sidekick.Extensions.Logging.Tests.csproj`, and `Man.Dapr.Sidekick.Tests.csproj`. Also replaced the `Add` method with the `Append` method for adding headers in `HttpContextInvocationHandlerTests.cs`. * #61 : Add Sentry compatibility with Dapr 1.12+, and SentrySample project * #61 : Add Placement compatibility with Dapr 1.12+, and PlacementSample project
1 parent 8a00cc7 commit 9a8e9f4

File tree

57 files changed

+608
-79
lines changed

Some content is hidden

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

57 files changed

+608
-79
lines changed

.github/workflows/build.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: windows-latest
3333
strategy:
3434
matrix:
35-
dotnet-version: ['net35', 'net48', 'net50']
35+
dotnet-version: ['net35', 'net48', 'net80']
3636
include:
3737
- dotnet-version: 'net35'
3838
display-name: '.NET Framework 3.5'
@@ -43,8 +43,8 @@ jobs:
4343
framework: 'net48'
4444
logger: '--logger="GitHubActions;report-warnings=false" --logger="trx"'
4545
- dotnet-version: 'net50'
46-
display-name: '.NET 5.0'
47-
framework: 'net5.0'
46+
display-name: '.NET 8.0'
47+
framework: 'net8.0'
4848
logger: '--logger="GitHubActions;report-warnings=false" --logger="trx"'
4949
steps:
5050
- uses: actions/checkout@v2

all.sln

+46-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.6.30114.105
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34707.107
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A985DBAA-87F6-4860-A5D3-96376165BE17}"
77
ProjectSection(SolutionItems) = preProject
@@ -80,13 +80,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ControllerSample", "Control
8080
EndProject
8181
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControllerSample", "samples\AspNetCore\ControllerSample\ControllerSample\ControllerSample.csproj", "{FE082318-2993-42A3-B2DB-28EDA77F7136}"
8282
EndProject
83-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppConfigurationSample", "samples\AspNetCore\AppConfigurationSample\AppConfigurationSample\AppConfigurationSample.csproj", "{C6911A37-51F3-4E29-8E67-39B460EE7ABA}"
83+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppConfigurationSample", "samples\AspNetCore\AppConfigurationSample\AppConfigurationSample\AppConfigurationSample.csproj", "{C6911A37-51F3-4E29-8E67-39B460EE7ABA}"
8484
EndProject
8585
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AppConfigurationSample", "AppConfigurationSample", "{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E}"
8686
ProjectSection(SolutionItems) = preProject
8787
samples\AspNetCore\AppConfigurationSample\README.md = samples\AspNetCore\AppConfigurationSample\README.md
8888
EndProjectSection
8989
EndProject
90+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SentrySample", "SentrySample", "{7F6A5D8C-9780-4824-8284-CC3149683C70}"
91+
ProjectSection(SolutionItems) = preProject
92+
samples\AspNetCore\SentrySample\README.md = samples\AspNetCore\SentrySample\README.md
93+
EndProjectSection
94+
EndProject
95+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SentrySample", "samples\AspNetCore\SentrySample\SentrySample\SentrySample.csproj", "{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}"
96+
EndProject
97+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PlacementSample", "PlacementSample", "{AE430C04-78BD-4CAE-86D7-EBC599774D9C}"
98+
ProjectSection(SolutionItems) = preProject
99+
samples\AspNetCore\PlacementSample\README.md = samples\AspNetCore\PlacementSample\README.md
100+
EndProjectSection
101+
EndProject
102+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlacementSample", "samples\AspNetCore\PlacementSample\PlacementSample\PlacementSample.csproj", "{2FC86574-6A81-4E2B-A0D4-78D46528A917}"
103+
EndProject
90104
Global
91105
GlobalSection(SolutionConfigurationPlatforms) = preSolution
92106
Debug|Any CPU = Debug|Any CPU
@@ -277,6 +291,30 @@ Global
277291
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x64.Build.0 = Release|Any CPU
278292
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x86.ActiveCfg = Release|Any CPU
279293
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x86.Build.0 = Release|Any CPU
294+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
295+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
296+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x64.ActiveCfg = Debug|Any CPU
297+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x64.Build.0 = Debug|Any CPU
298+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x86.ActiveCfg = Debug|Any CPU
299+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x86.Build.0 = Debug|Any CPU
300+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
301+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|Any CPU.Build.0 = Release|Any CPU
302+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x64.ActiveCfg = Release|Any CPU
303+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x64.Build.0 = Release|Any CPU
304+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x86.ActiveCfg = Release|Any CPU
305+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x86.Build.0 = Release|Any CPU
306+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
307+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|Any CPU.Build.0 = Debug|Any CPU
308+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x64.ActiveCfg = Debug|Any CPU
309+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x64.Build.0 = Debug|Any CPU
310+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x86.ActiveCfg = Debug|Any CPU
311+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x86.Build.0 = Debug|Any CPU
312+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|Any CPU.ActiveCfg = Release|Any CPU
313+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|Any CPU.Build.0 = Release|Any CPU
314+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x64.ActiveCfg = Release|Any CPU
315+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x64.Build.0 = Release|Any CPU
316+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x86.ActiveCfg = Release|Any CPU
317+
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x86.Build.0 = Release|Any CPU
280318
EndGlobalSection
281319
GlobalSection(SolutionProperties) = preSolution
282320
HideSolutionNode = FALSE
@@ -304,8 +342,12 @@ Global
304342
{A3C52771-3B41-43F6-A4DD-7B3F7BAA598D} = {D625B898-1677-4DCA-B067-C7BFB07F1314}
305343
{C5B72F44-C52D-471D-BE29-DB1C34699220} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
306344
{FE082318-2993-42A3-B2DB-28EDA77F7136} = {C5B72F44-C52D-471D-BE29-DB1C34699220}
307-
{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
308345
{C6911A37-51F3-4E29-8E67-39B460EE7ABA} = {3AD6FEBE-37E9-436E-BE86-29668A9DDB3E}
346+
{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
347+
{7F6A5D8C-9780-4824-8284-CC3149683C70} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
348+
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A} = {7F6A5D8C-9780-4824-8284-CC3149683C70}
349+
{AE430C04-78BD-4CAE-86D7-EBC599774D9C} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
350+
{2FC86574-6A81-4E2B-A0D4-78D46528A917} = {AE430C04-78BD-4CAE-86D7-EBC599774D9C}
309351
EndGlobalSection
310352
GlobalSection(ExtensibilityGlobals) = postSolution
311353
SolutionGuid = {E906E97D-7D56-4E02-A13F-1C48AEB47A88}

properties/dapr_sidekick_csharp.props

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<Import Project="dapr_sidekick_common.props" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<LangVersion>8.0</LangVersion>
6+
<LangVersion>latest</LangVersion>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
88
<WarningLevel>4</WarningLevel>
99
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
1010
<!-- OpenAPI Analyzers disabled due to issue : https://github.com/dotnet/aspnetcore/issues/14723 -->
1111
<IncludeOpenAPIAnalyzers>false</IncludeOpenAPIAnalyzers>
12-
<MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>1.0.2</MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>
12+
<MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>1.0.3</MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>
1313
</PropertyGroup>
1414

1515
<!-- Cls Compliant -->
@@ -42,23 +42,23 @@
4242

4343
<!-- Asset Packages -->
4444
<ItemGroup>
45-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
45+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
4646
<PrivateAssets>all</PrivateAssets>
4747
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4848
</PackageReference>
4949
<PackageReference Include="MinVer" Version="2.3.0">
5050
<PrivateAssets>all</PrivateAssets>
5151
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5252
</PackageReference>
53-
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
53+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.0">
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5656
</PackageReference>
57-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All">
57+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="All">
5858
<PrivateAssets>all</PrivateAssets>
5959
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6060
</PackageReference>
61-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
61+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
6262
</ItemGroup>
6363

6464
<!-- Configure properties for MinVer -->

samples/Actor/ActorSample/ActorSample.ActorClient/ActorSample.ActorClient.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
9+
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

samples/Actor/ActorSample/ActorSample.DemoActor/ActorSample.DemoActor.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
9-
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.2.0" />
10-
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
8+
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
9+
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.13.0" />
10+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
1111
</ItemGroup>
1212

1313
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
8+
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
99
</ItemGroup>
1010

1111
</Project>

samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/AppConfigurationSample.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<LangVersion>10</LangVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Dapr.Extensions.Configuration" Version="1.11.0" />
12-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11"/>
13-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
14-
<PackageReference Include="Dapr.AspNetCore" Version="1.11.0" />
15-
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
11+
<PackageReference Include="Dapr.Extensions.Configuration" Version="1.13.0" />
12+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
13+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
14+
<PackageReference Include="Dapr.AspNetCore" Version="1.13.0" />
15+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

samples/AspNetCore/ConsulSample/ConsulSample.Receiver/ConsulSample.Receiver.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
8+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

samples/AspNetCore/ConsulSample/ConsulSample.Sender/ConsulSample.Sender.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
8+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
9+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
1011
</ItemGroup>
1112

1213
<ItemGroup>

samples/AspNetCore/ConsulSample/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Consul Sample
22

3-
This example is based on the standard ASP.NET Core 5.0 Web API WeatherForecast template and demonstrates the Service Discovery and Invocation feature of standalone Dapr using Hashicorp Consul as a service discovery provider. While this sample runs on a single machine, it would work exactly the same way if the two services were on different machines with a central Consul cluster.
3+
This example is based on the standard ASP.NET Core Web API WeatherForecast template and demonstrates the Service Discovery and Invocation feature of standalone Dapr using Hashicorp Consul as a service discovery provider. While this sample runs on a single machine, it would work exactly the same way if the two services were on different machines with a central Consul cluster.
44

55
## Features
66

samples/AspNetCore/ControllerSample/ControllerSample/Account.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ------------------------------------------------------------
1+
// ------------------------------------------------------------
22
// Copyright (c) Microsoft Corporation.
33
// Licensed under the MIT License.
44
// ------------------------------------------------------------
@@ -20,4 +20,4 @@ public class Account
2020
/// </summary>
2121
public decimal Balance { get; set; }
2222
}
23-
}
23+
}

samples/AspNetCore/ControllerSample/ControllerSample/ControllerSample.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Dapr.AspNetCore" Version="1.2.0" />
9-
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
8+
<PackageReference Include="Dapr.AspNetCore" Version="1.13.0" />
9+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

samples/AspNetCore/ControllerSample/ControllerSample/Transaction.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ------------------------------------------------------------
1+
// ------------------------------------------------------------
22
// Copyright (c) Microsoft Corporation.
33
// Licensed under the MIT License.
44
// ------------------------------------------------------------
@@ -24,4 +24,4 @@ public class Transaction
2424
[Range(0, double.MaxValue)]
2525
public decimal Amount { get; set; }
2626
}
27-
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\..\..\src\Man.Dapr.Sidekick.AspNetCore\Man.Dapr.Sidekick.AspNetCore.csproj" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<None Update="dapr\**\*.*">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
</None>
21+
<None Update="placement\**\*.*">
22+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
23+
</None>
24+
</ItemGroup>
25+
26+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Man.Dapr.Sidekick;
2+
using Serilog;
3+
4+
// Add Serilog for enhanced console logging.
5+
Log.Logger = new LoggerConfiguration()
6+
.Enrich.FromLogContext()
7+
.WriteTo.Console()
8+
.CreateLogger();
9+
10+
var builder = WebApplication.CreateBuilder(args);
11+
12+
builder.Services.AddControllers();
13+
14+
// Add Dapr Sidekick with Placement
15+
builder.Services.AddDaprSidekick(builder.Configuration)
16+
.AddPlacement();
17+
18+
builder.Host.UseSerilog();
19+
20+
var app = builder.Build();
21+
22+
app.MapGet("/status", (IDaprSidecarHost sidecarHost, IDaprPlacementHost placementHost) => Results.Ok(new
23+
{
24+
sidecar = new
25+
{
26+
process = sidecarHost.GetProcessInfo(), // Information about the sidecar process such as if it is running
27+
options = sidecarHost.GetProcessOptions() // The sidecar options if running, including ports and locations
28+
},
29+
placement = new
30+
{
31+
process = placementHost.GetProcessInfo(), // Information about the sentry process such as if it is running
32+
options = placementHost.GetProcessOptions() // The sentry options if running, including ports and locations
33+
},
34+
}));
35+
36+
// For Dapr
37+
app.MapHealthChecks("/health");
38+
39+
app.Run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"profiles": {
3+
"PlacementSample": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"launchUrl": "status",
7+
"environmentVariables": {
8+
"ASPNETCORE_ENVIRONMENT": "Development"
9+
},
10+
"applicationUrl": "http://localhost:5000"
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)