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 dashboard uid generation helper #114

Merged
merged 9 commits into from
Dec 20, 2024
Merged

Add dashboard uid generation helper #114

merged 9 commits into from
Dec 20, 2024

Conversation

sed-i
Copy link
Contributor

@sed-i sed-i commented Dec 17, 2024

Issue

  • Currently it is not possible to auto generate dashboard uid consistently without code duplication in GrafanaDashboardProvider and COSAgentProvider.
  • The "GrafanaDashboard" class has a confusing terminology: "serialize" and "deserialize" are inconsistent.

Solution

New function for rendering dashboard uid

In tandem with:

Extract LZMA base64 logic from GrafanaDashboard class

Also, deprecate the GrafanaDashboard class.

The new LZMABase64 class is consistent with the following view:

graph LR

dict -->|serialize| json-str
json-str -->|deserialize| dict

json-str -->|compress + base64 encode| compressed-str
compressed-str -->|base64 decode + decompress| json-str
Loading

Context

This change was prompted by an ADR for addressing dashboard UID collisions.

Testing Instructions

This is an ops-independent change. See unit tests.

Upgrade Notes

If dependent code is using grafana_dashboard.GrafanaDashboard, a deprecation warning will now be printed. Switch to using LZMABase64.

Copy link
Contributor

@MichaelThamm MichaelThamm left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@sed-i sed-i force-pushed the feature/dashboard_module branch from 7066173 to 57ca8f9 Compare December 20, 2024 19:56
@sed-i sed-i merged commit 4179bcb into main Dec 20, 2024
7 checks passed
@sed-i sed-i deleted the feature/dashboard_module branch December 20, 2024 20:39
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