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

Add tag with charm name to dashboard #256

Merged
merged 6 commits into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/charms/grafana_agent/v0/cos_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class _MetricsEndpointDict(TypedDict):

LIBID = "dc15fa84cef84ce58155fb84f6c6213a"
LIBAPI = 0
LIBPATCH = 19
LIBPATCH = 20

PYDEPS = ["cosl >= 0.0.50", "pydantic"]

Expand Down Expand Up @@ -758,6 +758,13 @@ def _dashboards(self) -> List[str]:
# because there is currently no other way to communicate the dashboard path separately.
# https://github.com/canonical/grafana-k8s-operator/pull/363
dashboard["uid"] = DashboardPath40UID.generate(self._charm.meta.name, rel_path)

# Add tags
tags: List[str] = dashboard.get("tags", [])
if not any(tag.startswith("charm: ") for tag in tags):
tags.append(f"charm: {self._charm.meta.name}")
dashboard["tags"] = tags
sed-i marked this conversation as resolved.
Show resolved Hide resolved

dashboards.append(LZMABase64.compress(json.dumps(dashboard)))
return dashboards

Expand Down
Loading