Documentation ¶
Index ¶
- Variables
- func AddTraceID(ctx *gin.Context)
- func Cors() gin.HandlerFunc
- func HTTPLoggerWithConfig(config HTTPConfig) gin.HandlerFunc
- func HeartCheck() gin.HandlerFunc
- func HttpClientCounter(url string)
- func HttpClientDuration(url string, e string, cost int64)
- func IncCounter(name string, labelMap map[string]string) error
- func Metric() gin.HandlerFunc
- func Monitor() gin.HandlerFunc
- func Recovery() gin.HandlerFunc
- func Start(appName string, port int)
- func Timeout(timeout time.Duration) func(c *gin.Context)
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- type HTTPConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var AllowHeaders = []string{
"device-id",
"hardware",
"tros",
"os",
"os_version",
"location",
"ip",
"network_type",
"timestamp",
"user_agent",
"resolution",
"platform",
"app_key",
"app_version",
"app_vsn",
"trace_id",
"token",
"s-token",
"run-as",
"company-id",
"product",
"X-Forwarded-For",
"X-Forwarded-Proto",
"Authorization",
}
View Source
var AllowOrigins = []string{
"*",
}
View Source
var ClientReqCounter *prometheus.CounterVec
View Source
var ClientReqDuration *prometheus.HistogramVec
View Source
var ClientReqGauge *prometheus.GaugeVec
View Source
var ServerReqCounter *prometheus.CounterVec
View Source
var ServerReqDuration *prometheus.HistogramVec
View Source
var ServerReqGauge *prometheus.GaugeVec
Functions ¶
func AddTraceID ¶
func HTTPLoggerWithConfig ¶
func HTTPLoggerWithConfig(config HTTPConfig) gin.HandlerFunc
HTTPLoggerWithConfig new logger middleware with LoggerConfig
func HeartCheck ¶
func HeartCheck() gin.HandlerFunc
func HttpClientCounter ¶
func HttpClientCounter(url string)
func HttpClientDuration ¶
func Monitor ¶
func Monitor() gin.HandlerFunc
func Recovery ¶
func Recovery() gin.HandlerFunc
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns unary gRpc tracing middleware
Types ¶
type HTTPConfig ¶
type HTTPConfig struct { // Logger logx.Logger instance Logger *trlogger.TrLogger // Excludes ignore paths Excludes []string }
HTTPConfig http日志打印配置
Click to show internal directories.
Click to hide internal directories.