What is the best way to expose a timestamp from your application?
A.
With a gauge that has the timestamp as value.
B.
With a constant metric of value 1 and the timestamp as metric timestamp.
C.
With a counter that is increased to the correct value.
D.
With a constant metric of value 1 and the timestamp as label.
The Answer Is:
A
This question includes an explanation.
Explanation:
The correct way to expose a timestamp from an application in Prometheus is to use agauge metricwhere thetimestamp value(in Unix time, seconds since epoch) is stored as the metric’svalue. This approach aligns with the Prometheus data model, which discourages embedding timestamps as labels or metadata.
In this example, the gauge represents the timestamp of the last successful backup. The _seconds suffix indicates the unit of measurement, making the metric self-descriptive. Prometheus automatically assigns timestamps to scraped samples, so the metric’s value is treated purely as data, not as a Prometheus sample time.
Options B and D are incorrect because Prometheus does not allow arbitrary timestamps or labels for time values. Option C is incorrect since counters are monotonically increasing and not suited for discrete timestamp values.
[References:Verified from Prometheus documentation –Instrumentation Best Practices (Exposing Timestamps),Gauge Metric Semantics, andMetric Naming Conventions – _seconds suffix., , ]
PCA PDF/Engine
Printable Format
Value of Money
100% Pass Assurance
Verified Answers
Researched by Industry Experts
Based on Real Exams Scenarios
100% Real Questions
Get 75% Discount on All Products,
Use Coupon: "ac75sure"