How to use query time as value in visualization

Hi! I am new on this software and I don’t know how to use query time as value in visualization.
Template:

  • What Grafana version and what operating system are you using?
    I am using Grafana Enterprise version 10.0.0

  • What are you trying to achieve?
    I would like to somehow use the query time (time at witch the query was made) as data to run a “timeline/history” chart, so that I don’t have to pollute my database with timecodes.

  • How are you trying to achieve it?
    Tried to navigate through all of the menus and submenus to see if I couldn’t achieve what I wanted.

  • Did you follow any online instructions? If so, what is the URL?
    Tried to, but couldn’t find anything related to what I want to do.

I don’t know if I made my post clear (as English isn’t my native language), but I’ll gladly respond to any of your questions.
Thanks in advance.

1 Like

Welcome @edendelire

What is the datasource you are using

Also please share the scheme of your table(s)

And data types

Yes sorry I did forget to include these infos:

  • I am using the MySQL data source, connected to a MariaDB server version 10.9.8
  • The table comes from a game server for the “FiveM” GTA V Multiplayer modification
    The table is called “users” and I am only retrieving the “accounts” column, containing on each row JSON data stored as a “LONGTEXT”.
    Here’s an example of one row : {“money”:49372,“bank”:54400,“black_money”:0}

I’ll gladly give you any other information

It’s not clear, why you need it and how it can help, but use NOW():

SELECT
  NOW() AS time,
...
FROM...
WHERE...
...```
1 Like

And then they will all be stacked in the same time. Why do you need to fake time? Why use timeseries visualization when you dont have time?

Okay sorry, i’ll try to rephrase my question.

What I want to do is kind of a “history” of players’ money, so for example have a graph going day after day from January 2024 to February 2024, tracing the evolution of the economy.
So I guess I’m asking if the dashboard keeps and store every value it’s fetched from the database as well.

No, Grafana doesn’t store any metrics.

Grafana just visualize what is already stored. Grafana is tool to visualize data, not to store data.

Unfortunately, you have to “pollute” your DB with timecodes. But you can be smart and you can use DB features, which are available, so you don’t need additional implementation on the app side.
For example triggers: random example from the internet: MariaDB Create Trigger Statement By Practical Examples

All right thanks for these clarifications.
I’ll see what I can do, have a great rest of your day.