Add custom checks stores & storage checks - #5668
Conversation
|
@rbev I think there is a misunderstanding here. |
4c78340 to
f9804f5
Compare
| Status = c.Status, | ||
| ReportedAt = c.ReportedAt, | ||
| FailureReason = c.FailureReason | ||
| }).ToList(), new QueryStatsInfo("", page.Count, false)); |
There was a problem hiding this comment.
Etag left blank, it will be revisited as part of other work.
| @@ -1,5 +1,6 @@ | |||
| namespace ServiceControl.Persistence.EFCore.SqlServer; | |||
|
|
|||
| using CustomChecks; | |||
| if (customCheck == null || | ||
| (customCheck.Status == Status.Fail && !detail.HasFailed) || | ||
| (customCheck.Status == Status.Pass && detail.HasFailed)) |
There was a problem hiding this comment.
It's a direct cut & paste from the raven implementation
| customCheck.CustomCheckId = detail.CustomCheckId; | ||
| customCheck.Category = detail.Category; | ||
| customCheck.Status = detail.HasFailed ? Status.Fail : Status.Pass; | ||
| customCheck.ReportedAt = detail.ReportedAt; |
There was a problem hiding this comment.
Should this be updated everytime it changes or should it be the first time?
There was a problem hiding this comment.
Raven updates everything every time, but actually it should use the upsert utility that exists now
| var customCheck = await context.CustomChecks.FindAsync(id); | ||
| if (customCheck != null) | ||
| { | ||
| context.CustomChecks.Remove(customCheck); | ||
| await context.SaveChangesAsync(); | ||
| } |
There was a problem hiding this comment.
You can do this in one query using the ExecuteDeleteAsync
| "version": "10.0.302", | ||
| "allowPrerelease": false, | ||
| "rollForward": "latestFeature" | ||
| "rollForward": "disable" |
There was a problem hiding this comment.
I don't think we should do this without talking to Brandon!
There was a problem hiding this comment.
or at least do it in a different PR so we can bring him in for a review.
There was a problem hiding this comment.
Yeah sorry, had just done it on this branch to test and forgot to revert it
This pull request adds support for storing custom check data in both PostgreSQL and SQL Server EF Core persistence layers. It introduces new migration files and updates the database model snapshots to include a new
CustomCheckstable. Additionally, there are minor updates to the .NET SDK version and some code organization improvements.Database schema changes:
custom_checkstable for PostgreSQL and aCustomCheckstable for SQL Server, including columns for IDs, category, status, timestamps, failure reasons, and endpoint information. [1] [2]PostgreSqlServiceControlDbContextModelSnapshot.cs,SqlServerServiceControlDbContextModelSnapshot.cs) to reflect the addition of theCustomCheckEntityand its mapping to the new tables. [1] [2]CustomCheckstable.Build and configuration updates:
global.jsonfrom10.0.100to10.0.302and changed therollForwardpolicy todisable.Code and dependency improvements:
using CustomChecks;directives to relevant files for clarity and to ensure correct namespace usage. [1] [2]SqlServerPersistenceinstance.