Skip to content

perf(flights): stop the tracker writing 690 log lines every half hour - #307

Closed
ChuckBuilds wants to merge 1 commit into
mainfrom
perf/flights-log-throttle
Closed

perf(flights): stop the tracker writing 690 log lines every half hour#307
ChuckBuilds wants to merge 1 commit into
mainfrom
perf/flights-log-throttle

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

The measurement

On a running rig, ledmatrix-flights produced 686 of ~800 log lines in 30 minutes — 86% of the device's entire log volume, two unconditional INFO lines per poll at roughly one poll every 5 seconds. Every line is a journal write to the SD card, for a message that mostly repeats itself.

What changed

Processing N aircraft from SkyAware is trace — the summary immediately below reports the same total. Demoted to debug, with lazy %-args so a disabled level costs nothing.

The summary is worth keeping, so it now logs when it changes, with a 300-second heartbeat so a quiet sky doesn't look like a stalled tracker.

Which fields to key on mattered more than expected

My first attempt keyed on the whole summary line and barely helped. Total and With position jitter on nearly every poll as distant traffic drifts through the edge of the receiver's range:

Total: 28, With position: 26, In range (20.0mi): 2, Tracking: 2
Total: 28, With position: 26, In range (20.0mi): 2, Tracking: 2
Total: 27, With position: 26, In range (20.0mi): 2, Tracking: 2   <- "changed"
Total: 27, With position: 24, In range (20.0mi): 2, Tracking: 2   <- "changed"
key 343 samples collapse to
whole line 210 (~40% saved — not worth it)
(in range, tracking) 67 (80% saved)

So it keys on what the plugin actually displays. The jittery counts still ride along in the message, where they cost nothing.

Verification

Replayed the 343 real polls captured from the rig through the committed logic:

replayed 343 real polls at 5.25s apart
  INFO  emitted : 67
  DEBUG (silent): 276
  total log lines from this plugin: 686 -> 67  (90% less)

The heartbeat never fired, so it is a true fallback rather than the thing doing the work.

Safety harness passes at all eight sizes (the fill warns are pre-existing and unrelated — the harness has no live SkyAware data, so it renders the no-data state).

Version

Bumped to 1.12.16, skipping past 1.12.14/1.12.15 so this is independent of merge order with #304 and #305 (both of which claim 1.12.14, so whichever lands second still needs a re-bump).

The flight tracker logged two unconditional INFO lines on every poll -- one
naming the aircraft count it was about to process, one summarising the result.
Polls run about every five seconds, so on a live rig that was 686 lines per
half hour, roughly 86% of the device's entire log volume, and a steady trickle
of journal writes to the SD card for a line that mostly repeated itself.

The "Processing N aircraft" line is trace: the summary immediately below
reports the same total. Demoted to debug, with lazy %-args so a disabled level
costs nothing to skip.

The summary is worth keeping, so it is now reported when it changes. Which
fields to key on mattered more than expected. Total and With-position jitter
on almost every poll as distant traffic drifts through the receiver's edge,
and keying on the whole line collapsed 343 samples to 210 -- barely worth
doing. Keying on what the plugin actually displays, aircraft in range and
aircraft tracked, collapses the same samples to 67. The jittery counts still
ride along in the message, where they cost nothing.

A 300-second heartbeat keeps a quiet sky from looking like a stalled tracker.

Measured by replaying 343 real polls captured from a running rig through the
committed logic: 686 lines become 67, a 90% reduction, with the heartbeat
never needing to fire. Safety harness passes at all eight sizes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d5f8aba0-381b-4873-80de-307b174ce175


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds

Copy link
Copy Markdown
Owner Author

Merge order for the three open flights PRs, test-merged onto main rather than reasoned about:

step PR result final version
1 #304 clean 1.12.14
2 #305 conflicts on manifest.json only needs 1.12.15
3 #307 (this) conflicts on manifest.json + plugins.json only 1.12.16

manager.py conflicts at every step: 0. The three code changes are in different parts of the file and compose without help — only version bookkeeping collides, and plugins.json is generated rather than authored.

The step that needs care is #305. It claims 1.12.14, the same version #304 publishes, so resolving that conflict by taking either side leaves two different builds sharing one version and the store never offers the update. It needs a real re-bump to 1.12.15 — this is the one place where "take theirs" gives a wrong answer that looks right.

For the others, resolve by taking the higher version and then running python update_registry.py to regenerate plugins.json.

Verified on the fully merged tree: all three changes present (vegas width hint, debug-image gate, log throttle), final version 1.12.16, safety harness 8 pass, 0 fail.

@ChuckBuilds

Copy link
Copy Markdown
Owner Author

Superseded by #314, which combines the four ledmatrix-flights PRs into one version bump. Every change from this PR is verified present on that branch; the branch here is untouched if you want to compare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants