Skip to content
Advertisement

Unable to collect data from metric query language MQL – GCP

I want to execute MQL (metric query language) using below library.

JavaScript

Here is my code snippet. which will create monitoring client and will try to collect data from GCP monitoring.

JavaScript

Above code is working fine but its not returning data of given startTime and endTime , It always returns latest datapoint available. is there any problem with my code ?

Advertisement

Answer

Found way to execute MQL query with given time range. The new working code is the following:

JavaScript

Included query start time and end time in query itself by using within operator. As per google docs for MQL queries:

within – Specifies the time range of the query output.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement