Skip to content

Commit b53c1fe

Browse files
loekensgardh3rmanj
andauthored
feat: add support for dynatrace (#112)
* feat: add dynatrace sink extension * fix: set serilog.aspnetcore version by conditional targetframework * fix: use recommended way to read configuration * build: bump nuke to .net 7 * fix: new nuke syntax --------- Co-authored-by: Herman Jensen <[email protected]>
1 parent a07bb1b commit b53c1fe

File tree

16 files changed

+129
-23
lines changed

16 files changed

+129
-23
lines changed

.github/workflows/compile.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
20-
- name: Setup .NET 6
20+
- name: Setup .NET 7
2121
uses: actions/setup-dotnet@v3
2222
with:
23-
dotnet-version: 6.0.*
23+
dotnet-version: 7.0.*
2424
- name: Build with Nuke
2525
run: ./build.sh compile
2626
shell: bash

.github/workflows/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
with:
1616
fetch-depth: 0
1717

18-
- name: Setup .NET 6
18+
- name: Setup .NET 7
1919
uses: actions/setup-dotnet@v3
2020
with:
21-
dotnet-version: 6.0.*
21+
dotnet-version: 7.0.*
2222

2323
- name: Publish to NuGet with Nuke
2424
run: ./build.sh push --nuget-api-key ${{ secrets.NUGET_API_KEY }}

.nuke/build.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3-
"title": "Build Schema",
43
"$ref": "#/definitions/build",
4+
"title": "Build Schema",
55
"definitions": {
66
"build": {
77
"type": "object",
@@ -119,4 +119,4 @@
119119
}
120120
}
121121
}
122-
}
122+
}

Intility.Logging.sln

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSample", "samples\WebSam
2222
EndProject
2323
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkerSample", "samples\WorkerSample\WorkerSample.csproj", "{25312E6A-4BA3-4FDF-AA7C-CF2A10CDA2AA}"
2424
EndProject
25-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinimalApiSample", "samples\MinimalApiSample\MinimalApiSample.csproj", "{B647AC70-7210-462A-A43C-6EB4AFCB7ED4}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinimalApiSample", "samples\MinimalApiSample\MinimalApiSample.csproj", "{B647AC70-7210-462A-A43C-6EB4AFCB7ED4}"
26+
EndProject
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Intility.Extensions.Logging.Dynatrace", "src\Intility.Extensions.Logging.Dynatrace\Intility.Extensions.Logging.Dynatrace.csproj", "{B94B9317-E255-4851-9110-0366906EA8A8}"
2628
EndProject
2729
Global
2830
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -118,6 +120,18 @@ Global
118120
{B647AC70-7210-462A-A43C-6EB4AFCB7ED4}.Release|x64.Build.0 = Release|Any CPU
119121
{B647AC70-7210-462A-A43C-6EB4AFCB7ED4}.Release|x86.ActiveCfg = Release|Any CPU
120122
{B647AC70-7210-462A-A43C-6EB4AFCB7ED4}.Release|x86.Build.0 = Release|Any CPU
123+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
124+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
125+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|x64.ActiveCfg = Debug|Any CPU
126+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|x64.Build.0 = Debug|Any CPU
127+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|x86.ActiveCfg = Debug|Any CPU
128+
{B94B9317-E255-4851-9110-0366906EA8A8}.Debug|x86.Build.0 = Debug|Any CPU
129+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
130+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|Any CPU.Build.0 = Release|Any CPU
131+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|x64.ActiveCfg = Release|Any CPU
132+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|x64.Build.0 = Release|Any CPU
133+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|x86.ActiveCfg = Release|Any CPU
134+
{B94B9317-E255-4851-9110-0366906EA8A8}.Release|x86.Build.0 = Release|Any CPU
121135
EndGlobalSection
122136
GlobalSection(SolutionProperties) = preSolution
123137
HideSolutionNode = FALSE
@@ -130,6 +144,7 @@ Global
130144
{2C7C52E9-835F-4051-9A5E-7D985545A795} = {A5767C5D-9A48-4485-8D5E-686F34B2B766}
131145
{25312E6A-4BA3-4FDF-AA7C-CF2A10CDA2AA} = {A5767C5D-9A48-4485-8D5E-686F34B2B766}
132146
{B647AC70-7210-462A-A43C-6EB4AFCB7ED4} = {A5767C5D-9A48-4485-8D5E-686F34B2B766}
147+
{B94B9317-E255-4851-9110-0366906EA8A8} = {4073E5F4-CD63-4DAA-864D-83A76827807E}
133148
EndGlobalSection
134149
GlobalSection(ExtensibilityGlobals) = postSolution
135150
SolutionGuid = {4B2214E5-8A73-47CE-9C97-4910BC331A86}

