From docs I understand, that it determines how much time metric value will be stored. If its true what is the sense of recommendation (from docs also) to set it at least 2x prometheus scrape interval.
E.g. prometheus scrape interval is 30s, so prometheus_retention_time = 60s
As a result every second scrape request will get same metric values as first one.
Also it is mentioned in docs that it may have sense to set prometheus_retention_time to high values like 1d or even 31d - what is point of doing this? (having metric with value obsoleted month ago)
The metrics system in HashiCorp projects is a poor fit for Prometheus.
It is really built for push-based metrics systems.
The code is structured around “sending” metrics values, and for Prometheus, it is necessary to configure how long the last value sent, sticks around being served to Prometheus scrapes, before it vanishes.
An illustration:
You start up a Consul agent.
It serves a Prometheus metric consul_version{version="...", pre_release="..."} 1 to export metadata to Prometheus about the running version.
After prometheus_retention_time has passed, this metric disappears.
This is unambiguously a bug, to someone who understands how Prometheus metrics are supposed to work.
Thanks for info.
E.g. prometheus_retention_time is 1h and scrape inverval is 1m.
First scrape will get metric value and what will happened on second scrape? Will metric have same value because retention period (1h)? so all scrapes before 1h will get same metric value? or metric will be updated on every scrape?