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

Tenant selection via Grafana variables #158

Open
Loori-R opened this issue Dec 12, 2024 · 2 comments
Open

Tenant selection via Grafana variables #158

Loori-R opened this issue Dec 12, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Loori-R
Copy link
Contributor

Loori-R commented Dec 12, 2024

Description:
Add the ability to use Grafana variables for tenant selection in the VictoriaLogs Datasource. Users can create a Grafana variable to dynamically populate the AccountID and ProjectID in the header for requests, as described in the VictoriaLogs Multitenancy Documentation, making it easier to work with multiple tenants.

Key Features:

  • Use the endpoint introduced in PR #7484 to fetch a list of available tenants.
  • Populate Grafana variables with tenant options for dropdown selection.
  • Automatically apply the selected tenant ID to all relevant queries.

Example:
Screenshot showing how the variable setup might look when creating a variable:

@Loori-R Loori-R added the enhancement New feature or request label Dec 12, 2024
@tenmozes
Copy link
Contributor

nice one, thanks, we need similar to cluster version of victoriametrics + all filter

@hagen1778
Copy link
Contributor

hagen1778 commented Dec 18, 2024

Hello @Loori-R @tenmozes !

This feature could be a security concern for Grafana administrators.
There should be way for letting or restricting users from selecting tenants:

  1. Ability to use or not use Tenants (let's call it allow-tenants-var) variable should be configured in Grafana datasource setting (Connection), which can be edited only by Grafana admins.
  2. There should be way to select default tenant in datasource settings. If it was selected and allow-tenants-var is disabled, then users of the datasource shouldn't be able fetch data from tenants other than default.
  3. [optional] if allow-tenants-var is enabled, it should support regex selector to pre-filter tenants that are allowed to use or to allow manually set list of tenants. So when variable is used in the dashboard, user can select only from curated or pre-filtered list.
  4. Variable in dashboard should support regex matching, but it can't have Multi or All option. Unless plugin can merge results from multiple tenants.
  5. Variable value should be passed to backend with some unique type, so it can identify that this is a Tenant selector.
  6. Backend should always respect and re-check allow-tenants-var and list of allowed tenants to avoid cases when arbitrary tenant ID was just passed via GET param.
  7. Changing datasource in dashboard should automatically update Tenants variable: disable it or populate with allowed tenants.
  8. Exporting&importing dashboard with a new datasource shouldn't allow sending requests to tenants that weren't allowed in this datasource.

Unless all points can be satisfied, I'd recommend to not add this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants