add metrics http exporter

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-11-16 20:17:37 +03:00
parent 31528740dc
commit 26ddc88547
4 changed files with 1609 additions and 20 deletions

View File

@@ -3,11 +3,17 @@ package config
import (
"io"
yamlcodec "go.unistack.org/micro-codec-yaml/v3"
mtime "go.unistack.org/micro/v3/util/time"
yaml "gopkg.in/yaml.v3"
)
type Meter struct {
Addr string `json:"addr,omitempty" yaml:"addr,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}
type Config struct {
Meter *Meter `json:"meter,omitempty" yaml:"meter,omitempty"`
Checks []*Check `json:"checks,omitempty" yaml:"checks,omitempty"`
}
@@ -35,5 +41,5 @@ func (cfg *Config) Parse(r io.Reader) error {
return err
}
return yaml.Unmarshal(buf, cfg)
return yamlcodec.NewCodec().Unmarshal(buf, cfg)
}