Support relative time calculation expressions #1979
LiuTianyou
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
Good idea!👍 Now we deal the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Good idea |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, community
Backgroud
When we use SQL to query metrics, we can use expressions like
NOW() - INTERVAL 1 HOUR
to calculate the time one hour ago. However, when querying metrics through other protocols, such as using the HTTP protocol, it is not possible to pass relative time by defining request parameters.For example, in the OpenAI monitoring, the
/dashboard/billing/usage
endpoint requires two time parameters,startDate
andendDate
. Due to the inability to support dynamic time calculation expressions, we have to hardcode the logic in the code to add the corresponding parameters based on the URL.Suggestion: Add global time calculation expressions.
What problem does it solve:
For example:
@now
gets the current time formatted asyyyy-MM-dd HH:mm:ss
@date
gets the current date formatted asyyyy-MM-dd
@time
gets the current time formatted asHH:mm:ss
@timestamp
gets the current 13-digit timestamp@now-1d
gets the time at the same point yesterday@now-1m
gets the time one minute ago@now+2w
gets the time two weeks laterHow to use:
^_^expression^_^
, for example,^_^@now-1d^_^
Where can expressions be used:
^_^XXX^_^
placeholders are supported.Beta Was this translation helpful? Give feedback.
All reactions