build/Build.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
using Nuke.Common.Tools.GitVersion;
1313
using Nuke.Common.Utilities.Collections;
1414
using static Nuke.Common.EnvironmentInfo;
15-
using static Nuke.Common.IO.FileSystemTasks;
1615
using static Nuke.Common.IO.PathConstruction;
1716
using static Nuke.Common.Tools.DotNet.DotNetTasks;
1817

19-
[CheckBuildProjectConfigurations]
2018
[ShutdownDotNetAfterServerBuild]
2119
class Build : NukeBuild
2220
{
@@ -49,9 +47,9 @@ class Build : NukeBuild
4947
.Before(Restore)
5048
.Executes(() =>
5149
{
52-
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
53-
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
54-
EnsureCleanDirectory(OutputDirectory);
50+
SourceDirectory.GlobDirectories("**/bin", "**/obj").DeleteDirectories();
51+
TestsDirectory.GlobDirectories("**/bin", "**/obj").DeleteDirectories();
52+
OutputDirectory.CreateOrCleanDirectory();
5553
});
5654

5755
Target Restore => _ => _

build/_build.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net7.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Nuke.Common" Version="6.3.0" />
14+
<PackageReference Include="Nuke.Common" Version="7.0.6" />
1515
<PackageDownload Include="GitVersion.Tool" Version="[5.8.1]" />
1616
</ItemGroup>
1717

samples/MinimalApiSample/MinimalApiSample.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
11-
<ProjectReference Include="..\..\src\Intility.Extensions.Logging.Elasticsearch\Intility.Extensions.Logging.Elasticsearch.csproj" />
12-
<ProjectReference Include="..\..\src\Intility.Extensions.Logging.Sentry\Intility.Extensions.Logging.Sentry.csproj" />
13-
<ProjectReference Include="..\..\src\Intility.Logging.AspNetCore\Intility.Logging.AspNetCore.csproj" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
11+
<ProjectReference Include="..\..\src\Intility.Extensions.Logging.Dynatrace\Intility.Extensions.Logging.Dynatrace.csproj" />
12+
<ProjectReference Include="..\..\src\Intility.Extensions.Logging.Elasticsearch\Intility.Extensions.Logging.Elasticsearch.csproj" />
13+
<ProjectReference Include="..\..\src\Intility.Extensions.Logging.Sentry\Intility.Extensions.Logging.Sentry.csproj" />
14+
<ProjectReference Include="..\..\src\Intility.Logging.AspNetCore\Intility.Logging.AspNetCore.csproj" />
1415
</ItemGroup>
1516

1617
</Project>

samples/MinimalApiSample/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
{
77
logging.UseDefaultEnrichers()
88
.UseElasticsearch()
9-
.UseSentry();
9+
.UseSentry()
10+
.UseDynatrace();
1011
});
1112

1213
// Add services to the container.

samples/MinimalApiSample/appsettings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
}
77
},
88
"AllowedHosts": "*",
9+
"Elasticsearch": {
10+
"Endpoints": "localhost:9200",
11+
"IndexFormat": "my-service-{0:yyyy.MM}"
12+
},
13+
"Dynatrace": {
14+
"IngestUrl": "localhost:9200",
15+
"AccessToken": "test"
16+
},
917
"Sentry": {
1018
"Dsn": "https://[email protected]/0",
1119
"MaxRequestBodySize": "Always",

samples/WebSample/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
1717
{
1818
logging.UseDefaultEnrichers()
1919
.UseElasticsearch()
20-
.UseSentry();
20+
.UseSentry()
21+
.UseDynatrace();
2122
})
2223
.ConfigureWebHostDefaults(webBuilder =>
2324
{

0 commit comments

Comments
 (0)