question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Including timestamp in metric

See original GitHub issue

Hello,

I’d like to include the timestamp in the metric according to the Prometheus documentation: https://prometheus.io/docs/instrumenting/exposition_formats/

metric_name [
  "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}"
] value [ timestamp ]

I’d like that feature for the following reason: Some exporters take a while to gather certain information. Therefore I would like to run them asynchronously, not only when the endpoint is scraped. To guarantee that the metrics are as accurate as possible, I’d like to include the timestamp with the metric.

Currently, I don’t think this is possible.

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hollodotmecommented, Nov 19, 2018

I have question regarding the timestamp value type. The prometheus docs say:

The timestamp is an int64 (milliseconds since epoch, i.e. 1970-01-01 00:00:00 UTC, excluding leap seconds), represented as required by Go’s ParseInt() function.

Looking at the python parser and its tests floats (I think microseconds) are used for the timestamps.

What is the right format / type? Am I missing something?

0reactions
spaceonecommented, Oct 31, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding timestamps to Gauge Metric - Google Groups
Hi everyone, I am new to prometheus. I am using type Gauge. I wanted to get the timestamp along with the value. It...
Read more >
Prometheus metrics with timestamp - Stack Overflow
Solution: Perform regular query and filter the timestamp value from timestamps array. The response is a JSON output which consists of ...
Read more >
How to Use a Prometheus Label as a Timestamp for Grafana
I want to make a graph with label 'date' by X-axis and metric value by Y-axis. There should be value points for different...
Read more >
Metric With Timestamp : r/PrometheusMonitoring - Reddit
I was reading the book “Prometheus Up and Running” and the author mentioned that it is possible to expose a metric with a...
Read more >
Is there any way to POST metrics with custom timestamp value?
For metrics, no, there is no way to specify a timestamp other than the time that the POST is received by New Relic's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found