-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow multiple data sources, of different types. Still enforce best-practice naming. #124
Conversation
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.
Looks good as far as I can tell. Didn't take the full time to read through the supporting code to fully understand the effects of the changes, so just commenting rather than approving 😄 . Will be nice to get rid of some of the linter exceptions for sure.
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.
This looks pretty good! I think that we'll run into quite a few misnames of Prometheus Data Source && Loki Data Source once this gets incorporated.
i.e. a lot of mixing and matching Loki Datasource && Data Source from a quick scan.
Was just curious is the Data Source
supposed to be capitalized or is it supposed to be sentence case in the UI element if we are following this guideline?
https://grafana.com/docs/writers-toolkit/style-guide/ux-writing/#use-sentence-case-in-ui-elements
I'll defer to you but I was just curious for my own sake of knowledge :)
Ahh, good point, it may be properly I'll check with our docs/standards team to be sure. Thanks for the heads-up, and for giving it a look! |
…ty. Update job and instance rules for sentence case.
In the most recent commit, I actually make a couple of changes which should promote backward compatibility, and ease the move forward. For one, since the formatting of the labels for data sources have changed, this is downgraded to a warning. In a future version (we don't have a canonical version for the linter yet, but maybe at 1.0?), we can change this back to an error. Also, title casing for Job and Instance are actually correct on the label, so the rule enforces that now. However, for those who were using the dashboard-linter previously, and may have labeled all of their job and instance templates in lower case, the rule is now a Warning when it's violated, which should allow an easier transition. This probably also warrants a changelog of sorts for the dashboard-linter, so that these sorts of changes/compromises can be documented. |
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.
Well thought out! LGTM
This adds the flexibility in data source naming which is discussed in #14.
Specifically, if a dashboard has only one data source, it may have the name/uid
datasource
or<type>_datasource
, and it may have the label "Data Source" or "<Title(type)> Data Source".This also ensures that when more than one data source is present on the dashboard, the more specific name is no longer optional, but required.
Also, this tweaks the
template-job-rule
andtemplate-instance-rule
to allow for either form of the prometheus data source UID/name.Finally, this tweaks the
panel-datasource-rule
to allow the use of any data source which is actually defined on the dashboard, rather than only checking for$datasource
and${datasource}
.Resolves #14 and supersedes #101 and #40