Skip to content

Commit 2aff5ad

Browse files
authored
Merge pull request #589 from serilog-mssql/dev
* Fixed issue #580: Removed deprecated transitive dependency on Microsoft.NETCore.Targets by removing runtime identifier (thanks to @david-brink-talogy) * Fixed issues #540 and #541 in README * Added performance tests including a GitHub actions workflow * Minor cleanups and fixes
2 parents 8df0776 + 0259e0b commit 2aff5ad

21 files changed

+538
-60
lines changed

.editorconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ trim_trailing_whitespace = true
99
[*.{csproj,json,config,yml}]
1010
indent_size = 2
1111

12-
[*.sh]
13-
end_of_line = lf
14-
1512
[*.{cmd,bat}]
1613
end_of_line = crlf
1714

@@ -43,7 +40,6 @@ csharp_space_between_method_call_name_and_opening_parenthesis = false
4340
csharp_space_between_method_call_parameter_list_parentheses = false
4441
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
4542
csharp_space_between_method_declaration_parameter_list_parentheses = false
46-
csharp_space_between_parentheses = false
4743
csharp_style_conditional_delegate_call = true:suggestion
4844
csharp_style_expression_bodied_accessors = true:silent
4945
csharp_style_expression_bodied_constructors = false:silent

.github/workflows/perftests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Performance Tests
2+
3+
on:
4+
# Allows you to run this workflow manually from the Actions tab
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-and-perftest:
9+
runs-on: windows-latest # Build on Windows to ensure .NET Framework targets
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Run build
14+
run: ./Build.ps1 -SkipTests
15+
shell: pwsh
16+
17+
- name: Run performance tests
18+
run: ./RunPerfTests.ps1 -Filter ${{ secrets.PERF_TESTS_FILTER }}
19+
shell: pwsh
20+
21+
- name: Upload perf test results artifact
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: perftestresults
25+
path: artifacts\perftests

.github/workflows/release.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
build-and-release:
11+
build-perftest-and-release:
1212
runs-on: windows-latest # Build on Windows to ensure .NET Framework targets
1313
steps:
1414
- uses: actions/checkout@v4
@@ -35,6 +35,10 @@ jobs:
3535
run: ./Build.ps1 -SkipTests
3636
shell: pwsh
3737

