Documentation ¶
Index ¶
- func GetExtraLabels(req *http.Request) ([]prompbmarshal.Label, error)
- func GetGzipReader(r io.Reader) (*gzip.Reader, error)
- func GetTimestamp(req *http.Request) (int64, error)
- func GetZlibReader(r io.Reader) (io.ReadCloser, error)
- func HandleVMProtoClientHandshake(remoteWriteURL string, ...) bool
- func HandleVMProtoServerHandshake(w http.ResponseWriter, r *http.Request) bool
- func PutGzipReader(zr *gzip.Reader)
- func PutZlibReader(zr io.ReadCloser)
- func ReadLinesBlock(r io.Reader, dstBuf, tailBuf []byte) ([]byte, []byte, error)
- func ReadLinesBlockExt(r io.Reader, dstBuf, tailBuf []byte, maxLineLen int) ([]byte, []byte, error)
- func ScheduleUnmarshalWork(uw UnmarshalWork)
- func StartUnmarshalWorkers()
- func StopUnmarshalWorkers()
- type UnmarshalWork
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExtraLabels ¶ added in v1.40.1
func GetExtraLabels(req *http.Request) ([]prompbmarshal.Label, error)
GetExtraLabels extracts name:value labels from `extra_label=name=value` query args from req.
It also extracts Pushgateways-compatible extra labels from req.URL.Path according to https://github.com/prometheus/pushgateway#url .
func GetGzipReader ¶
GetGzipReader returns new gzip reader from the pool.
Return back the gzip reader when it no longer needed with PutGzipReader.
func GetTimestamp ¶ added in v1.41.0
GetTimestamp extracts unix timestamp in milliseconds from `timestamp` query arg.
It returns 0 if there is no `timestamp` query arg.
func GetZlibReader ¶ added in v1.67.0
func GetZlibReader(r io.Reader) (io.ReadCloser, error)
GetZlibReader returns zlib reader.
func HandleVMProtoClientHandshake ¶ added in v1.88.0
func HandleVMProtoClientHandshake(remoteWriteURL string, doRequest func(handshakeURL string) (*http.Response, error)) bool
HandleVMProtoClientHandshake returns true if the server at remoteWriteURL supports VictoriaMetrics remote write protocol.
func HandleVMProtoServerHandshake ¶ added in v1.88.0
func HandleVMProtoServerHandshake(w http.ResponseWriter, r *http.Request) bool
HandleVMProtoServerHandshake returns true if r contains handshake request for determining the supported protocol version.
func PutGzipReader ¶
PutGzipReader returns back gzip reader obtained via GetGzipReader.
func PutZlibReader ¶ added in v1.67.0
func PutZlibReader(zr io.ReadCloser)
PutZlibReader returns back zlib reader obtained via GetZlibReader.
func ReadLinesBlock ¶
ReadLinesBlock reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.
Trailing chars after the last newline are put into tailBuf.
Returns (dstBuf, tailBuf).
It is expected that read timeout on r exceeds 1 second.
func ReadLinesBlockExt ¶
ReadLinesBlockExt reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.
Trailing chars after the last newline are put into tailBuf.
Returns (dstBuf, tailBuf).
maxLineLen limits the maximum length of a single line.
It is expected that read timeout on r exceeds 1 second.
func ScheduleUnmarshalWork ¶ added in v1.42.0
func ScheduleUnmarshalWork(uw UnmarshalWork)
ScheduleUnmarshalWork schedules uw to run in the worker pool.
It is expected that StartUnmarshalWorkers is already called.
func StartUnmarshalWorkers ¶ added in v1.42.0
func StartUnmarshalWorkers()
StartUnmarshalWorkers starts unmarshal workers.
func StopUnmarshalWorkers ¶ added in v1.42.0
func StopUnmarshalWorkers()
StopUnmarshalWorkers stops unmarshal workers.
No more calls to ScheduleUnmarshalWork are allowed after calling stopUnmarshalWorkers
Types ¶
type UnmarshalWork ¶ added in v1.42.0
type UnmarshalWork interface {
// Unmarshal must implement CPU-bound unmarshal work.
Unmarshal()
}
UnmarshalWork is a unit of unmarshal work.