Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-2509

Cache Grafana CSS to optimize the iframe load

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.2
    • Component/s: Backend
    • Labels:
    • Sprint:
      Sprint 27

      Description

      Currently we are getting all the Grafana CSS (no browser cache) everytime we load Grafana iframe, because of this line:

      'grafana.light.min.css?cache-buster={}'.format(int(time.time()))
      

      The "cache-buster" parameter was originally created as a temporary solution, to guarantee that browser will not cache this file, so we always use the latest Grafana CSS (important if Grafana is upgraded).

      Now we need to find a better solution because the load of the Grafana iframe is very slow.

      Possible solutions:

      Solution 1
      openATTIC should know the name of the file that contains the hash on the filename, and use it (e.g. "grafana.light.min.fc104690.css"). This will guarantee that we always use the latest CSS, and the browser will cache it until the hash change.

      Solution 2
      If Solution 1 is not feasible, use Grafana version in cache-buster parameter:

      'grafana.light.min.css?cache-buster={}'.format(grafana_version)
      

      Solution 3
      If Solution 2 is not feasible, use openATTIC version in cache-buster parameter:

      'grafana.light.min.css?cache-buster={}'.format(openattic_version)
      

        Attachments

          Activity

            People

            Assignee:
            rimarques Ricardo Marques
            Reporter:
            rimarques Ricardo Marques
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: