Skip to content

feat(grafana): support http dashboard URLs#1395

Closed
fjl wants to merge 3 commits into
ethpandaops:mainfrom
fjl:grafana-dashboards-download
Closed

feat(grafana): support http dashboard URLs#1395
fjl wants to merge 3 commits into
ethpandaops:mainfrom
fjl:grafana-dashboards-download

Conversation

@fjl
Copy link
Copy Markdown

@fjl fjl commented May 15, 2026

Makes it so I can do this

grafana_params:
  additional_dashboards:
    - "https://gist.githubusercontent.com/fjl/xxx/raw/xxx/dashboard.json"

@fjl fjl changed the title grafana: support http dashboard URLs feat(grafana): support http dashboard URLs May 15, 2026
Comment thread src/grafana/grafana_launcher.star Outdated
@cskiraly
Copy link
Copy Markdown
Contributor

Nice feature, I missed it

Comment thread src/grafana/grafana_launcher.star Outdated
Comment on lines +215 to +224
result = plan.run_python(
description = "Downloading Grafana dashboard: {0}".format(url),
run = """
import sys, urllib.request, os
os.makedirs("/dashboards-dl", exist_ok=True)
urllib.request.urlretrieve(sys.argv[1], "/dashboards-dl/" + sys.argv[2])
""",
args = [url, name],
store = [StoreSpec(src = "/dashboards-dl/", name = name)],
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit / suggestion: this repo already has the curl-via-run_sh + StoreSpec pattern for fetching remote files (see src/network_launcher/ephemery.star, shadowfork.star, public_network.star). Using it here drops the embedded Python and matches the rest of the codebase.

Locally tested with a raw.githubusercontent.com URL — artifact lands in grafana's /dashboards/ correctly.

Suggested change
result = plan.run_python(
description = "Downloading Grafana dashboard: {0}".format(url),
run = """
import sys, urllib.request, os
os.makedirs("/dashboards-dl", exist_ok=True)
urllib.request.urlretrieve(sys.argv[1], "/dashboards-dl/" + sys.argv[2])
""",
args = [url, name],
store = [StoreSpec(src = "/dashboards-dl/", name = name)],
)
result = plan.run_sh(
description = "Downloading Grafana dashboard: {0}".format(url),
run = "mkdir -p /dashboards-dl && curl -fsSL -o /dashboards-dl/{0} {1}".format(name, url),
store = [StoreSpec(src = "/dashboards-dl/", name = name)],
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works with curl, but then the URL would have to be shell-quoted somehow. So that's why I chose run_python, it doesn't have any issues with quoting.

As of Kurtosis 1.18.3, plan.upload_files accepts arbitrary http(s)
URLs natively, so the custom run_python downloader is no longer
needed. Reverting to a single upload_files call that handles both
local paths and URLs.
@barnabasbusa
Copy link
Copy Markdown
Collaborator

Closing this — turns out we don't need any code changes here. As of Kurtosis 1.18.3, plan.upload_files accepts arbitrary http(s):// URLs natively, so the existing call on main:

plan.upload_files(dashboard_src, name="additional-grafana-dashboard-{0}".format(index))

…already handles both local paths and URLs without any special-casing or run_python downloader.

Validated end-to-end with:

grafana_params:
  additional_dashboards:
    - "https://raw.githubusercontent.com/rfmoz/grafana-dashboards/master/prometheus/node-exporter-full.json"

→ artifact additional-grafana-dashboard-0 is created and the "Node Exporter Full" dashboard shows up in Grafana.

Thanks @fjl for surfacing the use case — your grafana_params.additional_dashboards: ["https://gist.../dashboard.json"] config works on main today, just bump your Kurtosis to ≥1.18.3.

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.

3 participants