Sql Query receiver metrics ts_column not working #26081
-
Hi, I am trying to get metrics from the custom query, was able to get the metrics but unable to use ts_column as time stamp. i had to convert my timestamp in table to epoch, otherwise i get a data format exception when timestamp is passed.when i use the regular timestamp value value was "2023-06-07T00:00:00Z": strconv.ParseInt: parsing "2023-06-07T00:00:00Z": invalid syntax; row 47: failed to parse uint64 for "time" I am converting to epoch with sql query as shown in the config file. but still i don't see the metric with timestamp value from the table. Here's the config file sqlquery: here's the metric. i was expecting epoch value to be replaced with Timestamp. seems it's being appended Please help in resolving this issue Can you provide a sample example on how to pass timestamp metric from the query? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You are right. The value of
Note that you need to cast the return value from DATEDIFF to a BIGINT for the multiplication by 10^9 to work. |
Beta Was this translation helpful? Give feedback.
-
@astencel-sumo @devshashankb Any help is greatly appreciated!
|
Beta Was this translation helpful? Give feedback.
You are right. The value of
ts_column
is currently limited to only accepting a decimal number, and you are correct to convert the original value of thetime
column (I assume it is of DATETIME type?) withDATEDIFF(s,'1970-01-01 00:00:00',time)
. What is missing is that the value ofts_column
is interpreted as nanoseconds, and your expression returns seconds. The value must be multiplied by 10^9. Here's what has worked for me: