Skip to content

Sql Query receiver metrics ts_column not working #26081

Discussion options

You must be logged in to vote

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 the time column (I assume it is of DATETIME type?) with DATEDIFF(s,'1970-01-01 00:00:00',time). What is missing is that the value of ts_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:

receivers:
  sqlquery:
    driver: sqlserver
      datasource: "sqlserver://SA:YourStrong@Passw0rd@localhost:1433?database=sqlquery"
        queries:
        - sql: "select count_test, 1000000000*CAST(DATEDIFF(s,'1970-01-01 00:00:00',time) as bigint) as epoch from tabl…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@devshashankb
Comment options

Answer selected by andrzej-stencel
Comment options

You must be logged in to vote
1 reply
@andrzej-stencel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
receiver/sqlquery SQL query receiver
3 participants