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

Apply many files #63

Closed
wants to merge 1 commit into from
Closed

Apply many files #63

wants to merge 1 commit into from

Conversation

gutorc92
Copy link

@gutorc92 gutorc92 commented Nov 17, 2020

Signed-off-by: Gustavo Coelho gutorc@hotmail.com

Solves #64

Signed-off-by: Gustavo Coelho <gutorc@hotmail.com>
@malcolmholmes
Copy link
Collaborator

My suggestion here would be to just use jsonnet functionality to achieve this: you can create a single jsonnet file and have it import and merge the other ones.

@mavimo
Copy link
Contributor

mavimo commented Feb 14, 2021

@malcolmholmes I agree with the @gutorc92 approach, having a "root doc" can make the generation complex (instead of building each single group of items need to process all items in a single one), another option should be to have a single arg that can be a glob (eg dashboards/*.jsonnetlib or mytools/**/grafana.jsonnetlib), WDYT?

@malcolmholmes
Copy link
Collaborator

@mavimo why does a "root doc" make things more complex? I'm curious to hear that.

I certainly agree that glob based targeting is a must. I don't recall having done it.

@mavimo
Copy link
Contributor

mavimo commented Feb 14, 2021

@malcolmholmes a "complexity" can be the fact that need to include and reference every single new file in the "root document". In my use-case I have a folder (let's call it dashboards that can include dozens of dashboards) at the moment we are going to loop into every file and invoke grr to publish the dashboard, having a wildcard can make it easy.
If we want to include them in a single "root file" every time a new dashboard is created (or removed) we need to remember to edit also the root file. The root file is not "complex" di-per-se but add cognitive complexity to developers that work on it.

Another topic that (I'm not too much sure) is that the generation can be slower and consume much more memory if need to process a lot of dashboard every time (we expect to reach hundred of dashboards in short time), actually we are planning to do some "check" to publish only changed dashboard in CI (using some sort of git diff to detect changes) once we are going to merge all the dashboard in the "root file" we need to have a more complex algo to detect if a dashboard is changed (eg because is changes something in the root doc that impact the specific dashboard also if the dashboard is not changed..

Maybe my use-case is too specific to be a "real issues" 😄

@malcolmholmes
Copy link
Collaborator

This is a use-case I have been thinking about. Increasingly it is becoming clear to me that Grizzly has as much of a role outside of jsonnet, just dealing with raw JSON files. I haven't really thought through how we would cover the various scenarios. What you are suggesting is an interesting idea: a directory tree full of files, Grizzly can somehow identify the type of the file, then push it to its destination. Note JSON could be a datasource or a dashboard, YAML could be prometheus rules, etc.

Once we have this, for Grafana, there's an interesting possibility:

Grizzly will, via the file system, know the mapping between files and dashboard UIDs, be known. Thus, when a user uses grr listen, it will be possible to listen on all dashboards, and write them back to source files when a user saves. The thing I hadn't worked out was how dashboard files map to UIDs, and this solves that.

It is also a relatively significant diversion from the Tanka/Jsonnet pattern, so we need to make sure that we support both patterns, somehow.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@theSuess theSuess changed the base branch from master-legacy to main December 29, 2023 12:58
@theSuess theSuess requested a review from a team as a code owner December 29, 2023 12:58
@julienduchesne julienduchesne removed the request for review from a team January 11, 2024 01:46
@malcolmholmes
Copy link
Collaborator

This can now be done by pointing Grizzly at a directory instead of a file.

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.

None yet

4 participants