Skip to content

Commit df95500

Browse files
committed
2.12.1 Initial
1 parent 53a11f4 commit df95500

14 files changed

Lines changed: 138 additions & 30 deletions

File tree

.github/workflows/build-test-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444
with:
45-
tag_name: v2.12.0-client-v2.2.0
46-
release_name: "AOT Client v2.2.0 NpgsqlRest v2.12.0"
45+
tag_name: v2.12.1-client-v2.2.1
46+
release_name: "AOT Client v2.2.1 NpgsqlRest v2.12.1"
4747
draft: true
4848
prerelease: true
4949

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,4 @@ src/
403403
appsettings.Development.json
404404

405405
*.ignore
406+
*/k6/*.csv

NpgsqlRest/MiddlewareExtension.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ await options.ValidateParametersAsync(new ParameterValidationValues(
697697
{
698698
if (await reader.ReadAsync())
699699
{
700-
string? value = reader.GetProviderSpecificValue(0) as string;
700+
string? value = reader.GetValue(0) as string;
701+
701702
TypeDescriptor descriptor = routine.ColumnsTypeDescriptor[0];
702703
if (endpoint.ResponseContentType is not null)
703704
{
@@ -816,10 +817,8 @@ await options.ValidateParametersAsync(new ParameterValidationValues(
816817
}
817818

818819
var bufferRows = endpoint.BufferRows ?? options.BufferRows;
819-
var values = new object[reader.FieldCount];
820820
while (await reader.ReadAsync())
821821
{
822-
reader.GetProviderSpecificValues(values);
823822
rowCount++;
824823
if (!first)
825824
{
@@ -840,8 +839,7 @@ await options.ValidateParametersAsync(new ParameterValidationValues(
840839

841840
for (var i = 0; i < routineReturnRecordCount; i++)
842841
{
843-
//object value = reader.GetProviderSpecificValue(i);
844-
object value = values[i];
842+
object value = reader.GetValue(i);
845843

846844
// AllResultTypesAreUnknown = true always returns string, except for null
847845
string raw = value == DBNull.Value ? "" : (string)value;

NpgsqlRest/NpgsqlRest.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2929
<PackageReadmeFile>README.MD</PackageReadmeFile>
3030
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
31-
<Version>2.12.0</Version>
32-
<AssemblyVersion>2.12.0</AssemblyVersion>
33-
<FileVersion>2.12.0</FileVersion>
34-
<PackageVersion>2.12.0</PackageVersion>
31+
<Version>2.12.1</Version>
32+
<AssemblyVersion>2.12.1</AssemblyVersion>
33+
<FileVersion>2.12.1</FileVersion>
34+
<PackageVersion>2.12.1</PackageVersion>
3535
</PropertyGroup>
3636

3737
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">

NpgsqlRestClient/Builder.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,34 @@ public static void BuildLogger()
8080
if (LogToConsole is true || LogToFile is true)
8181
{
8282
var loggerConfig = new LoggerConfiguration().MinimumLevel.Verbose();
83-
var levels = logCfg?.GetSection("MinimalLevels")?.GetChildren()?.ToList();
84-
if (levels is null)
83+
bool systemAdded = false;
84+
bool microsoftAdded = false;
85+
foreach (var level in logCfg?.GetSection("MinimalLevels")?.GetChildren() ?? [])
8586
{
86-
loggerConfig.MinimumLevel.Override("System", Serilog.Events.LogEventLevel.Warning);
87-
loggerConfig.MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Warning);
88-
}
89-
else
90-
{
91-
foreach (var level in logCfg?.GetSection("MinimalLevels")?.GetChildren() ?? [])
87+
var key = level.Key;
88+
var value = GetEnum<Serilog.Events.LogEventLevel?>(level.Value);
89+
if (value is not null && key is not null)
9290
{
93-
var key = level.Key;
94-
var value = GetEnum<Serilog.Events.LogEventLevel?>(level.Value);
95-
if (value is not null && key is not null)
91+
loggerConfig.MinimumLevel.Override(key, value.Value);
92+
if (string.Equals(key, "System", StringComparison.OrdinalIgnoreCase))
93+
{
94+
systemAdded = true;
95+
}
96+
if (string.Equals(key, "Microsoft", StringComparison.OrdinalIgnoreCase))
9697
{
97-
loggerConfig.MinimumLevel.Override(key, value.Value);
98+
microsoftAdded = true;
9899
}
99100
}
100101
}
102+
if (systemAdded is false)
103+
{
104+
loggerConfig.MinimumLevel.Override("System", Serilog.Events.LogEventLevel.Warning);
105+
}
106+
if (microsoftAdded is false)
107+
{
108+
loggerConfig.MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Warning);
109+
}
110+
101111
string outputTemplate = GetConfigStr("OutputTemplate", logCfg) ??
102112
"[{Timestamp:HH:mm:ss.fff} {Level:u3}] {Message:lj} [{SourceContext}]{NewLine}{Exception}";
103113
if (LogToConsole is true)

NpgsqlRestClient/NpgsqlRestClient.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
<InvariantGlobalization>true</InvariantGlobalization>
88
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
99
<PublishAot>true</PublishAot>
10-
<Version>2.2.0</Version>
10+
<Version>2.2.1</Version>
1111
</PropertyGroup>
1212

13+
<ItemGroup>
14+
<Content Remove="appsettings.json" />
15+
</ItemGroup>
16+
1317
<ItemGroup>
1418
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
1519
<PackageReference Include="System.Text.Json" Version="8.0.5" />
@@ -24,5 +28,9 @@
2428
<ItemGroup>
2529
<Folder Include="src\app\" />
2630
</ItemGroup>
31+
32+
<ItemGroup>
33+
<None Include="appsettings.json" />
34+
</ItemGroup>
2735

2836
</Project>

NpgsqlRestClient/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
2.2.0.0
2+
2.2.1.0
33
*/
44
{
55
//

PerfomanceTests/k6/script.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { check } from "k6";
2+
import http from "k6/http";
3+
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js';
4+
5+
const now = new Date();
6+
const stamp = '2_12__xxxx__' + now.getFullYear() +
7+
String(now.getMonth() + 1).padStart(2, '0') +
8+
String(now.getDate()).padStart(2, '0') +
9+
String(now.getHours()).padStart(2, '0') +
10+
String(now.getMinutes()).padStart(2, '0'); //__ENV.STAMP;
11+
const tag = "localhost" //__ENV.TAG;
12+
const records = 50; //Number(__ENV.RECORDS || "10")
13+
const duration = "60s"; //__ENV.DURATION || "60s";
14+
const target = 100; //Number(__ENV.TARGET || "100");
15+
16+
const url = 'http://localhost:5000/api/test-data' + "?" +
17+
Object.entries({
18+
_records: records,
19+
_text_param: 'ABCDEFGHIJKLMNOPRSTUVWXYZ',
20+
_int_param: 1234567890,
21+
_ts_param: new Date('2014-12-31').toISOString(),
22+
_bool_param: true
23+
})
24+
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
25+
.join('&');
26+
27+
// define configuration
28+
export const options = {
29+
// define thresholds
30+
thresholds: {
31+
http_req_failed: [{ threshold: "rate<0.01", abortOnFail: true }], // availability threshold for error rate
32+
http_req_duration: ["p(99)<1000"], // Latency threshold for percentile
33+
},
34+
// define scenarios
35+
scenarios: {
36+
breaking: {
37+
executor: "ramping-vus",
38+
stages: [
39+
{ duration: duration, target: target },
40+
],
41+
},
42+
},
43+
};
44+
45+
export default function () {
46+
const res = http.get(url);
47+
check(res, {
48+
[`${tag} status is 200`]: (r) => r.status === 200,
49+
[`${tag} response is JSON`]: (r) => r.headers['Content-Type'] && r.headers['Content-Type'].includes('application/json'),
50+
[`${tag} response has data`]: (r) => r.body && JSON.parse(r.body).length > 0,
51+
});
52+
}
53+
54+
export function handleSummary(data) {
55+
return {
56+
[`${stamp}_${tag}_summary.txt`]: textSummary(data, { indent: ' ', enableColors: false }),
57+
[`${stamp}_${tag}.csv`]: `${data.metrics.http_reqs.values.count},${data.metrics.http_reqs.values.rate},${data.metrics.http_req_failed.values.rate}`,
58+
//[`/results/${stamp}/${tag}_summary.json`]: JSON.stringify(data, null, 2),
59+
}
60+
}

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Note: For a changelog for a client application [see the client application page
44

55
---
66

7+
## Version [2.12.1](https://github.com/vb-consulting/NpgsqlRest/tree/2.12.1 (2024-11-06)
8+
9+
[Full Changelog](https://github.com/vb-consulting/NpgsqlRest/compare/2.12.0...2.12.1)
10+
11+
Reverted changes in reader logic (Reader Optimizations and Provider-Specific Values). Detailed perfomance load tests and examining the Npgsql sozrce does not justify these changes.
12+
13+
---
14+
715
## Version [2.12.0](https://github.com/vb-consulting/NpgsqlRest/tree/2.12.0) (2024-10-29)
816

917
[Full Changelog](https://github.com/vb-consulting/NpgsqlRest/compare/2.11.0...2.12.0)

client.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,30 @@ Example: override Auth:CookieName config npgsqlrest --auth:cookiename=Test
9191

9292
## Changelog
9393

94+
## 2.2.1
95+
96+
```console
97+
Versions:
98+
.NET 8.0.10
99+
Client Build 2.2.1.0
100+
Serilog.AspNetCore 8.0.3.0
101+
Npgsql 8.0.5.0
102+
NpgsqlRest 2.12.1.0
103+
NpgsqlRest.HttpFiles 1.0.2.0
104+
NpgsqlRest.TsClient 1.13.0.0
105+
```
106+
107+
Client changes:
108+
109+
Fixed issue in overrding Log config section MinimalLevels. Log MinimalLevels are now:
110+
- System: Warning
111+
- Microsoft: Warning
112+
113+
In previous versions this default wasn't initialized properly that could lead to over-logging.
114+
94115
## 2.2.0
95116

117+
```console
96118
Versions:
97119
.NET 8.0.10
98120
Client Build 2.2.0.0
@@ -101,6 +123,7 @@ Npgsql 8.0.5.0
101123
NpgsqlRest 2.12.0.0
102124
NpgsqlRest.HttpFiles 1.0.2.0
103125
NpgsqlRest.TsClient 1.13.0.0
126+
```
104127

105128
Client changes:
106129

0 commit comments

Comments
 (0)