Skip to content

Commit 8602913

Browse files
committed
7.0.4 release
1 parent 67783a5 commit 8602913

File tree

13 files changed

+187
-147
lines changed

13 files changed

+187
-147
lines changed

db/TD_API_TRACE.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[TRC_DURATION] DECIMAL(18,3) NOT NULL,
1111
[TRC_STATUSCODE] INT NOT NULL,
1212
[TRC_MACHINENAME] varchar(256) NOT NULL,
13-
[TRC_REQUEST_TYPE] VARCHAR(50) NOT NULL,
13+
[TRC_REQUEST_TYPE] VARCHAR(50) NULL,
1414
[TRC_REQUEST_VERB] VARCHAR(50) NOT NULL,
1515
[TRC_ERROR_PATH] VARCHAR(1024) NULL,
1616
[TRC_CORRELATION_ID] VARCHAR(1024) null,

db/configuration/stored procedures/Security_Trace_Create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CREATE PROCEDURE Security_Trace_Create @TrcMethod NVARCHAR(256) = null
2525
,@TrcMachineName varchar(256)
2626
,@TrcErrorPath varchar(1028) = null
2727
,@TrcRequestVerb varchar(50)
28-
,@TrcRequestType varchar(50)
28+
,@TrcRequestType varchar(50) = null
2929
,@TrcCorrelationID varchar(1028)
3030
,@TrcJsonRpcErrorCode int =null
3131
AS

rls/packages/API.Library.7.0.2.nupkg

66.7 KB
Binary file not shown.

rls/packages/API.Library.7.0.3.nupkg

66.7 KB
Binary file not shown.

rls/packages/API.Library.7.0.4.nupkg

66.7 KB
Binary file not shown.

src/API.Library/API.Library.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<PackageId>API.Library</PackageId>
1313
<Product>API Library</Product>
1414
<Copyright>Central Statistics Office, Ireland</Copyright>
15-
<Version>7.0.1</Version>
15+
<Version>7.0.4</Version>
1616
<Authors>Central Statistics Office, Ireland</Authors>
1717
<SignAssembly>False</SignAssembly>
1818
<RepositoryUrl>https://github.com/CSOIreland/Server-API-Library</RepositoryUrl>
1919
<PackageReleaseNotes>
20-
- [BUG FIX] check that key is not already in attribute dictionarys
20+
- [BUG FIX] allow request type for tracing to be null
2121
</PackageReleaseNotes>
2222
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
2323
<RestoreLockedMode>true</RestoreLockedMode>
@@ -40,8 +40,7 @@
4040
<ItemGroup>
4141
<PackageReference Include="EnyimMemcachedCore" Version="3.2.1" />
4242
<PackageReference Include="log4net" Version="2.0.17" />
43-
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.4" />
44-
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
43+
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
4544
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
4645
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
4746
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />

