milestone 30: overview as a dashboard, explicit health contract, period aggregations
Gates / frontend (push) Successful in 1m32s
Gates / test (push) Successful in 1m54s
Gates / package (push) Successful in 5m28s
Gates / container (push) Successful in 14s
Gates / test-aarch64 (push) Failing after 3h10m0s
CI / gates (push) Failing after 3h11m55s
Gates / frontend (push) Successful in 1m32s
Gates / test (push) Successful in 1m54s
Gates / package (push) Successful in 5m28s
Gates / container (push) Successful in 14s
Gates / test-aarch64 (push) Failing after 3h10m0s
CI / gates (push) Failing after 3h11m55s
This commit is contained in:
@@ -126,8 +126,6 @@ pub fn list(
|
||||
io: std.Io,
|
||||
request: *http_util.Request,
|
||||
) http_util.HandlerError!void {
|
||||
_ = io;
|
||||
|
||||
var buffers: Buffers = .{};
|
||||
const filter = parseFilter(request.query, &buffers) catch |err| {
|
||||
return http_util.respondError(request, .bad_request, message(err));
|
||||
@@ -136,7 +134,7 @@ pub fn list(
|
||||
const database = state.querylog_db orelse
|
||||
return http_util.respondError(request, .service_unavailable, "query log unavailable");
|
||||
|
||||
const result = page(database, request.arena, filter) catch |err| {
|
||||
const result = readPage(state, io, database, request.arena, filter) catch |err| {
|
||||
// The one thing this handler logs: a database fault is a property of
|
||||
// the box, not of the request, and the client is told nothing about it.
|
||||
log.warn("query log read failed: {s}", .{@errorName(err)});
|
||||
@@ -156,12 +154,10 @@ pub fn detail(
|
||||
io: std.Io,
|
||||
request: *http_util.Request,
|
||||
) http_util.HandlerError!void {
|
||||
_ = io;
|
||||
|
||||
const database = state.querylog_db orelse
|
||||
return http_util.respondError(request, .service_unavailable, "query log unavailable");
|
||||
|
||||
const row = queries_repo.detailById(database, request.arena, request.id.?) catch |err| {
|
||||
const row = detailRow(state, io, database, request.arena, request.id.?) catch |err| {
|
||||
log.warn("query log read failed: {s}", .{@errorName(err)});
|
||||
return http_util.respondError(request, .internal_server_error, "internal error");
|
||||
};
|
||||
@@ -172,6 +168,40 @@ pub fn detail(
|
||||
return http_util.respondJson(request, .ok, provenance_view.fromDetail(found), &.{});
|
||||
}
|
||||
|
||||
/// The rows and the coverage watermark come from one database state, so a
|
||||
/// prune between them cannot tag pre-prune rows with a post-prune
|
||||
/// `available_since`.
|
||||
fn readPage(
|
||||
state: *server.WebState,
|
||||
io: std.Io,
|
||||
database: *db.Db,
|
||||
arena: Allocator,
|
||||
filter: queries_repo.QueryFilter,
|
||||
) db.Error!Page {
|
||||
var scope = try server.QuerylogRead.open(state, io, database);
|
||||
errdefer scope.abort();
|
||||
const result = try page(database, arena, filter);
|
||||
try scope.commit();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// One row, read under the shared lock. There is nothing to keep consistent
|
||||
/// with a second statement here; the lock is what keeps this read out of
|
||||
/// another response's open transaction.
|
||||
fn detailRow(
|
||||
state: *server.WebState,
|
||||
io: std.Io,
|
||||
database: *db.Db,
|
||||
arena: Allocator,
|
||||
id: i64,
|
||||
) db.Error!?queries_repo.QueryDetail {
|
||||
var scope = try server.QuerylogRead.open(state, io, database);
|
||||
errdefer scope.abort();
|
||||
const row = try queries_repo.detailById(database, arena, id);
|
||||
try scope.commit();
|
||||
return row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user