The Grafana Dashboard below borks the Grafana operator:
Model Controller Cloud/Region Version SLA Timestamp
cos development microk8s/localhost 2.9.27 unsupported 17:07:56+01:00
App Version Status Scale Charm Channel Rev Address Exposed Message
alertmanager active 1 alertmanager-k8s edge 13 10.152.183.177 no
grafana waiting 1 grafana-k8s edge 31 10.152.183.43 no installing agent
loki active 1 loki-k8s edge 15 10.152.183.145 no
prometheus active 1 prometheus-k8s edge 24 10.152.183.70 no
spring-music active 1 spring-music 0 10.152.183.201 no
Unit Workload Agent Address Ports Message
alertmanager/0* active idle 10.1.151.86
grafana/0* error idle 10.1.151.87 hook failed: "grafana-dashboard-relation-changed"
loki/0* active idle 10.1.151.88
prometheus/0* active idle 10.1.151.89
spring-music/0* active idle 10.1.151.90
unit-grafana-0: 17:07:17 ERROR unit.grafana/0.juju-log grafana-dashboard:6: Uncaught exception while in charm code:
Traceback (most recent call last):
File "./src/charm.py", line 680, in <module>
main(GrafanaCharm, use_juju_for_storage=True)
File "/var/lib/juju/agents/unit-grafana-0/charm/venv/ops/main.py", line 431, in main
_emit_charm_event(charm, dispatcher.event_name)
File "/var/lib/juju/agents/unit-grafana-0/charm/venv/ops/main.py", line 142, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-grafana-0/charm/venv/ops/framework.py", line 283, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-grafana-0/charm/venv/ops/framework.py", line 743, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-grafana-0/charm/venv/ops/framework.py", line 790, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-grafana-0/charm/lib/charms/grafana_k8s/v0/grafana_dashboard.py", line 1029, in _on_grafana_dashboard_relation_changed
changes = self._render_dashboards_and_signal_changed(event.relation)
File "/var/lib/juju/agents/unit-grafana-0/charm/lib/charms/grafana_k8s/v0/grafana_dashboard.py", line 1127, in _render_dashboards_and_signal_changed
content = _encode_dashboard_content(_convert_dashboard_fields(content))
File "/var/lib/juju/agents/unit-grafana-0/charm/lib/charms/grafana_k8s/v0/grafana_dashboard.py", line 562, in _convert_dashboard_fields
dict_content = _replace_template_fields(dict_content, datasources, existing_templates)
File "/var/lib/juju/agents/unit-grafana-0/charm/lib/charms/grafana_k8s/v0/grafana_dashboard.py", line 596, in _replace_template_fields
ds = re.sub(r"(\$|\{|\})", "", panel["datasource"])
File "/usr/lib/python3.8/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
Additional context
I took the Spring Music dashboard from the Spring Music charm, replaces prometheusds with promds because I am devious.
Bug Description
The Grafana Dashboard below borks the Grafana operator:
To Reproduce
Add the following dashboard to the Spring Music charm, or provide it to Grafana via the COS Configuration charm:
Environment
A Juju controller next to you. Buh!
Relevant log output
Additional context
I took the Spring Music dashboard from the Spring Music charm, replaces
prometheusds
withpromds
because I am devious.