Using filter(x) in a Query

Use filter(x) to remove values from the metric streams in the returned data, where the metric streams are defined by the previous query components.

Example: Remove Values Less than 20

For query troubleshooting, see Troubleshooting Queries.

  • This section describes how to use filter(x) on the Metrics Explorer page. filter(x) is available in Advanced mode (MQL) only. For alarm query edits, see Creating an Alarm.

    1. Create a basic query on the Metrics Explorer page.
    2. If necessary, open the query for editing: Click Edit queries.
    3. Click Advanced mode.
    4. Edit the text in Query code editor.

      The following example MQL expression includes only values greater than 20.


      The graph from Example Query and Metric Chart now shows only those values higher than 20. In addition to the 85% value at 1:30, there is a constant 21% value in another metric stream over the time displayed in the graph.

      Manipulated values in a graph.

    5. Click Update Chart.
  • Use the oci monitoring metric-data summarize-metrics-data command and required parameters to query metric data. Use the --query-text parameter to employ the filter(x) element (part of the MQL expression).

    oci monitoring metric-data summarize-metrics-data [...] --query-text <mql_expression> [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the Command Line Reference for Monitoring.

  • Run the SummarizeMetricsData operation to query metric data. Use the query attribute to employ the filter(x) element (part of the MQL expression).