More step spans where flame graphs showed time with nothing under it (#350)

A week of traces folded with query.py flame left whole requests opaque:
entries_in at 46-82 ms a request with the page's query and its enclosures
together, /api/art 37 ms, /api/status 95 ms, PATCH /api/feeds/{id} 72 ms and
DELETE 45 ms. Each now has a step around what it waits on: the page and its
enclosures; the artwork cache, the check that a feed names it, the fetch and the
write; the status counts; and in changing or leaving a feed, each database call,
the wait for the catalogue's lock and storing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 12:45:58 +00:00
parent ccc4766b03
commit 511246acb2
4 changed files with 48 additions and 32 deletions

View File

@@ -1468,8 +1468,7 @@ impl Db {
LEFT JOIN entry_state s ON s.user_id = {user} AND s.feed_id = e.feed_id AND s.guid = e.guid
ORDER BY {order}"
);
let mut rows = self
.rows(&sql, a.0)
let mut rows = tracing::Instrument::instrument(self.rows(&sql, a.0), step("page"))
.await?
.iter()
.map(|r| {
@@ -1499,11 +1498,14 @@ impl Db {
// Only the guids on this page, so a feed with thousands of entries stays cheap. A page
// can span feeds, so each file is matched to its row by feed as well as guid, below.
let encs = enclosures::Entity::find()
.filter(enclosures::Column::Guid.is_in(rows.iter().map(|r| r.guid.clone())))
.order_by_asc(enclosures::Column::Id)
.all(&self.orm)
.await?;
let encs = tracing::Instrument::instrument(
enclosures::Entity::find()
.filter(enclosures::Column::Guid.is_in(rows.iter().map(|r| r.guid.clone())))
.order_by_asc(enclosures::Column::Id)
.all(&self.orm),
step("enclosures"),
)
.await?;
for enc in encs {
if let Some(row) = rows.iter_mut().find(|r| r.guid == enc.guid && r.feed_id == enc.feed_id) {
row.enclosures.push(EncRow::from(enc));