feat: add system
field to data source instances
#1161
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PR proposes to add a
System
field toDataSourceInstanceSettings
, which will be used by Grafana to indicate that the datasource instance should be hidden from view.This PR is a dependency of the functionality here:
system
field to data source instances and types grafana#97315Example uses of "system" data sources
1:n proxies
Sometimes plugin developers need the ability to proxy to multiple services of the same type. By creating multiple data sources, an app plugin can achieve this. The app plugin would need to take responsibility for creating and configuring their system data sources.
General persistence
An additional functionality that hidden datasource instances could provide, is in persist bits of JSON data. In certain environments (like Grafana cloud), the provisioning mechanism will completely rewrite the jsonData of provisioned plugins -- having a data source instantiated allows an app plugin to store some state that will not be automatically deleted in instance refresh.
The desire to make them invisible
Currently data sources can be used to provide the above uses. However, it might not be suitable to view these along with other data sources in typical Grafana views. If there is no need to access these "data sources" in a dashboard, or in the Explore view, adding this "system" flag, a developer can hide these data sources.