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

feat: add generated jsonnet library #1770

Closed
wants to merge 2 commits into from
Closed

Conversation

Duologic
Copy link
Member

@Duologic Duologic commented Jan 8, 2024

Fixes grafana/grafonnet#149

In the Grafonnet community some folks asked for support on the Zabbix plugin. I'm taking the liberty to propose adding this to the repo but feel free to point me in another direction.

This PR generates a library from the Typescript type ZabbixMetricsQuery, I'm boldly assuming that this is the type representing the JSON that is visible in the Dashboard JSON. Note that anything in jsonnet/zabbix-query-libsonnet/ is generated by the Makefile targets.

@Duologic Duologic force-pushed the duologic/jsonnet-lib branch from 5b63ef6 to 60f151d Compare January 8, 2024 13:06
@Duologic Duologic marked this pull request as ready for review January 8, 2024 13:09
@Duologic Duologic requested a review from a team as a code owner January 8, 2024 13:09
@Duologic Duologic requested review from gabor and zoltanbedi January 8, 2024 13:09
@yesoreyeram
Copy link
Collaborator

@Duologic - Can you help me understand how/when to make this sync with actual types? I also wonder how we do this jsonnet thing for other plugins (core, enterprise and other community plugins)?

@Duologic
Copy link
Member Author

That's a good question. This initial PR simply syncs the schema with the types on the same branch, I'd suggest we match the schema sync that way along with the versions so it aligns with the release cadence.

For core plugins, this is currently happening through grafana/grok (using the CUE schemas) but we're looking in getting such JSON Schemas directly in the grafana/grafana repo from Typescript.

For other plugins, they could follow a similar path as this plugin, I'd say that this PR could serve as a pilot to generate jsonnet libraries near the plugin itself. The code in the generator/main.libsonnet is specific to this plugin but the pattern should be repeatable in other plugins.

At this point I'd suggest doing this for other plugins on a per-request basis as we don't want to introduce unnecessary work and code to maintain.

@Duologic
Copy link
Member Author

Duologic commented Feb 7, 2024

Would y'all be less opposed to only having to generate and maintain the JSON schema? Then we can move the library itself into Grafonnet while keeping up with the releases of this plugin.

@yesoreyeram
Copy link
Collaborator

Hi @Duologic - sorry for the delay. It slipped through. I will check this with team internally and get back to you.

@yesoreyeram
Copy link
Collaborator

BTW, I am in favour of having only the generated files inside this repo and an option to generate the files ourselves. ( By keeping the generator outside )

@Duologic
Copy link
Member Author

The actual generator is not in here, that's the CRDsonnet package, the generator directory here holds the specific code for generating this library.

@Duologic
Copy link
Member Author

I've put this into a separate repo: https://github.com/grafana/grafana-zabbix-libsonnet/

@Duologic Duologic closed this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Support Zabbix
2 participants