decouple httplib from web module

This commit is contained in:
Ming Deng 2020-09-27 00:37:46 +08:00
parent 9a7c43c404
commit 463e96447a
1 changed files with 6 additions and 4 deletions

View File

@ -23,11 +23,13 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/astaxie/beego/pkg/client/httplib"
"github.com/astaxie/beego/pkg/server/web"
)
type FilterChainBuilder struct {
summaryVec prometheus.ObserverVec
AppName string
ServerName string
RunMode string
}
func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filter {
@ -36,9 +38,9 @@ func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filt
Name: "beego",
Subsystem: "remote_http_request",
ConstLabels: map[string]string{
"server": web.BConfig.ServerName,
"env": web.BConfig.RunMode,
"appname": web.BConfig.AppName,
"server": builder.ServerName,
"env": builder.RunMode,
"appname": builder.AppName,
},
Help: "The statics info for remote http requests",
}, []string{"proto", "scheme", "method", "host", "path", "status", "duration", "isError"})