-
Notifications
You must be signed in to change notification settings - Fork 251
Grafana dashboard generator tool #7123
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
base: main
Are you sure you want to change the base?
Conversation
|
This tool generates JSON files, which devs can then upload to the Grafana import page. Here's examples from the current config:
There's a bunch of code here and probably lots of opportunities to improve it. I guess the main question is if this is leading us down a path we'll regret in the future. For example are devs going to want to hand-customize their dashboards, which will then be lost if they re-generate and re-import the JSON. This doesn't handle alerting. AFAICT, that needs to be set up manually. |
2d7b144 to
bc49e7b
Compare
skhamis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool! This is an amazing start and I know it's proto-typy so i didn't want to block super hard on anything but just a few comments/concerns. However majority of this patch looks great, Nice job!!
| .select | ||
| .extend([format!("q[OFFSET({quantile_index})] as amount")]); | ||
| } | ||
| Some(amount) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there scenarios where amount could be 0 here? Is there a way to avoid a divide-by-0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value_divisor comes from the team_config.rs file directly, so as long as devs don't put in a 0 we should be okay there.
| hide: VariableHide::Variable, | ||
| datasource: Datasource::bigquery(), | ||
| query: QueryVariableQuery::from_sql( | ||
| r#"SELECT IF(STRPOS('${Filters}', '=') <> 0, REPLACE(REPLACE('${Filters}', '",', '" AND '), '\n', '\\n'), 'true')"#, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i'm understanding correctly this might make some of the queries vulnerable here where it's used in {filter_sql} directly into the SQL statement (injection)? Idk how Grafana handles some of these but maybe more of a warning or something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was fairly scary to me too, but I convinced myself that it was okay. If the user is on a dashboard, then they should have already authorized themselves as a Mozilla employee. Also, you can always create your own dashboard and run whatever query you want. The best attack vector I could see would be some of phishing attack where an outside person sent a Mozilla employee a link to one of our dashboards, but that doesn't seem very likely. Still, I do really hate the way this works and wish there could have been a cleaner way.
I'll add a comment about this, maybe we could figure out something better in the future.
Initial commit for the `generate-rust-dashboards` tool. This auto-generates Grafana dashboards for teams that own Rust Components. There's still a lot of work to do, but this feels like a good start.
bc49e7b to
18231e1
Compare
|
Thanks! I fixed the bugs you pointed out and added some comments for that filter query. If you don't feel good about including that, we could just remove it and find a different way to filter the records. |
Initial commit for the
generate-rust-dashboardstool. This auto-generates Grafana dashboards for teams that own Rust Components. There's still a lot of work to do, but this feels like a good start.Pull Request checklist
[ci full]to the PR title.