src/API.Library/Entities/API.Common.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ internal static MethodInfo CheckAPICallsAllowed(string methodName, string method
507507
dynamic jsonObj = new ExpandoObject();
508508
jsonObj.methodName = methodName;
509509
jsonObj.methodPath = methodPath;
510+
jsonObj.methodType = typeOfClassType.Name; //Fixes bug where previous RESTful call breaks subsequent JSON-rpc calls and vice versa
510511

511512
string serializedAPIInfo = Utility.JsonSerialize_IgnoreLoopingReference(jsonObj);
512513

src/API.Library/Entities/API.RESTful.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public async Task ProcessRequest(HttpContext httpContext, CancellationTokenSourc
110110

111111
if (httpContext.Request.Method == "HEAD")
112112
{
113+
114+
trace.TrcRequestType = "HEAD";
115+
113116
httpContext.Response.Headers.Append("Cache-Control", "public");
114117

115118
if (!String.IsNullOrEmpty(result.mimeType))

src/API.Library/Entities/Performance.ADO.cs

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,47 @@ internal static class Performance_ADO
77

88
internal static void Create(ADO ado, List<PerformanceObj> performanceList, bool api_performance_enabled)
99
{
10-
if (!api_performance_enabled)
10+
try
1111
{
12-
return;
13-
}
12+
13+
if (!api_performance_enabled)
14+
{
15+
return;
16+
}
17+
18+
Log.Instance.Info("Performance Records Collected: " + performanceList.Count.ToString());
19+
20+
DataTable performanceTable = new DataTable();
21+
performanceTable.Columns.Add("PRF_PROCESSOR_PERCENTAGE");
22+
performanceTable.Columns.Add("PRF_MEMORY_AVAILABLE");
23+
performanceTable.Columns.Add("PRF_REQUEST_QUEUE");
24+
performanceTable.Columns.Add("PRF_REQUEST_PERSECOND");
25+
performanceTable.Columns.Add("PRF_DATETIME");
26+
performanceTable.Columns.Add("PRF_SERVER");
1427

15-
Log.Instance.Info("Performance Records Collected: " + performanceList.Count.ToString());
28+
foreach (var p in performanceList)
29+
{
30+
performanceTable.Rows.Add(new object[] { p.ProcessorPercentage, p.MemoryAvailableMBytes, p.RequestsQueued, p.RequestPerSec, p.DateTime, p.Server });
31+
}
1632

17-
DataTable performanceTable = new DataTable();
18-
performanceTable.Columns.Add("PRF_PROCESSOR_PERCENTAGE");
19-
performanceTable.Columns.Add("PRF_MEMORY_AVAILABLE");
20-
performanceTable.Columns.Add("PRF_REQUEST_QUEUE");
21-
performanceTable.Columns.Add("PRF_REQUEST_PERSECOND");
22-
performanceTable.Columns.Add("PRF_DATETIME");
23-
performanceTable.Columns.Add("PRF_SERVER");
33+
var mapping = new List<KeyValuePair<string, string>>();
34+
for (int i = 0; i < performanceTable.Columns.Count; i++)
35+
{
36+
mapping.Add(new KeyValuePair<string, string>(performanceTable.Columns[i].ColumnName, performanceTable.Columns[i].ColumnName));
37+
}
2438

25-
foreach (var p in performanceList)
39+
40+
ado.ExecuteBulkCopy("TD_PERFORMANCE", mapping, performanceTable);
41+
}
42+
catch (Exception ex)
2643
{
27-
performanceTable.Rows.Add(new object[] { p.ProcessorPercentage, p.MemoryAvailableMBytes, p.RequestsQueued, p.RequestPerSec, p.DateTime, p.Server });
44+
Log.Instance.Error("Error storing performance information");
45+
Log.Instance.Error(ex);
2846
}
29-
30-
var mapping = new List<KeyValuePair<string, string>>();
31-
for (int i = 0; i < performanceTable.Columns.Count; i++)
47+
finally
3248
{
33-
mapping.Add(new KeyValuePair<string, string>(performanceTable.Columns[i].ColumnName, performanceTable.Columns[i].ColumnName));
49+
ado.Dispose();
3450
}
35-
ado.ExecuteBulkCopy("TD_PERFORMANCE", mapping, performanceTable);
36-
37-
ado.Dispose();
3851
}
3952
}
4053
}

src/API.Library/Entities/Performance.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,18 @@ internal void CollectData(CancellationToken cancelToken)
5353
performanceObj.MemoryAvailableMBytes = (int)Math.Round(memoryAvailableMBytes);
5454
performanceObj.RequestsQueued = (int)Math.Round(requestsQueued);
5555
performanceObj.RequestPerSec = (int)Math.Round(requestPerSec);
56-
performanceObj.DateTime = DateTime.Now.TrimToMinute(TimeSpan.TicksPerMinute); ;
56+
performanceObj.DateTime = DateTime.Now.TrimToMinute(TimeSpan.TicksPerMinute);
5757

5858
items.Add(performanceObj);
5959

6060
// Collect data every second
6161
Thread.Sleep(1000);
6262
}
63+
64+
if (cancelToken.IsCancellationRequested)
65+
{
66+
Performance_ADO.Create(String.IsNullOrEmpty(ApiServicesHelper.ADOSettings.API_PERFORMANCE_DATABASE) ? new ADO() : new ADO(ApiServicesHelper.ADOSettings.API_PERFORMANCE_DATABASE), items, ApiServicesHelper.APIPerformanceSettings.API_PERFORMANCE_ENABLED);
67+
}
6368
}
6469
catch (ThreadAbortException e)
6570
{
@@ -82,22 +87,7 @@ internal void CollectData(CancellationToken cancelToken)
8287
/// </summary>
8388
public void Dispose()
8489
{
85-
Dispose(true);
8690
GC.SuppressFinalize(this);
8791
}
88-
89-
/// <summary>
90-
/// The bulk of the clean-up code is implemented in Dispose(bool)
91-
/// </summary>
92-
/// <param name="disposing"></param>
93-
protected virtual void Dispose(bool disposing)
94-
{
95-
// Store Perfromance
96-
if (disposing)
97-
{
98-
// Store data
99-
Performance_ADO.Create(String.IsNullOrEmpty(ApiServicesHelper.ADOSettings.API_PERFORMANCE_DATABASE) ? new ADO() : new ADO(ApiServicesHelper.ADOSettings.API_PERFORMANCE_DATABASE), items, ApiServicesHelper.APIPerformanceSettings.API_PERFORMANCE_ENABLED);
100-
}
101-
}
10292
}
10393
}

0 commit comments

Comments
 (0)