Thanks for your answers both! To clarify, I am looking on the
Prometheus client side. The metrics are not counters or anything that
can be exported straight away, rather based on some "events" (e.g., a
file has been changed, etc. -- even in an example like that, I would
need the app, after restart, to continue counting from the value it
was before restart; note that it is not about targeting one specific
file, therefore I'm talking about some more "dynamic" metrics
depending on what file gets changed - so that needs to continue being
reported in the metrics after restart). Please let me know if my
example doesn't make much sense, and I'll try to find a more eloquent
case. Cheers!
On 2/21/20, Jake Utley <
jut...@hiya.com> wrote:
> Why are you trying to persist your metrics? If it's to preserve counters,
> this is unnecessary. PromQL functions that operate on counters (such as
> rate) will gracefully handle cases where the counter restarts.
>
> On Friday, February 21, 2020 at 9:21:47 AM UTC-8, Stuart Clark wrote:
>>
>> Your metrics are being stored in Prometheus so this shouldn't be
>> necessary.
>>
>> On 21 February 2020 17:15:18 GMT, Mircea <
mircea...@gmail.com
>> <javascript:>> wrote:
>>>
>>> Hello,
>>>
>>>
>>> This might be a silly question, but here I am: I would need to enable
>>> persistence for some metrics (looks like the push gateway might be a
>>> no-go
>>> for now) and I was thinking to have my app dump the metrics, say into a
>>> file (e.g., using the write_to_textfile function) - then when the app
>>> restarts to firstly attempt to load the metrics from there, so it ensures
>>>
>>> continuity. I understand this doesn't sound like the most ideal scenario,
>>>
>>> but such are the constraints am afraid... Anyway, so what I'm asking
>>> basically is if there's a way, or anyone is aware, of the counter-part of
>>>
>>> the write_to_textfile function to load the metrics from text into the
>>> registry.
>>>
>>>
>>> Thanks!
>>>
>>>
>> --
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
prometheus-use...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/prometheus-users/cc755b9f-0626-4f25-950a-cc2357296c37%40googlegroups.com.
>
--
-Mircea