Introduction
The "prometheus_retention_time" parameter has the following definition:
Specifies the amount of time that Prometheus metrics are retained in memory. Setting this to 0 will disable Prometheus telemetry.
Prerequisites (if applicable)
- The explanation of the "prometheus_retention_time" parameter is valid for all versions of Vault
Overview
Let's take a simple metric of type summary (summary type provides a sum of the observed values as quantiles over a period of time) - "vault.token.create" which would represent the time taken by Vault to create a token as quantiles - 0.5 quantile, 0.9 quantile, and 0.99 quantile.
When the tokens are constantly being created in Vault, the "vault.token.create" metric is always going to be emitted and Prometheus would have the ability to scrape it at its configured scrape interval in the Prometheus config.
But what happens when the generation of tokens in Vault is ceased, and no tokens are being generated at all in Vault, and Prometheus tries to scrape the Vault's metrics?
Let's assume that the Prometheus scrape interval is 1 minute and the "prometheus_retention_time" parameter is configured to 3 minutes in the Vault's config.
From the moment the generation of tokens in Vault is ceased, Vault is going to keep emitting the "vault.token.create" metric for 3 minutes, which would mean for the next 3 scrapes of Prometheus the metric is going to be available (because of configured prometheus_retention_time parameter), but after 3 minutes have expired, Vault would stop emitting that particular metric (all inactive metrics in fact) and it will show in Prometheus as empty (not available).
To sum it all up, the "prometheus_retention_time" defines for how long Vault would keep emitting the metric after it is no longer active, in this example the creation of Vault token has ceased (vault.token.create metric).