debug.Timer seems to cumulate runs

I don’t really know how to write-up this issue. I am using the (more or less new) debug.Timer function in a module. Running the website using the module I see the timer in the output - all good.

Changing things in the file implementing the timer (it’s just {{ $t := debug.Timer "netlification-headers" }} in the first line of the file and {{ $t.Stop }} in the last line of the file) and saving it results in a reload and TWO lines of timer debugging. Saving again results in three lines of debug and so on.

It appears, that when using the timer in a dev-server environment, the output of previous runs does not get purged.

Is that a wanted feature or a bug? Or is there maybe an undocumented parameter/method to clear previous runs?

After six runs it shows six logs:

INFO  timer:  name "netlification-headers" count '\x01' duration "201.617218ms" average "201.617218ms" median "201.617218ms"
INFO  timer:  name "netlification-headers" count '\x01' duration "226.694µs" average "226.694µs" median "226.694µs"
INFO  timer:  name "netlification-headers" count '\x01' duration "585.274µs" average "585.274µs" median "585.274µs"
INFO  timer:  name "netlification-headers" count '\x01' duration "215.628µs" average "215.628µs" median "215.628µs"
INFO  timer:  name "netlification-headers" count '\x01' duration "239.867µs" average "239.867µs" median "239.867µs"
INFO  timer:  name "netlification-headers" count '\x01' duration "243.889µs" average "243.889µs" median "243.889µs"

Please create an issue. I tested this feature before it was released, but never considered the possibility that someone might use it when running the dev server.

Done. Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.