Giter Club home page Giter Club logo

Comments (6)

safaci2000 avatar safaci2000 commented on August 24, 2024

There was a previous conversation about this. I found the code needed to ensure the IDs are preserved to be a bit too convoluted, though that can be somewhat iterated on. The biggest issue I found is that even IF you maintain the ID, then you still end up with a git delta of a version change. I would argue that your changes should be maintained in git, not grafana. You should choose what your source of truth is, grafana or git, and treat that as the primary way of versioning dashboards.

Doing an upload and redownload seem to be generate SOME delta, so making the code more complicated to preserve the sanctity of the git diff I don't think is worth it.

Preserving a dashboard history, I could see being worth while, though I'll have to look at the code again to see what's needed. Either ways though you'll always end up with a delta between upload/download. If there's a pattern that doesn't I'd be curious to know what that is.

from gdg.

fingon avatar fingon commented on August 24, 2024

Thanks for the earlier info, I missed it when quickly browsing for pre-existing issues.

Even for dashes in git only case, the current functionality doesn't work well as e.g. favourites are tracked by id, and due to that if you re-upload dashboards users lose their favourites (and id-based links).

I don't unfortunately have anymore access to the original code I wrote for $PREVJOB, but I think there was API call which just set overwrite flag on and supplied id+uuid and it mostly worked for us.

To make the no-change detection work with git, you want to normalize the dashboards (e.g. export only always in same way and ignore version changes). That can be done elsewhere, though, given the upload otherwise retains the data but with id changes Grafana behaviour changes and you cannot really work around that.

from gdg.

safaci2000 avatar safaci2000 commented on August 24, 2024

So, I can take another pass like I said, and per usual PRs are accepted, but as far as having a 0 diff as a goal; it's not the purpose of GDG. GDG is a tool that lets you manage entities (dashboards, libraryelements, connections) and allows you to have a consistent behavior between one instance of grafana and another.

The idea of having no delta in git is a nice to have but it's not really a strong motivation. Now, if there is a way of doing this easily and cleanly that doesn't make the code less maintainable or more complex that's fine. Doing things like ignoring the version number is not something I'd really put into GDG. The only way I can see doing that is disregarding the version number and having a static value. I'm not even sure what would happen if you upload version 1 when there's been 7 versions updated.

As far as Implementation goes, it's a lot easier to wipe everything and push what you have in your file system. After all the idea is that whatever is your backup storage should be what is in grafana. If anything else is in grafana in the watched folder it's supposed to be removed, and replaced with the data in git.

I don't mind adding complexity, we've done that before, but it should get us a net gain of some kind. your grafana history should ideally useless since git log <file.json> gives you all the changes that went with that dashboard, and the git diff being empty will not happen without some hacks.

from gdg.

fingon avatar fingon commented on August 24, 2024

Delta in git is not even the problem. It is the other user visible aspect ( when dash is deleted. It is removed from favorites ) which the upload step does even if it is really overwriting existing dashboard.

Anyway, as this is not that high priority problem for me either, we shall see if I get around to making PR for this.

from gdg.

safaci2000 avatar safaci2000 commented on August 24, 2024

Interesting, okay that's a legitimate issue. I never noticed that behavior. Let me think about it a bit and revisit this.

from gdg.

safaci2000 avatar safaci2000 commented on August 24, 2024

I'm not able to get the import endpoint to support this. Right now the options are to use /import or /dashboard/db. I'm sure /dashboard/db would work, but it drops support for libraryelements. /import currently isn't working for me.

I may revisit this later, and leave it open and as I said, I'll consider a PR.

from gdg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.