38+
- name: Run performance tests
39+
run: ./RunPerfTests.ps1 -Filter "*QuickBenchmarks*"
40+
shell: pwsh
41+
3842
- name: Get last commit message
3943
id: last_commit
4044
if: success() && github.ref == 'refs/heads/main'
@@ -47,34 +51,34 @@ jobs:
4751
env:
4852
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4953
run: |
50-
# Der Basisname der Dateien basierend auf der Versionsnummer
5154
$baseFileName = "Serilog.Sinks.MSSqlServer.${{ env.VERSION }}"
5255
53-
# Suche die exakten Dateipfade für .nupkg und .snupkg
5456
$nupkgFile = Get-ChildItem -Path "artifacts/$baseFileName*.nupkg" | Select-Object -First 1
5557
$snupkgFile = Get-ChildItem -Path "artifacts/$baseFileName*.snupkg" | Select-Object -First 1
58+
$perfReportSinkFile = Get-ChildItem -Path "artifacts/perftests/Serilog.Sinks.MSSqlServer.PerformanceTests.SinkQuickBenchmarks-report.csv" `
59+
| Select-Object -First 1
60+
$perfReportAuditSinkFile = Get-ChildItem -Path "artifacts/perftests/Serilog.Sinks.MSSqlServer.PerformanceTests.AuditSinkQuickBenchmarks-report.csv" `
61+
| Select-Object -First 1
5662
57-
# Überprüfe, ob beide Dateien gefunden wurden
5863
if (-not $nupkgFile) { Write-Error "nupkg file not found" ; exit 1 }
5964
if (-not $snupkgFile) { Write-Error "snupkg file not found" ; exit 1 }
65+
if (-not $perfReportSinkFile) { Write-Error "Benchmark report for sink file not found" ; exit 1 }
66+
if (-not $perfReportAuditSinkFile) { Write-Error "Benchmark report for audit sink file not found" ; exit 1 }
6067
61-
# Ersetze Backslashes durch Forward Slashes für GitHub CLI-Kompatibilität
6268
$nupkgFilePath = $nupkgFile.FullName -replace '\\', '/'
6369
$snupkgFilePath = $snupkgFile.FullName -replace '\\', '/'
70+
$perfReportSinkFilePath = $perfReportSinkFile.FullName -replace '\\', '/'
71+
$perfReportAuditSinkFilePath = $perfReportAuditSinkFile.FullName -replace '\\', '/'
6472
65-
# Ausgabe der Dateipfade zu Debugging-Zwecken
66-
Write-Host "Uploading files: $nupkgFilePath, $snupkgFilePath"
73+
Write-Host "Uploading files: $nupkgFilePath, $snupkgFilePath $perfReportSinkFilePath $perfReportAuditSinkFilePath"
6774
68-
# Erstelle das Release mit den genauen Dateipfaden
6975
gh release create v${{ env.VERSION }} `
7076
--title "v${{ env.VERSION }}" `
7177
--notes "$(Get-Content last_commit_message.txt)" `
72-
$nupkgFilePath $snupkgFilePath
78+
$nupkgFilePath $snupkgFilePath $perfReportSinkFilePath $perfReportAuditSinkFilePath
7379
shell: pwsh
7480

7581
- name: Publish to nuget.org
76-
env:
77-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
7882
run: |
7983
nuget push artifacts\*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
8084
shell: pwsh

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ build/
1717
bld/
1818
[Bb]in/
1919
[Oo]bj/
20+
artifacts/
21+
BenchmarkDotNet.Artifacts/
2022

2123
# Roslyn cache directories
2224
*.ide/
@@ -125,7 +127,7 @@ publish/
125127
# Publish Web Output
126128
*.[Pp]ublish.xml
127129
*.azurePubxml
128-
# TODO: Comment the next line if you want to checkin your web deploy settings
130+
# TODO: Comment the next line if you want to checkin your web deploy settings
129131
# but database connection strings (with potential passwords) will be unencrypted
130132
*.pubxml
131133
*.publishproj

Build.ps1

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ foreach ($src in Get-ChildItem "$PSScriptRoot/src" -Directory) {
3838
}
3939

4040
if ($SkipTests -eq $false) {
41-
foreach ($test in Get-ChildItem "$PSScriptRoot/test" -Filter "*.PerformanceTests" -Directory) {
42-
Push-Location $test.FullName
43-
44-
echo "build: Building performance test project in $($test.FullName)"
45-
46-
& dotnet build -c Release
47-
if ($LASTEXITCODE -ne 0) { exit 2 }
48-
49-
Pop-Location
50-
}
51-
5241
foreach ($test in Get-ChildItem "$PSScriptRoot/test" -Filter "*.Tests" -Directory) {
5342
Push-Location $test.FullName
5443

@@ -59,6 +48,15 @@ if ($SkipTests -eq $false) {
5948

6049
Pop-Location
6150
}
51+
52+
# The performance benchmark tests should at least build without errors during PR validation
53+
$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
54+
Push-Location "$perfTestProjectPath"
55+
56+
echo "build: Building performance test project in $perfTestProjectPath"
57+
& dotnet build -c Release
58+
59+
Pop-Location
6260
}
6361

6462
Pop-Location

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 7.0.2
2+
* Fixed issue #580: Removed deprecated transitive dependency on Microsoft.NETCore.Targets by removing runtime identifier (thanks to @david-brink-talogy)
3+
* Fixed issues #540 and #541 in README
4+
* Added performance tests including a GitHub actions workflow
5+
* Minor cleanups and fixes
6+
17
# 7.0.1
28
* Fixed issue #567: .NET Framework assemblies were not built properly
39
* Consolidated PR validation action workflows and updated some task versions

Directory.Packages.props

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<Project>
2-
<PropertyGroup>
3-
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4-
</PropertyGroup>
5-
<ItemGroup>
6-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
7-
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
8-
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
9-
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
10-
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.6" />
11-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
12-
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
13-
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
14-
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
15-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
16-
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
17-
<PackageVersion Include="FluentAssertions" Version="6.7.0" />
18-
<PackageVersion Include="Dapper.StrongName" Version="2.0.123" />
19-
<PackageVersion Include="Moq" Version="4.18.2" />
20-
<PackageVersion Include="xunit" Version="2.9.0" />
21-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
22-
<PackageVersion Include="Serilog" Version="4.0.0" />
23-
<PackageVersion Include="Serilog.Extensions.Hosting" Version="5.0.1" />
24-
<PackageVersion Include="Serilog.Settings.Configuration" Version="3.4.0" />
25-
</ItemGroup>
26-
</Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
7+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
8+
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
9+
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
10+
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
11+
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.6" />
12+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
13+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
14+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
15+
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
16+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
17+
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
18+
<PackageVersion Include="FluentAssertions" Version="6.7.0" />
19+
<PackageVersion Include="Dapper.StrongName" Version="2.0.123" />
20+
<PackageVersion Include="Moq" Version="4.18.2" />
21+
<PackageVersion Include="xunit" Version="2.9.0" />
22+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
23+
<PackageVersion Include="Serilog" Version="4.0.0" />
24+
<PackageVersion Include="Serilog.Extensions.Hosting" Version="5.0.1" />
25+
<PackageVersion Include="Serilog.Settings.Configuration" Version="3.4.0" />
26+
</ItemGroup>
27+
</Project>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ CREATE TABLE [Logs] (
187187
[Id] int IDENTITY(1,1) NOT NULL,
188188
[Message] nvarchar(max) NULL,
189189
[MessageTemplate] nvarchar(max) NULL,
190-
[Level] nvarchar(128) NULL,
191-
[TimeStamp] datetime NOT NULL,
190+
[Level] nvarchar(max) NULL,
191+
[TimeStamp] datetime NULL,
192192
[Exception] nvarchar(max) NULL,
193193
[Properties] nvarchar(max) NULL
194194
@@ -468,7 +468,7 @@ If `DataLength` is set to a value different to -1 longer text will be truncated.
468468

469469
### Level
470470

471-
This column stores the event level (Error, Information, etc.). For backwards-compatibility reasons it defaults to a length of 128 characters, but 12 characters is recommended. Alternately, the `StoreAsEnum` property can be set to `true` which causes the underlying level enum integer value to be stored as a SQL `tinyint` column. The `DataType` property can only be set to `nvarchar` or `tinyint`. Setting the `DataType` to `tinyint` is identical to setting `StoreAsEnum` to `true`.
471+
This column stores the event level (Error, Information, etc.). For backwards-compatibility reasons it defaults to a length of `nvarchar(max)` characters, but 12 characters is recommended. Alternately, the `StoreAsEnum` property can be set to `true` which causes the underlying level enum integer value to be stored as a SQL `tinyint` column. The `DataType` property can only be set to `nvarchar` or `tinyint`. Setting the `DataType` to `tinyint` is identical to setting `StoreAsEnum` to `true`.
472472

473473
### TimeStamp
474474

RunPerfTests.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[CmdletBinding()]
2+
param (
3+
[Parameter(Mandatory = $false)]
4+
[string]
5+
$Filter = "*"
6+
)
7+
8+
echo "perf: Performance tests started with Filter = $Filter"
9+
10+
Push-Location $PSScriptRoot
11+
12+
$artifactsPath = "$PSScriptRoot\artifacts\perftests"
13+
14+
if (Test-Path "$artifactsPath") {
15+
echo "perf: Cleaning $artifactsPath"
16+
Remove-Item "$artifactsPath" -Force -Recurse
17+
}
18+
19+
New-Item -Path "$artifactsPath" -ItemType Directory
20+
21+
$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
22+
Push-Location "$perfTestProjectPath"
23+
24+
echo "perf: Running performance test project in $perfTestProjectPath"
25+
& dotnet run -c Release -- -f $Filter
26+
27+
cp ".\BenchmarkDotNet.Artifacts\results\*.*" "$artifactsPath\"
28+
Pop-Location
29+
30+
Pop-Location

serilog-sinks-mssqlserver.sln

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
3333
.github\workflows\pr-validation.yml = .github\workflows\pr-validation.yml
3434
README.md = README.md
3535
.github\workflows\release.yml = .github\workflows\release.yml
36+
RunPerfTests.ps1 = RunPerfTests.ps1
37+
.github\workflows\perftests.yml = .github\workflows\perftests.yml
3638
EndProjectSection
3739
EndProject
3840
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetStandardDemoLib", "sample\NetStandardDemo\NetStandardDemoLib\NetStandardDemoLib.csproj", "{8E69E31B-61C7-4175-B886-9C2078FCA477}"
@@ -43,6 +45,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetStandardDemo", "NetStand
4345
EndProject
4446
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppConfigDemo", "sample\AppConfigDemo\AppConfigDemo.csproj", "{6BFE1D21-1442-4375-AB69-14160B906A64}"
4547
EndProject
48+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.MSSqlServer.PerformanceTests", "test\Serilog.Sinks.MSSqlServer.PerformanceTests\Serilog.Sinks.MSSqlServer.PerformanceTests.csproj", "{106A6BAF-F8E4-408B-BB09-391330DA87F2}"
49+
EndProject
4650
Global
4751
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4852
Debug|Any CPU = Debug|Any CPU
@@ -81,6 +85,10 @@ Global
8185
{6BFE1D21-1442-4375-AB69-14160B906A64}.Debug|Any CPU.Build.0 = Debug|Any CPU
8286
{6BFE1D21-1442-4375-AB69-14160B906A64}.Release|Any CPU.ActiveCfg = Release|Any CPU
8387
{6BFE1D21-1442-4375-AB69-14160B906A64}.Release|Any CPU.Build.0 = Release|Any CPU
88+
{106A6BAF-F8E4-408B-BB09-391330DA87F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
89+
{106A6BAF-F8E4-408B-BB09-391330DA87F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
90+
{106A6BAF-F8E4-408B-BB09-391330DA87F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
91+
{106A6BAF-F8E4-408B-BB09-391330DA87F2}.Release|Any CPU.Build.0 = Release|Any CPU
8492
EndGlobalSection
8593
GlobalSection(SolutionProperties) = preSolution
8694
HideSolutionNode = FALSE
@@ -95,6 +103,7 @@ Global
95103
{F908C46D-E72E-41E4-975D-73733294F93F} = {7B2B80DE-427A-4FEC-A7CE-7AD81FED73DE}
96104
{7B2B80DE-427A-4FEC-A7CE-7AD81FED73DE} = {AA346332-5BAF-47F1-B8FB-7600ED61265D}
97105
{6BFE1D21-1442-4375-AB69-14160B906A64} = {AA346332-5BAF-47F1-B8FB-7600ED61265D}
106+
{106A6BAF-F8E4-408B-BB09-391330DA87F2} = {F02D6513-6F45-452E-85A0-41A872A2C1F8}
98107
EndGlobalSection
99108
GlobalSection(ExtensibilityGlobals) = postSolution
100109
SolutionGuid = {AAA6BF8D-7B53-4A5F-A79A-D1B306383B45}

0 commit comments

Comments
 (0)