mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
app/vminsert: consistency renaming for counters
This commit is contained in:
parent
0ed9258545
commit
8501b4a48d
@ -61,13 +61,13 @@ func (ctx *pushCtx) InsertRows() error {
|
|||||||
const flushTimeout = 3 * time.Second
|
const flushTimeout = 3 * time.Second
|
||||||
|
|
||||||
func (ctx *pushCtx) Read(r io.Reader) bool {
|
func (ctx *pushCtx) Read(r io.Reader) bool {
|
||||||
graphiteReadCalls.Inc()
|
readCalls.Inc()
|
||||||
if ctx.err != nil {
|
if ctx.err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if c, ok := r.(net.Conn); ok {
|
if c, ok := r.(net.Conn); ok {
|
||||||
if err := c.SetReadDeadline(time.Now().Add(flushTimeout)); err != nil {
|
if err := c.SetReadDeadline(time.Now().Add(flushTimeout)); err != nil {
|
||||||
graphiteReadErrors.Inc()
|
readErrors.Inc()
|
||||||
ctx.err = fmt.Errorf("cannot set read deadline: %s", err)
|
ctx.err = fmt.Errorf("cannot set read deadline: %s", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (ctx *pushCtx) Read(r io.Reader) bool {
|
|||||||
ctx.err = nil
|
ctx.err = nil
|
||||||
} else {
|
} else {
|
||||||
if ctx.err != io.EOF {
|
if ctx.err != io.EOF {
|
||||||
graphiteReadErrors.Inc()
|
readErrors.Inc()
|
||||||
ctx.err = fmt.Errorf("cannot read graphite plaintext protocol data: %s", ctx.err)
|
ctx.err = fmt.Errorf("cannot read graphite plaintext protocol data: %s", ctx.err)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -132,8 +132,8 @@ func (ctx *pushCtx) reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
graphiteReadCalls = metrics.NewCounter(`vm_read_calls_total{name="graphite"}`)
|
readCalls = metrics.NewCounter(`vm_read_calls_total{name="graphite"}`)
|
||||||
graphiteReadErrors = metrics.NewCounter(`vm_read_errors_total{name="graphite"}`)
|
readErrors = metrics.NewCounter(`vm_read_errors_total{name="graphite"}`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPushCtx() *pushCtx {
|
func getPushCtx() *pushCtx {
|
||||||
|
@ -36,7 +36,7 @@ func InsertHandler(req *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func insertHandlerInternal(req *http.Request) error {
|
func insertHandlerInternal(req *http.Request) error {
|
||||||
influxReadCalls.Inc()
|
readCalls.Inc()
|
||||||
|
|
||||||
r := req.Body
|
r := req.Body
|
||||||
if req.Header.Get("Content-Encoding") == "gzip" {
|
if req.Header.Get("Content-Encoding") == "gzip" {
|
||||||
@ -132,7 +132,7 @@ func (ctx *pushCtx) Read(r io.Reader, tsMultiplier int64) bool {
|
|||||||
ctx.reqBuf, ctx.tailBuf, ctx.err = common.ReadLinesBlock(r, ctx.reqBuf, ctx.tailBuf)
|
ctx.reqBuf, ctx.tailBuf, ctx.err = common.ReadLinesBlock(r, ctx.reqBuf, ctx.tailBuf)
|
||||||
if ctx.err != nil {
|
if ctx.err != nil {
|
||||||
if ctx.err != io.EOF {
|
if ctx.err != io.EOF {
|
||||||
influxReadErrors.Inc()
|
readErrors.Inc()
|
||||||
ctx.err = fmt.Errorf("cannot read influx line protocol data: %s", ctx.err)
|
ctx.err = fmt.Errorf("cannot read influx line protocol data: %s", ctx.err)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -166,8 +166,8 @@ func (ctx *pushCtx) Read(r io.Reader, tsMultiplier int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
influxReadCalls = metrics.NewCounter(`vm_read_calls_total{name="influx"}`)
|
readCalls = metrics.NewCounter(`vm_read_calls_total{name="influx"}`)
|
||||||
influxReadErrors = metrics.NewCounter(`vm_read_errors_total{name="influx"}`)
|
readErrors = metrics.NewCounter(`vm_read_errors_total{name="influx"}`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type pushCtx struct {
|
type pushCtx struct {
|
||||||
|
@ -61,13 +61,13 @@ func (ctx *pushCtx) InsertRows() error {
|
|||||||
const flushTimeout = 3 * time.Second
|
const flushTimeout = 3 * time.Second
|
||||||
|
|
||||||
func (ctx *pushCtx) Read(r io.Reader) bool {
|
func (ctx *pushCtx) Read(r io.Reader) bool {
|
||||||
opentsdbReadCalls.Inc()
|
readCalls.Inc()
|
||||||
if ctx.err != nil {
|
if ctx.err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if c, ok := r.(net.Conn); ok {
|
if c, ok := r.(net.Conn); ok {
|
||||||
if err := c.SetReadDeadline(time.Now().Add(flushTimeout)); err != nil {
|
if err := c.SetReadDeadline(time.Now().Add(flushTimeout)); err != nil {
|
||||||
opentsdbReadErrors.Inc()
|
readErrors.Inc()
|
||||||
ctx.err = fmt.Errorf("cannot set read deadline: %s", err)
|
ctx.err = fmt.Errorf("cannot set read deadline: %s", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (ctx *pushCtx) Read(r io.Reader) bool {
|
|||||||
ctx.err = nil
|
ctx.err = nil
|
||||||
} else {
|
} else {
|
||||||
if ctx.err != io.EOF {
|
if ctx.err != io.EOF {
|
||||||
opentsdbReadErrors.Inc()
|
readErrors.Inc()
|
||||||
ctx.err = fmt.Errorf("cannot read OpenTSDB put protocol data: %s", ctx.err)
|
ctx.err = fmt.Errorf("cannot read OpenTSDB put protocol data: %s", ctx.err)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -131,8 +131,8 @@ func (ctx *pushCtx) reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
opentsdbReadCalls = metrics.NewCounter(`vm_read_calls_total{name="opentsdb"}`)
|
readCalls = metrics.NewCounter(`vm_read_calls_total{name="opentsdb"}`)
|
||||||
opentsdbReadErrors = metrics.NewCounter(`vm_read_errors_total{name="opentsdb"}`)
|
readErrors = metrics.NewCounter(`vm_read_errors_total{name="opentsdb"}`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPushCtx() *pushCtx {
|
func getPushCtx() *pushCtx {
|
||||||
|
@ -19,9 +19,9 @@ var (
|
|||||||
rowsInserted = metrics.NewCounter(`vm_rows_inserted_total{type="opentsdb-http"}`)
|
rowsInserted = metrics.NewCounter(`vm_rows_inserted_total{type="opentsdb-http"}`)
|
||||||
rowsPerInsert = metrics.NewSummary(`vm_rows_per_insert{type="opentsdb-http"}`)
|
rowsPerInsert = metrics.NewSummary(`vm_rows_per_insert{type="opentsdb-http"}`)
|
||||||
|
|
||||||
opentsdbReadCalls = metrics.NewCounter(`vm_read_calls_total{name="opentsdb-http"}`)
|
readCalls = metrics.NewCounter(`vm_read_calls_total{name="opentsdb-http"}`)
|
||||||
opentsdbReadErrors = metrics.NewCounter(`vm_read_errors_total{name="opentsdb-http"}`)
|
readErrors = metrics.NewCounter(`vm_read_errors_total{name="opentsdb-http"}`)
|
||||||
opentsdbUnmarshalErrors = metrics.NewCounter(`vm_unmarshal_errors_total{name="opentsdb-http"}`)
|
unmarshalErrors = metrics.NewCounter(`vm_unmarshal_errors_total{name="opentsdb-http"}`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// insertHandler processes HTTP OpenTSDB put requests.
|
// insertHandler processes HTTP OpenTSDB put requests.
|
||||||
@ -33,13 +33,13 @@ func insertHandler(req *http.Request, maxSize int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func insertHandlerInternal(req *http.Request, maxSize int64) error {
|
func insertHandlerInternal(req *http.Request, maxSize int64) error {
|
||||||
opentsdbReadCalls.Inc()
|
readCalls.Inc()
|
||||||
|
|
||||||
r := req.Body
|
r := req.Body
|
||||||
if req.Header.Get("Content-Encoding") == "gzip" {
|
if req.Header.Get("Content-Encoding") == "gzip" {
|
||||||
zr, err := common.GetGzipReader(r)
|
zr, err := common.GetGzipReader(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
opentsdbReadErrors.Inc()
|
readErrors.Inc()
|
||||||
return fmt.Errorf("cannot read gzipped http protocol data: %s", err)
|
return fmt.Errorf("cannot read gzipped http protocol data: %s", err)
|
||||||
}
|
}
|
||||||
defer common.PutGzipReader(zr)
|
defer common.PutGzipReader(zr)
|
||||||
@ -53,11 +53,11 @@ func insertHandlerInternal(req *http.Request, maxSize int64) error {
|
|||||||
lr := io.LimitReader(r, maxSize+1)
|
lr := io.LimitReader(r, maxSize+1)
|
||||||
reqLen, err := ctx.reqBuf.ReadFrom(lr)
|
reqLen, err := ctx.reqBuf.ReadFrom(lr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
opentsdbReadErrors.Inc()
|
readErrors.Inc()
|
||||||
return fmt.Errorf("cannot read HTTP OpenTSDB request: %s", err)
|
return fmt.Errorf("cannot read HTTP OpenTSDB request: %s", err)
|
||||||
}
|
}
|
||||||
if reqLen > maxSize {
|
if reqLen > maxSize {
|
||||||
opentsdbReadErrors.Inc()
|
readErrors.Inc()
|
||||||
return fmt.Errorf("too big HTTP OpenTSDB request; mustn't exceed %d bytes", maxSize)
|
return fmt.Errorf("too big HTTP OpenTSDB request; mustn't exceed %d bytes", maxSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ func insertHandlerInternal(req *http.Request, maxSize int64) error {
|
|||||||
defer parserPool.Put(p)
|
defer parserPool.Put(p)
|
||||||
v, err := p.ParseBytes(ctx.reqBuf.B)
|
v, err := p.ParseBytes(ctx.reqBuf.B)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
opentsdbUnmarshalErrors.Inc()
|
unmarshalErrors.Inc()
|
||||||
return fmt.Errorf("cannot parse HTTP OpenTSDB json: %s", err)
|
return fmt.Errorf("cannot parse HTTP OpenTSDB json: %s", err)
|
||||||
}
|
}
|
||||||
ctx.Rows.Unmarshal(v)
|
ctx.Rows.Unmarshal(v)
|
||||||
|
Loading…
Reference in New Issue
Block a user