mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix: metrics loading error
This commit is contained in:
parent
d4acd99fa7
commit
66e78b9089
1 changed files with 3 additions and 1 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/bytedance/sonic"
|
||||||
"github.com/yusing/go-proxy/internal/common"
|
"github.com/yusing/go-proxy/internal/common"
|
||||||
"github.com/yusing/go-proxy/internal/gperr"
|
"github.com/yusing/go-proxy/internal/gperr"
|
||||||
"github.com/yusing/go-proxy/internal/logging"
|
"github.com/yusing/go-proxy/internal/logging"
|
||||||
|
@ -77,7 +78,8 @@ func (p *Poller[T, AggregateT]) load() error {
|
||||||
|
|
||||||
func (p *Poller[T, AggregateT]) save() error {
|
func (p *Poller[T, AggregateT]) save() error {
|
||||||
initDataDirOnce.Do(initDataDir)
|
initDataDirOnce.Do(initDataDir)
|
||||||
entries, err := json.Marshal(p.period)
|
// marshal with original types (e.g. avoid converting time.Duration to string representation)
|
||||||
|
entries, err := sonic.Marshal(p.period)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue