'Changing x-axis in grafana graph to custom time series sent as label of gauge

I am working on a project in java using spring boot that requires working on prometheus and grafana.

To send data to prometheus end-point, I am using "gauge" having name "metrices_value" with label "dateAndTime". This gauge contains value of type "Double".

Some examples of "gauge" at api end-point -

  1. metrices_value{dateAndTime="2022-05-13 12:03:48"} 1.0
  2. metrices_value{dateAndTime="2022-05-13 15:35:18"} 3.0

When I am using "Time series" visualization for "metrices_value" in grafana, then x-axis is showing the time at which prometheus is pulling the data from api end-point.

But, on x-axis, I want to show the custom time that I am sending through gauge as a label i.e, "dateAndTime".

Please let me know how to solve this issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source