http

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DurationSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "duration_seconds",
			Help:      "The invocation duration in seconds.",
		},
		[]string{
			"request_uri",
		},
	)

	RequestsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "requests_total",
			Help:      "The number of requests.",
		},
		[]string{
			"request_uri",
			"method",
		},
	)

	ResponsesTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "responses_total",
			Help:      "The number of responses.",
		},
		[]string{
			"request_uri",
			"status",
		},
	)

	RequestsBytesTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "requests_bytes_total",
			Help:      "A summary of the invocation requests bytes.",
		},
		[]string{
			"request_uri",
			"method",
		},
	)

	ResponsesBytesTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "responses_bytes_total",
			Help:      "A summary of the invocation responses bytes.",
		},
		[]string{
			"request_uri",
			"method",
		},
	)
)

Functions

func NewJSONMessage

func NewJSONMessage(msgMap map[string]interface{}) ([]byte, error)

func NewLogger

func NewLogger(filename string, maxSize int, maxBackups int, maxAge int, compress bool) *log.Logger

func RecordMetrics

func RecordMetrics(start time.Time, status int, writer http.ResponseWriter, request *http.Request, logger *log.Logger)

func WriteResponse

func WriteResponse(w http.ResponseWriter, content []byte, status int, logger *log.Logger)

Types

type ApacheCombinedLogger

type ApacheCombinedLogger struct {
	Logger *log.Logger
}

func (ApacheCombinedLogger) Log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL