How to create grafana panel with timestamp provided in labels section?

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?
    Create a gauge panel with custom timestamp, this timestamp is passed as one of the labels.

Here is a sample data

|{instance=host1, job=avgload, timestamp=1679493780000} |41.49887453673687|
|{instance=host1, job=avgload, timestamp=1679494320000} |36.07998560413523|

1 Like

Hi @gajananmudaliar,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

Grafana’s current latest stable version is 9.4.7 and the version you are using is a bit older now. Also, there are numerous bug fixes and improvements had been made along the releases (see Changelog)

The recommendation would be to test this in the recent stable version and if that does not work then feel free to report it here. (for now, I will now close this issue).

Coming back to your question:

Can you please try to reproduce this same issue on and then share the dashboard link so that we can view it?


Hi @usman.ahmad ,

Sorry I am not claiming that its an issue. I would like to know how to create a panel with timestamps passed in labels.


Thanks for more info.

One question, you want this to see only in Gauge Panel?

Thank you for responding.
I am using metric to see load avg for a device. So it would be able to see it in a panel.
But do you a way to get it in any other way?

Hi @gajananmudaliar

So I tested out this by using Prometheus Datasource and it seems to work. I first define a query and then switch the panel from Time Series to Gauge.

After that I filter the legend e.g. only want to view instances and it seems to work. I added a small GIF file.


Is this what you are looking for?

Incase not then please explain in more detail.


Hi @usman.ahmad ,
Thanks for your efforts, I didnt see where you have converted a timestamp which are passed as labels as an actual timestamp.

In my example dataset:

|{instance=host1, job=avgload, timestamp=1679493780000} |41.49887453673687|
|{instance=host1, job=avgload, timestamp=1679494320000} |36.07998560413523|

Here the actual timestamp has been passed as the label. The loadavg 41.49 was at timestamp value: 1679493780000 (Wednesday, March 22, 2023 2:03:00 PM)
I would like to plot a graph with 41.49 against timestamp Wednesday, March 22, 2023 2:03:00 PM.

Hope this helps.
Thank you so much.

Hope this picture helps to explain my problem

1 Like

Hi @gajananmudaliar

Thanks for the explanation. I checked and it is possible in Prometheus by using the time series panel. Here is a demo link which shows the timestamp on X-axis and the metric on Y-axis

This is however not possible using the Gauge Panel as it supports single-value visualization.

I hope this helps

Hi @usman.ahmad

Thanks a lot for your message. Really appreciate your help. Can you please tell me how can I use in time series grafana panel to convert label to x-axis time.?

Thanks a lot

I am not expert with the PromQL but AFAIK it should work without any custom settings, as Prometheus records metrics in a time series database and uses HTTP pull request model.

Just use the Time Series Panel and define your PromQL and should see the time scale on x-axis.

Hi @usman.ahmad
Thanks a lot for your help.
Let me experiment with it.

Great support

Hi Usman, I am looking to do the same thing as this user. The link you provided previously does not work anymore. Do you know if it has moved, or could you otherwise help instruct me on how to use timestamp provided in label as the time value in a Grafana panel with Prometheus data source?

Hi @kvsmoove ,

You are correct as it seems that the Dashboard has been removed.

However, I found another alternative Dashboard for Prometheus, here is the 1st link and the 2nd link.

I hope this helps.

Thank you for the updated links, I looked through but didn’t see where in the panel or query configs the portion where it uses a label as the timestamp value?

Yes I agree with @kvsmoove about the same. @usman.ahmad can you please elaborate on how we can use custom timestamp as one of the axis.

Looks like grafana lacks this capability

@gajananmudaliar Have you tried to use transformation to convert a timestamp from a label to a field? Then, you can use it to plot a Time Series.

Hi @gajananmudaliar !

I’m a bit confused, are you trying to create a gauge or a time-series panel?

For a gauge, maybe you’re looking for:
Options > Legend : {{ timestamp }} in the PromQL query editor.

For time-series panels, It’s not possible as far as I know.

I would still recommend to upgrade to Grafana 9 or 10 (you mentioned Grafana 7)

Also, storing timestamps in a label seems like a bad idea, as it will probably generate high-cardinality metrics, but I guess it depends on what you’re trying to achieve.

Similar question : How to Use a Prometheus Label as a Timestamp for Grafana - #6 by mattabrams

Thanks for your inputs. I was waiting for the shared instance of grafana to be upgraded. Now that the grafana is upgraded I was able to use the label to fields transformation to extract the timestamp how do I set this timestamp as the x axis in the Time series panel?