Hi,
I have the following metrics scraping from an exporter and the label has the correct “time” I want to use in X axis instead of “Time”.
Is it possible to convert/transform “time” label as x axis?
Thank you
Hi @ashanok
Prometheus handles labels as opaque strings, so you may need to rethink your approach. I recently dug into this issue a little with another user over in our repo.
See this discussion for more details:
opened 06:22PM - 27 Jul 21 UTC
area/units
needs investigation
<!--
Please use this template to create your bug report. By providing as much i… nfo as possible you help us understand the issue, reproduce it and resolve it for you quicker. Therefor take a couple of extra minutes to make sure you have provided all info needed.
PROTIP: record your screen and attach it as a gif to showcase the issue.
- Questions should be posted to: https://community.grafana.com
- Use query inspector to troubleshoot issues: https://bit.ly/2XNF6YS
- How to record and attach gif: https://bit.ly/2Mi8T6K
-->
**What happened**:
In a query to Prometheus that returns only a straight metric, I have two labels that include timestamps. When I attempt to display these timestamps in a table, I am unable to set the unit to any type of date format. All six options cause the values to be displayed as "NaN".
**What you expected to happen**:
The timestamps should be correctly displayed as a date, as they would if the returned metric value was a timestamp.
**How to reproduce it (as minimally and precisely as possible)**:
The following is an example of the metric being scraped by Prometheus:
`my_uptime_metric{expires_at="1607137229000",launched_at="1607086829683",node_label="Launch_179"} 20322007.078515`
Create a table panel querying `my_uptime_metric` only. Create a unit override for either the `expires_at` or `launched_at` field ("Fields with Name") and select any of the "Date & Time" types.
**Anything else we need to know?**:
I have a suspicion that the NaN result may be due to the timestamp values being expressed as a string instead of a numeric type. This data is being exposed to Prometheus through the node_exporter utility's textfile collector feature, and while the file node_exporter is reading from has the timestamps as a numeric format, it is applying the quotes to the timestamps.
**Environment**:
- Grafana version: 8.0.3
- Data source type & version: Promtheus 2.4.3
- OS Grafana is installed on: Docker Alpine Image
- User OS & Browser: Windows 10, Chrome 92
- Grafana plugins: grafana-clock-panel, flant-statusmap-panel
- Others:
