Prometheus label value as x-axis in line chart

Hi All,

We have metrics which contains time-series records. The date value/timestamp is stored as label in the metrics. Our requirement is to create a line chart, where the date (label) to be used in x-axis and metrics value in y-axis. I have already tried different options like

  1. Added two labels - one long value of timestamp and another string value(mm-dd-yyyy) in the metric.
  2. I had transformed the date value (timestamp long value) to numeric.
  3. Then added that column to x-axis.
  4. But the chart is not showing any line.
  5. Also the question is can I show the string value of date in x axis(although in the background it uses the number value).

Example:
sample_time_series{some unique labels, date=“12-12-2023”, dateLongValue=“17837264838”} - 10
sample_time_series{some unique labels, date=“12-13-2023”, dateLongValue=“17947264844”} - 12

Line chart should a line from value 10 to 12 with x axis as 12-12-2023 and 12-13-2023.

Any assistance would be highly appreciated.

Hi, could you post a sample data in table format (most excellently if from prometheus datasource and in Grafana)? Theoretically you could - use the date from date Long Value as time (format to time and get rid of the original Time field with Organize fields by name transformation) and leave the number as it is, but it’s just a sketch of an idea, so the data would help to see if that’s even remotely possible :smile: