Documentation
¶
Index ¶
- func GetExtraLabels(req *http.Request) ([]prompbmarshal.Label, error)
- func GetTimestamp(req *http.Request) (int64, error)
- func GetUncompressedReader(r io.Reader, encoding string) (io.Reader, error)
- func HandleVMProtoServerHandshake(w http.ResponseWriter, r *http.Request) booldeprecated
- func PutUncompressedReader(r io.Reader)
- 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 ReadUncompressedData(r io.Reader, encoding string, maxDataSize *flagutil.Bytes, ...) error
- func ScheduleUnmarshalWork(uw UnmarshalWork)
- func StartUnmarshalWorkers()
- func StopUnmarshalWorkers()
- type UnmarshalWork
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExtraLabels ¶
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 GetTimestamp ¶
GetTimestamp extracts unix timestamp in milliseconds from `timestamp` query arg.
It returns 0 if there is no `timestamp` query arg.
func GetUncompressedReader ¶
GetUncompressedReader returns uncompressed reader for r and the given encoding
The returned reader must be passed to PutUncompressedReader when no longer needed.
func HandleVMProtoServerHandshake
deprecated
func HandleVMProtoServerHandshake(w http.ResponseWriter, r *http.Request) bool
HandleVMProtoServerHandshake returns true if r contains handshake request for determining the supported protocol version.
Deprecated: New vmagent versions skip the handshake and use the VictoriaMetrics remote write protocol by default. See: https://github.com/VictoriaMetrics/VictoriaMetrics/pull/8462
func PutUncompressedReader ¶
PutUncompressedReader puts r to the pool, so it could be reused via GetUncompressedReader()
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 ReadUncompressedData ¶
func ReadUncompressedData(r io.Reader, encoding string, maxDataSize *flagutil.Bytes, callback func(data []byte) error) error
ReadUncompressedData reads uncompressed data from r using the given encoding and then passes it to the callback.
The maxDataSize limits the maximum data size, which can be read from r.
The callback must not hold references to the data after returning.
func ScheduleUnmarshalWork ¶
func ScheduleUnmarshalWork(uw UnmarshalWork)
ScheduleUnmarshalWork schedules uw to run in the worker pool.
It is expected that StartUnmarshalWorkers is already called.
func StartUnmarshalWorkers ¶
func StartUnmarshalWorkers()
StartUnmarshalWorkers starts unmarshal workers.
func StopUnmarshalWorkers ¶
func StopUnmarshalWorkers()
StopUnmarshalWorkers stops unmarshal workers.
No more calls to ScheduleUnmarshalWork are allowed after calling stopUnmarshalWorkers
Types ¶
type UnmarshalWork ¶
type UnmarshalWork interface {
// Unmarshal must implement CPU-bound unmarshal work.
Unmarshal()
}
UnmarshalWork is a unit of unmarshal work.