What is mql query




















They can use the language for use cases such as troubleshooting purposes, root cause analysis, reporting and analytics, and complex alert logic. Google built MQL using operations and functions. Using the 'pipe' idiom, operations are connected together, where one operation's output becomes the input to the next — and by linking, users can build up complex queries incrementally.

In the same way, users can compose and chain commands and data via pipes on the Linux command line — allowing them to fetch metrics and apply operations using MQL. Users can use MQL to:. Another recent feature is that a query can also be used as an alert policy by navigating to Alerting - a developer or operator can create an alert policy by clicking 'Add Condition' and again see the same query editor as in the Metrics Explorer.

For a threshold alert, for instance, a developer or operator can use the condition operation. Similarly, other public cloud providers, such as Microsoft, provide a query language called Kusto Query Language KQL for developers and operators. All these proprietary languages follow the 'pipe' idiom and use operations and functions.

MQL represents a decade of learnings and improvements on Google's internal metric query language. The same language that powers advanced querying for internal Google production users is now available to Google Cloud users as well.

Also, Richard Seroter , director of outbound product management at Google Cloud, said in a tweet :. So much of what we learn running 9 services with 1B users makes its way into GCP for you to take advantage of. Developers and operators can find more details on MQL in the Cloud Monitoring documentation pages and guidance through the quickstarts , samples , and reference guide.

Lightstep's observability platform is the easiest way for teams to monitor health and respond to changes in cloud-native applications.

Join a community of over , senior developers. View an example. The sum function computes the count of the requests that returned You can use the same query as above, but with a condition operator that provides the threshold for the alert:. In addition to ratios, another common use case for MQL is time shifting. This is particularly powerful when coupled with long-term retention of 24 months of custom and Prometheus metrics. To learn more about MQL, check out the documentation , quickstarts , examples queries , alerts , a language and function reference , and more.

Retention times for custom and Prometheus metrics in Cloud Monitoring has gone from six weeks to 24 months. Rory Petty. Free Trial. For instance, you can use MQL to: Create ratio-based charts and alerts Perform time-shift analysis compare metric data week over week, month over month, year over year, etc.

For a list of supported resources with links to their metric references, see Supported Services. You can also use the ListMetrics operation to find metrics sent by a particular service, such as the Compute service. This operation returns metric definitions.

The interval component of the query appears between the metric and statistic before the optional dimension name-value pair and grouping function. Supported values for interval depend on the specified time range in the metric query not applicable to alarm queries. More interval values are supported for smaller time ranges. For example, if you select one hour for the time range, then all interval values are supported.

If you select 90 days for the time range, then only the 1h or 1d interval values are supported. The Interval option in the Console Basic Mode supports the following range of values:. For metric queries, the interval you select drives the default resolution of the request, which determines the maximum time range of data returned. For more information about the resolution parameter as used in metric queries, see SummarizeMetricsData. The maximum time range returned for a metric query depends on the resolution.

By default, for metric queries, the resolution is the same as the query interval. The maximum time range is calculated using the current time, regardless of any specified end time. Following are the maximum time ranges returned for each interval selection available in the Console Basic mode. To specify an interval value that is not available in Basic Mode in the Console , such as 12 hours, switch to Advanced mode. To specify a non-default resolution that differs from the interval, use the SummarizeMetricsData operation.

Example 1: One-minute interval and resolution up to the current time, sent at on January 8th. No resolution or end time is specified, so the resolution defaults to the interval value of 1m , and the end time defaults to the current time T This request returns a maximum of 7 days of metric data points.

The earliest data point possible within this seven-day period would be on January 1st T Example 2: Five-minute interval with one-minute resolution up to two days ago, sent at on January 8th. Because the resolution drives the maximum time range, a maximum of 7 days of metric data points is returned. While the end time specified was on January 6th T Therefore, only 5 days of metric data points can be returned in this example.

For alarm queries, the specified interval has no effect on the resolution of the request. The only valid value of the resolution for an alarm query request is 1m.



0コメント

  • 1000 / 1000