Closed Mikadore closed 2 years ago
This can be done using:
metric_families
.into_iter()
.map(|mut fam| {
for metric in fam.mut_metric() {
metric.set_timestamp_ms(timestamp)
}
fam
})
.collect()
Welcome and thanks for the report. Are you maybe chasing the same feature request as https://github.com/tikv/rust-prometheus/issues/382?
Welcome and thanks for the report. Are you maybe chasing the same feature request as #382?
Hello, yes, it seems I didn't search carefully enough. Thanks :D
Is your feature request related to a problem? Please describe. In order to backfill metrics into prometheus, time stamps are needed. Currently, this crate doesn't provide a way to add time stamps when exporting using either
ProtobufEncoder
orTextEncoder
Describe the solution you'd like Add a method to
ProtobufEncoder
andTextEncoder
, perhaps something likeencode_with_timestamp
.Describe alternatives you've considered Hacking around manually with exported metrics. This is error prone, but also a feature that falls within the use case of this crate.