Stay organized with collections
Save and categorize content based on your preferences.
Monitoring Query Language (MQL) provides an expressive, text-based interface to
Cloud Monitoring time-series data. By using MQL, you can
retrieve, filter, and manipulate time-series data.
Why use MQL?
With MQL, you can manipulate time series to create
charts that you can't create any other way. For example, you can do the
following:
Compute the ratio of requests resulting in a particular class of
response 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 from
time series of multiple metric types.
Create new labels to aggregate data by, using arbitrary string manipulations
including regular expression sub-field capture.
Control the time range and period of output data.
MQL uses a set of operations and functions. Operations are
linked together using the common pipe mechanism, where the output
of one operation becomes the input to the next. Linking operations
makes it possible to build up complex queries incrementally.
Additionally, the code editor provides syntactic help in the form
of error messages. For more information, see
Use the code editor for MQL.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Monitoring Query Language overview\n\n| **Announcement:** Starting on October 22, 2024, Monitoring Query Language (MQL) will no longer be a recommended query language for Cloud Monitoring. Certain usability features will be disabled, but you can still run MQL queries in Metrics Explorer, and dashboards and alerting policies that use MQL will continue to work. For more information, see the [deprecation notice for\n| MQL](/stackdriver/docs/deprecations/mql).\n\nMonitoring Query Language (MQL) provides an expressive, text-based interface to\nCloud Monitoring time-series data. By using MQL, you can\nretrieve, filter, and manipulate time-series data.\n\nWhy use MQL?\n------------\n\nWith MQL, you can manipulate time series to create\ncharts that you can't create any other way. For example, you can do the\nfollowing:\n\n- Compute the ratio of requests resulting in a particular class of response codes\n- Compute the ratio of current values to past values\n- Select by arbitrary, rather than predefined, percentile values\n- Select a random sample of time series\n- Evaluate arbitrary arithmetic expressions over values from time series of multiple metric types.\n- Create new labels to aggregate data by, using arbitrary string manipulations including regular expression sub-field capture.\n- Control the time range and period of output data.\n\nMQL uses a set of operations and functions. Operations are\nlinked together using the common pipe mechanism, where the output\nof one operation becomes the input to the next. Linking operations\nmakes it possible to build up complex queries incrementally.\n\nAdditionally, the code editor provides syntactic help in the form\nof error messages. For more information, see\n[Use the code editor for MQL](/monitoring/mql/query-editor).\n\nWhat's next?\n------------\n\nThe [Quickstart for Monitoring Query Language](/monitoring/mql/quickstart) guides you through creating\na simple MQL query by using the code editor.\n\nYou can create and submit MQL queries by using the code editor\nor the Monitoring API.\n\n- For information about the code editor, see [Use the code editor for MQL](/monitoring/mql/query-editor).\n- For information about using MQL queries with the Monitoring API, see [Using the API](/monitoring/mql/qn-from-api).\n\nYou can also create alerting policies with MQL; for more information,\nsee [Alerting policies with MQL](/monitoring/mql/alerts).\n\nFor a series of examples of MQL queries, see [Examples](/monitoring/mql/examples).\n\nFor some general information about MQL,\nsee [About the MQL language](/monitoring/mql/query-language).\n\nFor a comprehensive reference, see\n[The Monitoring Query Language reference](/monitoring/mql/reference)."]]