line / promgen

Promgen is a configuration file generator for Prometheus
https://line.github.io/promgen/
MIT License
1.06k stars 150 forks source link

[IMPROVEMENT] Improve performance of rendering alerts and silences #372

Closed KarboniteKream closed 2 years ago

KarboniteKream commented 2 years ago

Description

This PR improves performance of rendering alerts and silences in Vue.

Currently, all alerts and silences are always rendered and hidden using the collapse CSS rule. This causes rendering delays on page load and whenever components need to be re-rendered (for example, on form input change; #370).

With changes introduced in this PR, all alerts and silences are now hidden behind v-if, so the HTML elements are not generated/rendered until the expression is truthy.

Detailed changes

Improvements

Before the improvements, the page would be mostly unresponsive until the Alerts block is rendered. Note: All measurements are approximate page reload times without cache, and were performed with 1660 alerts, 25 silences and 6000 farms.

Component Before After
Home page 2s 0.8s
Global alerts section 2s 2.5s
Services page 5.2s 1.9s
Link Farm page 16s 6.7s