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

Feature request: Query database systems #273

Open
Maros112358 opened this issue May 13, 2024 · 4 comments
Open

Feature request: Query database systems #273

Maros112358 opened this issue May 13, 2024 · 4 comments

Comments

@Maros112358
Copy link

Hello,
we are using the OCI Grafana Plugin to visualize metrics for databases and pluggable databases in Grafana. We would like to template our dashboards with variables for databases and database systems so that we can then filter using those variables as dimensions. However, I do not see how to query database systems and databases when creating template variables in Templating Docs.

When creating dashboard query variable using OCI Grafana Plugin, I would expect the Query for database systems variable db_system to be something like:

database_systems($region,$tenancy)

For database variable database:

databases($region,$tenancy)

Then I could reference these variable in the in the raw query like:

CpuUtilization[1m]{resourceType="PDB", instanceName="$database", hostName="$database_system"}.mean()

As a workaround, I was thinking about using resourceId somehow to be more reusable, but I don't see how to query it using Templating Docs. Referencing database systems and databases directly seems more elegant.

@mamorett
Copy link
Member

mamorett commented May 13, 2024

Hi. I think instanceName and hostName are dimensions of the database metrics, and not namespaces. You propose a template variable setting which can be done for a namespace (like oci_compute, oci_lbaas, etc) but cannot be done for a dimension. You may want to try to set a dimension template variable where you can choose a specific instanceName for your database metric.

@Maros112358
Copy link
Author

Hello, thank you for quick response.
Yes, instanceName and hostName are dimensions of the database metrics. I need to filter according to these dimensions, where the value is a given by a query variable from the plugin. The value of the query variable depends on currently selected compartment.

If I understood your answer correctly, this is not possible right now. Correct?

@mamorett
Copy link
Member

Hi. It should be possible, but you need to use a template var for the dimension accordingly. Please refer to the Dimension Template variable in the Using document: https://github.com/oracle/oci-grafana-metrics/blob/master/docs/using.md

@Maros112358
Copy link
Author

Maros112358 commented May 22, 2024

Hello @mamorett, thank you for your advice. I tried template variable for dimension and it is what I needed. However, I have one question. If I choose multi-value selection option for my dimension variable and select at least 2 options, the grafana dashboard breaks. I inspected the query and it looks like this:

CpuUtilization[1m]{{deploymentType=\"vm\",resourceName_dbnode=\"my_node\"}}.avg()"

For comparison, this is query only with only one value selected:

CpuUtilization[1m]{resourceName_dbnode=\"my_node\"}.avg()

This is the query when I use two separate dimension variables in a dashboard:

CpuUtilization[1m]{deploymentType=\"vm\",resourceName_dbnode=\"my_node\"}.avg()

Is this a bug or do I need to create new dimension variable for each dimension I want to filter?

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

No branches or pull requests

2 participants