Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: grr serve -w don't works #552

Open
rsotolongo opened this issue Jan 8, 2025 · 7 comments
Open

[Bug]: grr serve -w don't works #552

rsotolongo opened this issue Jan 8, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@rsotolongo
Copy link

rsotolongo commented Jan 8, 2025

Grizzly Version

2025/01/08 19:14:04 grr version aaf77a3

Expected Behavior

Once Grizzly Server started (grr serve -w ...) and a file on disk within the directory identified is changed, the dashboard SHOULD be reloaded (refreshed at least).

Actual Behavior

Dashboard remains unchanged.

Steps to Reproduce

  1. cat /root/resources/test.json
Image
  1. grr serve -w /root/resources -l debug

  2. Navigate to http://localhost:8080

Image
  1. Modify /root/resources/test.json

  2. cat /root/resources/test.json

Image
  1. Refresh http://localhost:8080
Image

Please check the logs:

Image
@rsotolongo rsotolongo added the bug Something isn't working label Jan 8, 2025
@Pokom
Copy link

Pokom commented Jan 14, 2025

@rsotolongo It looks like you're on a fairly old version of grr. Can you try updating to the latest version

grr --version                                                                                                                                                                               
2025/01/14 13:41:39 grr version v0.6.1

Also it would be helpful to have the full content of the dashboard from cat /root/resources/test.json. The screenshot makes it such that we can't import it and test.

Once you've tried with the latest version of grr and confirmed it's still an issue and provided the raw json blob for the dashobard, then we can continue to triage.

@rsotolongo
Copy link
Author

I'm executing Grizzly from its latest Docker image and the result of execute: "grr --version" is:

2025/01/14 19:51:04 grr version a2f73a8

The behavior is the same, I mean, the -w parameter don't watch for changes in dashboard files or not detect it. I don't know how the content of the dashboard could be relevant but here it is:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 54,
  "links": [],
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "mimir"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "11.4.0",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "mimir"
          },
          "editorMode": "code",
          "expr": "container_cpu_utilization_ratio{k8s_cluster_name=\"dev-eks\"}",
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Panel Title",
      "type": "timeseries"
    }
  ],
  "preload": false,
  "schemaVersion": 40,
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "test",
  "uid": "ce9zx9fq96hoga",
  "version": 2,
  "weekStart": ""
}

@Pokom
Copy link

Pokom commented Jan 14, 2025

I'm executing Grizzly from its latest Docker image and the result of execute: "grr --version" is:

Ah interesting, I didn't realize you were running from a container. I've been able to reproduce the issue locally when running grr within a container. Thanks for sharing the dashboard.

Let me step through the code to detect changes to the filesystem and see if anything obvious sticks out. @K-Phoen have you seen this behavior before?

@rsotolongo
Copy link
Author

I don't copy dashboard files to the container, instead, I mount the volume "/root/resources" from my host computer (Windows 11). As you can see from original bug description, when the files are modified, they can be seen from the container ("cat /root/resources/test.json") but Grizzly don't detect them.

@malcolmholmes
Copy link
Collaborator

I wouldn't expect -w to work within a container. As far as I understand, inotify doesn't work across the container/host boundary, so there's no way for Grizzly to register a meaningful watch on a file. It'd need to poll instead, which would (potentially) be much more expensive (if there's a lot of files).

@rsotolongo
Copy link
Author

@malcolmholmes Thank you. Any suggestion to achieve the original intention? I mean, running Grizzly from a container and refreshing updates where dashboard files are modified in the host computer? I don't mind pressing F5 to refresh browser as long changes are reflected.

@zabojpetr
Copy link

Hi, I have the same problem.

The problem with inotify is in WSL2 microsoft/WSL#4739

But I found some workarounds:

  1. develop in WSL filesystem (you can use for example VS Code with remote development addon)
  2. use some file sync and sync it to WSL filesystem (the distros are in network \\wsl$, so you can add WSL filesystem as network disk \\wsl$\Ubuntu - you use the distro name)
  3. use docker reloader https://github.com/apogiatzis/docker-compose-livereloader, but it takes about 30s find out the change, so really slow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants