feat: nethvoice stats nightly refresh (materialized views)#154
Open
gsanchietti wants to merge 2 commits into
Open
feat: nethvoice stats nightly refresh (materialized views)#154gsanchietti wants to merge 2 commits into
gsanchietti wants to merge 2 commits into
Conversation
bcce853 to
0489f42
Compare
f7c80bc to
e1a49d1
Compare
Tbaile
reviewed
Jul 1, 2026
Tbaile
left a comment
Collaborator
There was a problem hiding this comment.
Let me help supporting podman-compose, what version are you running?
e1a49d1 to
e2b0354
Compare
Add materialized view for NethVoice statistics. This change greatly increase query performances on BI tools. Assisted-By: Claude:Sonnet4.6
e2b0354 to
acc99ed
Compare
Member
Author
Not need at all PR back to draft because I'm going to introduce optimizations for the main grafana dashboard |
Pre-compute the PhoneHome Grafana dashboard's JSONB-heavy queries into materialized views (phonehome_installations, phonehome_nethserver8_node_versions, phonehome_daily_active_counts) refreshed nightly, and rewire the dashboard panels to read from them instead of scanning installations/countries live on every load. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds nightly-refreshed
nethvoice_*andphonehome_*materialized views so Metabase/Grafana can query pre-flattened stats without live JSONB unpacking.Key files
database/migrations/2026_06_30_120000_nethvoice_stats_materialized_views.php— creates 12 materialized views viaDB::statement()app/Jobs/RefreshNethvoiceStatsMaterializedViews.php— refreshes views in dependency orderapp/Console/Kernel.php— schedules job nightly at 02:00 withwithoutOverlapping()app/Console/Commands/NethvoiceRefreshStatsCommand.php—php artisan nethvoice:refresh-statsfor manual runsPhoneHome dashboard views
Same pattern applied to the PhoneHome Grafana dashboard:
phonehome_installations,phonehome_nethserver8_node_versions,phonehome_daily_active_counts— replace the JSONB-unpacking queries inphonehome.jsonwith plainSELECTs.RefreshPhonehomeDashboardMaterializedViewsjob,phonehome:refresh-dashboard-statscommand, scheduleddailyAt('02:15').containers/grafana/provisioning/dashboards/phonehome.json).SELECTto the Grafana DB user.