Manage variables
Prerequisites​
- This section assumes that your application is already instrumented. For details about how you can instrument your application, see the Instrument Your Application section.
- This section assumes that you are familiar with the basics of monitoring applications.
Variables​
Variables are now supported for the dashboard panel chart for all three query types. The widget plots can make use of these variables and update the charts dynamically without having to update the query for each value. When the value of the variable changes the refreshed dashboard will reflect the new value. Variables allow users to make interactive dashboards. Variables are most commonly used to avoid hard coding the values for host names, Kubernetes pods, namespaces, etc. Variables are independent for each dashboard. Variables are shown using the dropdowns at the top of the dashboard.
Variables types​
SigNoz supports three ways of creating variables: query, custom, and textbox.
- Query - A SQL query that can be used to fetch data from ClickHouse server SigNoz configured to use
- Custom - A comma-separated list values as a Variable
- Textbox - A free text input field with an optional default value
Add a Variable to a Dashboard​
To add a variable to a dashboard, follow the steps below:
- From the sidebar, choose Dashboards.
- Find the dashboard to which you want to add a new variable.
- Select Configure.
- Select New Variables from the Variables section tab.
- Populate the following fields:
- Name: Name of the variable. This is used in Metrics builder/ClickHouse query/ PromQL later
- Description: Enter a brief and meaningful description of your variable.
- Type: Select the variable type from the list of available choices and the UI changes accordingly.
- (Optional) Sort: Sort the values if applicable from the above variable type.
- (Optional) Enable multiple values to be checked: Make dropdown multi-select
- (Optional) Include an option for ALL values: Show the
ALL
option which includes all options from the multi-select dropdown
- When you’ve finished, select the Save button.
Examples​
The following shows some examples to create a variable with hypothetical scenarios
You want to query the list of host names from the metrics database and use them as a variable
- Some list of known endpoints as a variable
Free text as a variable
Using variables in queries​
The following shows some example widget plots using the variables created from the above section
Metric Builder
ClickHouse Query
PromQL
Get Help​
If you need help with the steps in this topic, please reach out to us on Slack.