mtail icon indicating copy to clipboard operation
mtail copied to clipboard

is it possible to remove all labels of a metrics in a program?

Open godsarmy opened this issue 3 years ago • 2 comments

Hi

I know it is possible delete a data with label for internal metrics like 'del metrics[$label]'. But is it possible to have a quick way to remove all the labels in a metrics immediately?

I have a scenario to count differnt item's' current value in a metrics but the system could be reset (generate some reset string pattern in log) so that i would like to reset all data in the metrics in this case.

I do not think "del metrics after" could help me because the metrics should not expire until reset. Also the lablel name is not determined. So i do not have explict label names to delete.

For metrics without label, i can reset metrics value to zero to work around reset. But i do not have a way to handle metrics with labels.. The ony method in my mind is to restart mtail.

godsarmy avatar Apr 06 '22 05:04 godsarmy

There is not such a way. Only restarting the mail process will reset the variable store.

On Wed, 6 Apr 2022, 15:04 Walt Chen, @.***> wrote:

Hi

I know it is possible delete a data with label for internal metrics like 'del metrics[$label]'. But is it possible to have a quick way to remove all the labels in a metrics immediately?

I have a scenario to count differnt item's' current value in a metrics but the system could be reset (generate some reset string pattern in log) so that i would like to reset all data in the metrics in this case.

I do not think "del metrics after" could help me because the metrics should not expire until reset. Also the lablel name is not determined. So i do not have explict label names to delete.

For metrics without label, i can reset metrics value to zero to work around reset. But i do not have a way to handle metrics with labels.. The ony method in my mind is to restart mtail.

— Reply to this email directly, view it on GitHub https://github.com/google/mtail/issues/631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX67YAR5UQOBNJD3PVBTVDULPRANCNFSM5SUZQQSA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jaqx0r avatar Apr 14 '22 23:04 jaqx0r

If mtail is restarted, it doesn't restore any state; it loads the programs and creates brand new metrics, then starts reading the log files at the current end of file position. So any metrics created are from a "clean slate".

Right now in #617 I'm implementing a size limit for metrics, though; can you take a look at that bug and see if it suits your needs instead?

On Tue, 26 Apr 2022 at 22:41, Walt Chen @.***> wrote:

But even if mtail restarted, it would still read logs before reset status to import as metrics. If we can not handle labels individually, is it possible to add a feature to reset mtail into clean slate status when matching a pattern in log?

There is not such a way. Only restarting the mail process will reset the variable store. … <#m_8806640788966372266_> On Wed, 6 Apr 2022, 15:04 Walt Chen, @.> wrote: Hi I know it is possible delete a data with label for internal metrics like 'del metrics[$label]'. But is it possible to have a quick way to remove all the labels in a metrics immediately? I have a scenario to count differnt item's' current value in a metrics but the system could be reset (generate some reset string pattern in log) so that i would like to reset all data in the metrics in this case. I do not think "del metrics after" could help me because the metrics should not expire until reset. Also the lablel name is not determined. So i do not have explict label names to delete. For metrics without label, i can reset metrics value to zero to work around reset. But i do not have a way to handle metrics with labels.. The ony method in my mind is to restart mtail. — Reply to this email directly, view it on GitHub <#631 https://github.com/google/mtail/issues/631>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX67YAR5UQOBNJD3PVBTVDULPRANCNFSM5SUZQQSA https://github.com/notifications/unsubscribe-auth/AAXFX67YAR5UQOBNJD3PVBTVDULPRANCNFSM5SUZQQSA . You are receiving this because you are subscribed to this thread.Message ID: @.>

— Reply to this email directly, view it on GitHub https://github.com/google/mtail/issues/631#issuecomment-1109747146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX63WACBEF6QVVELZPUDVG7P6JANCNFSM5SUZQQSA . You are receiving this because you commented.Message ID: @.***>

jaqx0r avatar Apr 28 '22 00:04 jaqx0r

This issue has been waiting for more information for more than 60 days and will be closed in 7 if no update is provided.

github-actions[bot] avatar Mar 03 '23 02:03 github-actions[bot]