Documentation ¶
Overview ¶
Package xhttp 提供基础 http 客户端组件 内置以下功能: - logging - opentracing - prometheus
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HTTPDurationsSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Namespace: conf.AppID, Name: "http_durations_seconds", Help: "HTTP latency distributions", Buckets: defBuckets, ConstLabels: map[string]string{"app": conf.AppID}, }, []string{"url", "status"})
HTTPDurationsSeconds http 调用耗时
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Do 发送单个 http 请求 Do(ctx context.Context, req *http.Request) (*http.Response, error) }
Client http 客户端接口
func NewInsecureClient ¶ added in v1.3.0
NewInsecureClient 创建不校验证书的 Client 实例
type GrpcClient ¶ added in v1.3.0
type GrpcClient interface {
DoUnary(ctx context.Context, api string, req, resp proto.Message) (h2resp *http.Response, err error)
}
func NewGrpcClient ¶ added in v1.3.0
func NewGrpcClient(timeout time.Duration) GrpcClient
Click to show internal directories.
Click to hide internal directories.