Documentation
¶
Index ¶
- func GetCorrelationID(ctx *gin.Context) string
- func GetLoggerFromGinContext(ctx *gin.Context) (*log.Entry, error)
- func GetMetricsFromContext(ctx *gin.Context) MetricsDomain.Point
- func GetRequestID(ctx *gin.Context) string
- func SetCors(router *gin.Engine, allowedOrigins []string)
- type HttpRequestMetric
- type HttpServer
- func (hs *HttpServer) CreateLoggerForRequest(ctx *gin.Context)
- func (hs *HttpServer) CreateMetricsForRequest(ctx *gin.Context)
- func (gs *HttpServer) GetPath(ctx *gin.Context) string
- func (gs *HttpServer) LogRequest(c *gin.Context)
- func (gs *HttpServer) MapHttpStatusToLoggingLevel(ctx *gin.Context) logrus.Level
- func (gs *HttpServer) ProfileNextRequest(ctx *gin.Context) time.Duration
- func (hs *HttpServer) Reply(ctx *gin.Context, body interface{})
- func (hs *HttpServer) ReplyWithError(ctx *gin.Context, err error)
- func (hs *HttpServer) RequireCorrelationID(ctx *gin.Context)
- func (hs *HttpServer) RequireRequestID(ctx *gin.Context)
- func (gs *HttpServer) Run() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCorrelationID ¶ added in v0.2.2
func GetLoggerFromGinContext ¶ added in v0.2.2
func GetMetricsFromContext ¶ added in v0.2.2
func GetMetricsFromContext(ctx *gin.Context) MetricsDomain.Point
func GetRequestID ¶ added in v0.2.2
Types ¶
type HttpRequestMetric ¶ added in v0.2.3
type HttpServer ¶
type HttpServer struct {
Gin *gin.Engine
Env env.Environment
// contains filtered or unexported fields
}
func NewHttpServer ¶
func NewHttpServer(env env.Environment, config *HttpConfig.HttpServerConfig) *HttpServer
func (*HttpServer) CreateLoggerForRequest ¶ added in v0.2.0
func (hs *HttpServer) CreateLoggerForRequest(ctx *gin.Context)
func (*HttpServer) CreateMetricsForRequest ¶ added in v0.2.0
func (hs *HttpServer) CreateMetricsForRequest(ctx *gin.Context)
func (*HttpServer) LogRequest ¶ added in v0.2.0
func (gs *HttpServer) LogRequest(c *gin.Context)
TODO: should find a way to log a point with the same key/values as the log entry without having to repeat the key/values setting (maybe an abstraction that can be used by both logrus and influxdb)
func (*HttpServer) MapHttpStatusToLoggingLevel ¶
func (gs *HttpServer) MapHttpStatusToLoggingLevel(ctx *gin.Context) logrus.Level
func (*HttpServer) ProfileNextRequest ¶
func (gs *HttpServer) ProfileNextRequest(ctx *gin.Context) time.Duration
func (*HttpServer) Reply ¶
func (hs *HttpServer) Reply(ctx *gin.Context, body interface{})
func (*HttpServer) ReplyWithError ¶
func (hs *HttpServer) ReplyWithError(ctx *gin.Context, err error)
func (*HttpServer) RequireCorrelationID ¶
func (hs *HttpServer) RequireCorrelationID(ctx *gin.Context)
func (*HttpServer) RequireRequestID ¶
func (hs *HttpServer) RequireRequestID(ctx *gin.Context)
func (*HttpServer) Run ¶
func (gs *HttpServer) Run() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.