feat: metrics including pprof, expvars

This commit is contained in:
yichya 2022-03-25 11:24:23 +08:00 committed by yuhan6665
parent 91ffb7617d
commit 35eb165f63
9 changed files with 530 additions and 1 deletions

19
infra/conf/metrics.go Normal file
View file

@ -0,0 +1,19 @@
package conf
import (
"github.com/xtls/xray-core/app/metrics"
)
type MetricsConfig struct {
Tag string `json:"tag"`
}
func (c *MetricsConfig) Build() (*metrics.Config, error) {
if c.Tag == "" {
return nil, newError("metrics tag can't be empty.")
}
return &metrics.Config{
Tag: c.Tag,
}, nil
}