From beeef8b96bde6864e9d55e4c2c355a09836c8fab Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Wed, 14 Jul 2021 18:47:21 +0200 Subject: [PATCH] Update queries.md (#31941) (#36765) * Update queries.md Completing some examples to allow newbie people to understand relative time and time shift time * Update docs/sources/panels/queries.md Co-authored-by: Geshi Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> Co-authored-by: Geshi (cherry picked from commit e8d5b2431e176cb53cab66ae98fbcfbc278be132) Co-authored-by: castillo92 <37965565+castillo92@users.noreply.github.com> --- docs/sources/panels/queries.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/sources/panels/queries.md b/docs/sources/panels/queries.md index 94d65a1d35a..aee580ba3f9 100644 --- a/docs/sources/panels/queries.md +++ b/docs/sources/panels/queries.md @@ -101,6 +101,32 @@ Panel data source query options: - **Cache timeout -** (This field is only visible if available in your data source.) If your time series store has a query cache, then this option can override the default cache timeout. Specified as a numeric value in seconds. +### Examples: + +- **Relative time:** + +| Example | Relative time field | +| ------------------- | --------------------| +| Last 5 minutes | `now-5m` | +| The day so far | `now/d` | +| Last 5 days | `now-5d/d` | +| This week so far | `now/w` | +| Last 2 years | `now-2y/y` | + + +- **Time shift:** + +| Example | Time shift field | +| ------------------- | --------------------| +| Last entire week | `1w/w` | +| Two entire weeks ago | `2w/w` | +| Last entire month | `1M/M` | +| This entire year | `1d/y` | +| Last entire year | `1y/y` | + + + + ### Query inspector button You can click **Query inspector** to open the Query tab of the panel inspector where you can see the query request sent by the panel and the response. @@ -129,4 +155,4 @@ You can: If your data source supports them, then Grafana displays the **Expression** button and shows any existing expressions in the query editor list. -For more information about expressions, refer to [Expressions]({{< relref "expressions.md" >}}). \ No newline at end of file +For more information about expressions, refer to [Expressions]({{< relref "expressions.md" >}}).