Skip to content

Commit

Permalink
feat(bundles debug): add more bundle timestamps to debug output PE-4212
Browse files Browse the repository at this point in the history
Adds 'MAX' of 'last' timestamps on 'bundles' to help diagnose where the
unbundling pipeline is getting stuck when there are issues.
  • Loading branch information
djwhitt committed Jul 25, 2023
1 parent 33eddea commit 584ad71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/database/sql/bundles/stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
SELECT
COUNT(*) AS count,
IFNULL(SUM(data_item_count), 0) AS data_item_count,
IFNULL(SUM(matched_data_item_count), 0) AS matched_data_item_count
IFNULL(SUM(matched_data_item_count), 0) AS matched_data_item_count,
IFNULL(MAX(last_queued_at), -1) AS max_queued_at,
IFNULL(MAX(last_skipped_at), -1) AS max_skipped_at,
IFNULL(MAX(last_unbundled_at), -1) AS max_unbundled_at,
IFNULL(MAX(last_fully_indexed_at), -1) AS max_fully_indexed_at
FROM bundles

-- selectDataItemStats
SELECT
SUM(data_item_count) AS data_item_count,
SUM(nested_data_item_count) AS nested_data_item_count,
MAX(max_new_indexed_at) AS last_new_indexed_at,
MAX(max_stable_indexed_at) AS last_stable_indexed_at
MAX(max_new_indexed_at) AS max_new_indexed_at,
MAX(max_stable_indexed_at) AS max_stable_indexed_at
FROM (
SELECT
COUNT(*) AS data_item_count,
Expand Down
12 changes: 10 additions & 2 deletions src/database/standalone-sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ type DebugInfo = {
};
timestamps: {
now: number;
maxBundleQueuedAt: number;
maxBundleSkippedAt: number;
maxBundleUnbundledAt: number;
maxBundleFullyIndexedAt: number;
maxStableDataItemIndexedAt: number;
maxNewDataItemIndexedAt: number;
};
Expand Down Expand Up @@ -946,8 +950,12 @@ export class StandaloneSqliteDatabaseWorker {
},
timestamps: {
now: currentUnixTimestamp(),
maxNewDataItemIndexedAt: dataItemStats.last_new_indexed_at,
maxStableDataItemIndexedAt: dataItemStats.last_stable_indexed_at,
maxBundleQueuedAt: bundleStats.max_queued_at,
maxBundleSkippedAt: bundleStats.max_skipped_at,
maxBundleUnbundledAt: bundleStats.max_unbundled_at,
maxBundleFullyIndexedAt: bundleStats.max_fully_indexed_at,
maxNewDataItemIndexedAt: dataItemStats.max_new_indexed_at,
maxStableDataItemIndexedAt: dataItemStats.max_stable_indexed_at,
},
};
}
Expand Down

0 comments on commit 584ad71

Please sign in to comment.