promhlp

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearName

func ClearName(txt string, allowColon bool, replaceRune rune) string

ClearName replaces non-allowed characters for Prometheus metrics.

For metrics, colon is allowed, for tags, is is not.

Types

type CountingReadCloser

type CountingReadCloser struct {
	io.ReadCloser
	Size int64
}

CountingReadCloser is an io.ReadCloser which counts the read bytes.

func NewCountingReader

func NewCountingReader(r io.Reader) *CountingReadCloser

NewCountingReader returns a CountingReadCloser.

func (*CountingReadCloser) Read

func (cr *CountingReadCloser) Read(p []byte) (n int, err error)

type CountingResponseWriter

type CountingResponseWriter struct {
	http.ResponseWriter
	Code int
	Size int64
}

CountingResponseWriter is a http.ResponseWriter which counts the written bytes, and stores the response's Code.

func NewCountingRW

func NewCountingRW(w http.ResponseWriter) *CountingResponseWriter

NewCountingRW returns a CountingResponseWriter.

func (*CountingResponseWriter) Write

func (rw *CountingResponseWriter) Write(p []byte) (n int, err error)

func (*CountingResponseWriter) WriteHeader

func (rw *CountingResponseWriter) WriteHeader(code int)

WriteHeader implements http.ResponseWriter.WriteHeader, and record the code.

Jump to

Keyboard shortcuts

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