提交 463e9644 编写于 作者: M Ming Deng

decouple httplib from web module

上级 9a7c43c4
...@@ -23,11 +23,13 @@ import ( ...@@ -23,11 +23,13 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/astaxie/beego/pkg/client/httplib" "github.com/astaxie/beego/pkg/client/httplib"
"github.com/astaxie/beego/pkg/server/web"
) )
type FilterChainBuilder struct { type FilterChainBuilder struct {
summaryVec prometheus.ObserverVec summaryVec prometheus.ObserverVec
AppName string
ServerName string
RunMode string
} }
func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filter { func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filter {
...@@ -36,9 +38,9 @@ func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filt ...@@ -36,9 +38,9 @@ func (builder *FilterChainBuilder) FilterChain(next httplib.Filter) httplib.Filt
Name: "beego", Name: "beego",
Subsystem: "remote_http_request", Subsystem: "remote_http_request",
ConstLabels: map[string]string{ ConstLabels: map[string]string{
"server": web.BConfig.ServerName, "server": builder.ServerName,
"env": web.BConfig.RunMode, "env": builder.RunMode,
"appname": web.BConfig.AppName, "appname": builder.AppName,
}, },
Help: "The statics info for remote http requests", Help: "The statics info for remote http requests",
}, []string{"proto", "scheme", "method", "host", "path", "status", "duration", "isError"}) }, []string{"proto", "scheme", "method", "host", "path", "status", "duration", "isError"})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册