Stackdriver query on past data

26 views
Skip to first unread message

Chavya Khanna

unread,
Jun 30, 2022, 3:17:22 PM6/30/22
to Google Stackdriver Discussion Forum
Hello Everyone,

Was hoping if someone could assist - is there a way we could execute a query but on past data like 5 mins old or 10 mins Old data only instead of current time range?

Please let me know you need further clarification on this ask.

Kyle Benson

unread,
Jun 30, 2022, 3:44:25 PM6/30/22
to Chavya Khanna, Google Stackdriver Discussion Forum
Hi Chayva, 

Can you clarify what data you're interested in? 
If you referring to log data, you can add time ranges to your log queries:

If  you mean metric data, there's also an option to use the custom time frame window if you're looking to set a specific window for your dashboards:

Additionally, this may or may not be relevant to your request, but if you're looking to compare prior data to current data in monitoring, there is a 'Compare to Past' option available:

If you can clarify a little bit more on your use case or the data you're exploring, I'm happy to elaborate or provide additional resources.

Thanks,
Kyle


--
© 2021 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/4275fcbf-464c-421c-b08c-dbc825a3d4fen%40googlegroups.com.


--

Kyle Benson  he / him / his
Product Manager, Cloud Ops
kylea...@google.com
650-713-1958


Chavya Khanna

unread,
Jun 30, 2022, 4:23:29 PM6/30/22
to Google Stackdriver Discussion Forum
Thanks Kyle,

Apologies i should've clarified my ask  - I am looking for implementing this within MQL Query - I'll post an example of Current query

{
fetch cloud_function
| group_by[metric.store_number,id:metric.sent_uuid]
;
fetch cloud_function
| group_by[metric.store_number,id:metric.fetch_uuid]
}
| every 5m
| group_by[metric.store_number,id]
| outer_join -1


Now the problem here is since i've defined it to run every 5 m,  This query will run every 5 m but On the current data - What i am looking for it something like "relative_time(now, -5m) "  function which would give me capability of executing the same query but on data which is 5 minutes old instead of executing on current data.

Hope this helps

Regards,

Igor Peshansky

unread,
Jun 30, 2022, 4:29:07 PM6/30/22
to Chavya Khanna, Google Stackdriver Discussion Forum
Hi, Chavya,

You may be looking for the time_shift operation. Here are some examples of real-world use.
        Igor

Chavya Khanna

unread,
Jul 1, 2022, 10:28:15 PM7/1/22
to Google Stackdriver Discussion Forum
  Thanks Igor,

So i did try using "time_shift" operation but  yet it still seem to process Data on real time instead of on the records which were in the past - What I am trying to achieve is only the state of a Transaction but what I am getting is its different states due to Time series being involved.

Basically the use case I am trying to achieve is to capture the state of a particular ID - if its in sent state or not.  using the query below and that's why I am trying to make my query process on old records - as checking old logs only I'll be able to get confirmed state of the ID - 

Query below is expected to return -1 Only if there's a mismatch between 1st and 2nd metric - and as you can see there are a few times where it shows:

Any suggestions how I can achieve just the state and not different states of it?

{
fetch cloud_function
| group_by[metric.store_number,id:metric.fetch_uuid]
;
fetch cloud_function
| group_by[metric.store_number,id:metric.sent_uuid]
}
| group_by[metric.store_number,id]
| time_shift 15m
| outer_join -1


Time_shift use.png
Reply all
Reply to author
Forward
0 new messages