Use the Metric Dimension Filter

You can use the Metric dimension filter to specify an Oracle Cloud Infrastructure Monitoring service metric input to a widget.

The Metric dimension filter can be used to filter metric data by dimension values. A common scenario for the use of this filter would be to add it as an additional input parameter to supply different dimension values to a query-based widget, and reuse the widget.

Here's an example in which the Metric dimension filter is added as an additional input to a query-based Database Management widget that uses metrics. For the purpose of this example, the oracle_oci_database namespace, the CpuUtilization metric, and the resourceName dimension are being used. Note that this example does not detail all the fields and options available in the query-based widget builder. For more information, see Create a Query-based Widget Using Metrics.

  1. Go to the Dashboards page.
  2. Click Create dashboard to create a new dashboard or open an existing dashboard in edit mode.
  3. On the Filters tab, enter Metric dimension in the search field and click the Metric dimension filter to add it to the dashboard.

    While adding the filter, specify the following details in the Configure <name> input for Metric dimension (required) dialog boxes:

    1. Namespace: Select oracle_oci_database.
    2. Metric name: Select CpuUtilization.
    3. Dimension name: Select resourceName.
    Note

    The Metric dimension filter also requires the compartment input to determine which compartment the metric resides in, however, the compartment input is automatically configured to use the Compartment filter. You can make changes to the automatically configured input, if required.
  4. From the Metric dimension filter drop-down list in the dashboard, select a database resource in the compartment.
  5. On the Widgets tab, click the Add widget group and widgets icon (Add widget group and widgets) and click Create query-based widget....
    The query-based widget builder is displayed.
  6. Click the Open/close filter panel icon (Open/close filter panel) to confirm that the Metric dimension and Compartment filters are added.
  7. Select Monitoring in the Data source field.
  8. Specify the following Monitoring service metric details:
    1. Namespace: Select the namespace you selected in the Metric dimension filter, oracle_oci_database.
    2. Query: Edit the default query displayed in this field or enter a brand new query to retrieve the CpuUtilization metric information.
    3. Click Run.
  9. Perform the following steps to add an additional input parameter and link it to the Metric dimension filter:
    1. On the Settings tab, click Add input +.
    2. In the Configure input for untitled widget (optional) dialog box:
      1. Input name: Enter a name for the input parameter, for example, resourceName. Note that the input name is required when adding a placeholder expression to the query.
      2. Input label: Enter a display name for the input. The input name is displayed in this field by default and you can change it to make it more user-friendly.
      3. Configure widget input: Select Link the input with an existing filter and link the input parameter to the Metric dimension filter.
  10. Edit the query and add a placeholder to display the data from the Metric dimension filter in the widget, using the following expression:
    {<dimension>=$(params.<input_name>)}

    For the purpose of this example, here's what the placeholder will look like in the query:

    CpuUtilization[auto]{resourceName=$(params.resourcename)}.mean()
  11. On the About tab, enter a name for the widget, select the compartment in which you want the widget to reside, and add a description for the widget.
  12. On the Visualization tab, select a chart type and customize the visualization by specifying or modifying additional options.
  13. Click Save to save the widget in the widget library and add it to the dashboard.
Once the query-based widget is added to the dashboard and the widget library, you can change the dimension value for the resourceName dimension in the Metric dimension filter to view the CpuUtilization metric for different database resources.