Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit keyword does not work with the hidden keyword #837

Open
zhengtianbao opened this issue Apr 22, 2024 · 0 comments
Open

limit keyword does not work with the hidden keyword #837

zhengtianbao opened this issue Apr 22, 2024 · 0 comments
Labels
bug This is considered a bug and shall get fixed mtail-Language/VM Issues related to the mtail language, compiler, or VM

Comments

@zhengtianbao
Copy link
Contributor

limit does not limit the hidden metrics.

Here is my test:

gen_log.sh

#!/bin/bash

for i in {1..100}
do
    echo id=$i >> test.log
done

Execute gen_log.sh will generate 100 lines with sequence IDs, and write to the file test.log.

test.mtail

counter test_total by id limit 10

/id=(?P<id>\d+)/ {
  test_total[$id] ++
}

test_hidden.mtail

hidden counter test_total by id limit 10

/id=(?P<id>\d+)/ {
  test_total[$id] ++
}

Both are the same except for the hidden prefix.

start mtail:

./mtail -expired_metrics_gc_interval=30s -logtostderr -mtailDebug -v 10 --progs test.mtail --logs test.log 

After 30 seconds, when the GC occurs, I see the following message:

I0422 15:58:35.501660   40454 filestream.go:182] &{0xc000181aa0}: current seek is 1184
I0422 15:58:35.501682   40454 filestream.go:183] &{0xc000181aa0}: new size is 1184
I0422 15:58:35.501600   40454 metric.go:192] removeOldest: removing oldest LV: &{[1] 0xc000113030 0s}
I0422 15:58:35.501695   40454 filestream.go:243] &{0xc000181aa0}: waiting
I0422 15:58:35.501709   40454 metric.go:192] removeOldest: removing oldest LV: &{[2] 0xc000113050 0s}
I0422 15:58:35.501725   40454 metric.go:192] removeOldest: removing oldest LV: &{[3] 0xc000113070 0s}
I0422 15:58:35.501737   40454 metric.go:192] removeOldest: removing oldest LV: &{[4] 0xc0001130a0 0s}
I0422 15:58:35.501748   40454 metric.go:192] removeOldest: removing oldest LV: &{[5] 0xc0001aa020 0s}
...
I0422 15:58:35.502735   40454 metric.go:192] removeOldest: removing oldest LV: &{[88] 0xc0001aa4c0 0s}
I0422 15:58:35.502746   40454 metric.go:192] removeOldest: removing oldest LV: &{[89] 0xc0001aa4e0 0s}
I0422 15:58:35.502756   40454 metric.go:192] removeOldest: removing oldest LV: &{[90] 0xc0001aa530 0s}

But when using test_hidden.mtail, the above message is not displayed.

@jaqx0r jaqx0r added bug This is considered a bug and shall get fixed mtail-Language/VM Issues related to the mtail language, compiler, or VM labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is considered a bug and shall get fixed mtail-Language/VM Issues related to the mtail language, compiler, or VM
Projects
None yet
Development

No branches or pull requests

2 participants