Monitoring Query Language overview Stay organized with collections Save and categorize content based on your preferences.
Monitoring Query Language (MQL) provides an expressive, text-based interface toCloud Monitoring time-series data. By using MQL, you canretrieve, filter, and manipulate time-series data.
Why use MQL?
With MQL, you can manipulate time series to createcharts that you can't create any other way. For example, you can do thefollowing:
- Compute the ratio of requests resulting in a particular class ofresponse codes
- Compute the ratio of current values to past values
- Select by arbitrary, rather than predefined, percentile values
- Select a random sample of time series
- Evaluate arbitrary arithmetic expressions over values fromtime series of multiple metric types.
- Create new labels to aggregate data by, using arbitrary string manipulationsincluding regular expression sub-field capture.
- Control the time range and period of output data.
MQL uses a set of operations and functions. Operations arelinked together using the common pipe mechanism, where the outputof one operation becomes the input to the next. Linking operationsmakes it possible to build up complex queries incrementally.
Additionally, the code editor provides syntactic help in the formof error messages. For more information, seeUse the code editor for MQL.
What's next?
You can create and submit MQL queries by using the code editoror the Monitoring API.
- For information about the code editor, seeUse the code editor for MQL.
- For information about using MQL queries with theMonitoring API, seeUsing the API.
You can also create alerting policies with MQL by using theMonitoring API. For more information,seeCreating conditions for alerting policies.
For a series of examples of MQL queries, seeExamples.
For some general information about MQL,seeAbout the MQL language.
For a comprehensive reference, seeThe Monitoring Query Language reference.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.