Example #1
0
	Append(req common.SetRequest) error
	Prepend(req common.SetRequest) error
	Delete(req common.DeleteRequest) error
	Touch(req common.TouchRequest) error
	Get(req common.GetRequest) error
	GetE(req common.GetRequest) error
	Gat(req common.GATRequest) error
	Noop(req common.NoopRequest) error
	Quit(req common.QuitRequest) error
	Version(req common.VersionRequest) error
	Unknown(req common.Request) error
	Error(req common.Request, reqType common.RequestType, err error)
}

var (
	MetricCmdGetL1       = metrics.AddCounter("cmd_get_l1", nil)
	MetricCmdGetL2       = metrics.AddCounter("cmd_get_l2", nil)
	MetricCmdGetHits     = metrics.AddCounter("cmd_get_hits", nil)
	MetricCmdGetHitsL1   = metrics.AddCounter("cmd_get_hits_l1", nil)
	MetricCmdGetHitsL2   = metrics.AddCounter("cmd_get_hits_l2", nil)
	MetricCmdGetMisses   = metrics.AddCounter("cmd_get_misses", nil)
	MetricCmdGetMissesL1 = metrics.AddCounter("cmd_get_misses_l1", nil)
	MetricCmdGetMissesL2 = metrics.AddCounter("cmd_get_misses_l2", nil)
	MetricCmdGetErrors   = metrics.AddCounter("cmd_get_errors", nil)
	MetricCmdGetErrorsL1 = metrics.AddCounter("cmd_get_errors_l1", nil)
	MetricCmdGetErrorsL2 = metrics.AddCounter("cmd_get_errors_l2", nil)
	MetricCmdGetKeys     = metrics.AddCounter("cmd_get_keys", nil)
	MetricCmdGetKeysL1   = metrics.AddCounter("cmd_get_keys_l1", nil)
	MetricCmdGetKeysL2   = metrics.AddCounter("cmd_get_keys_l2", nil)

	// Batch L1L2 get metrics
Example #2
0
// protocol errors or other application errors that happen all over. Other interfaces and types used
// by multiple protocols are here so any protocol can be used on the front end as well as the back
// with the same intermediate representation.
package common

import (
	"errors"

	"github.com/netflix/rend/metrics"
)

const VersionString = "Rend 0.1"

// Common metrics used across packages
var (
	MetricBytesReadRemote     = metrics.AddCounter("bytes_read_remote", nil)
	MetricBytesReadLocal      = metrics.AddCounter("bytes_read_local", nil)
	MetricBytesReadLocalL1    = metrics.AddCounter("bytes_read_local_l1", nil)
	MetricBytesReadLocalL2    = metrics.AddCounter("bytes_read_local_l2", nil)
	MetricBytesWrittenRemote  = metrics.AddCounter("bytes_written_remote", nil)
	MetricBytesWrittenLocal   = metrics.AddCounter("bytes_written_local", nil)
	MetricBytesWrittenLocalL1 = metrics.AddCounter("bytes_written_local_l1", nil)
	MetricBytesWrittenLocalL2 = metrics.AddCounter("bytes_written_local_l2", nil)

	// Errors used across the application
	ErrBadRequest = errors.New("CLIENT_ERROR bad request")
	ErrBadLength  = errors.New("CLIENT_ERROR length is not a valid integer")
	ErrBadFlags   = errors.New("CLIENT_ERROR flags is not a valid integer")
	ErrBadExptime = errors.New("CLIENT_ERROR exptime is not a valid integer")

	ErrNoError        = errors.New("Success")
Example #3
0
const (
	ListenTCP ListenType = iota
	ListenUnix
)

type ListenArgs struct {
	// The type of the connection. "tcp" or "unix" only.
	Type ListenType
	// TCP port to listen on, if applicable
	Port int
	// Unix domain socket path to listen on, if applicable
	Path string
}

var (
	MetricConnectionsEstablishedExt = metrics.AddCounter("conn_established_ext", nil)
	MetricConnectionsEstablishedL1  = metrics.AddCounter("conn_established_l1", nil)
	MetricConnectionsEstablishedL2  = metrics.AddCounter("conn_established_l2", nil)
	MetricCmdTotal                  = metrics.AddCounter("cmd_total", nil)
	MetricErrAppError               = metrics.AddCounter("err_app_err", nil)
	MetricErrUnrecoverable          = metrics.AddCounter("err_unrecoverable", nil)

	MetricCmdGet     = metrics.AddCounter("cmd_get", nil)
	MetricCmdGetE    = metrics.AddCounter("cmd_gete", nil)
	MetricCmdSet     = metrics.AddCounter("cmd_set", nil)
	MetricCmdAdd     = metrics.AddCounter("cmd_add", nil)
	MetricCmdReplace = metrics.AddCounter("cmd_replace", nil)
	MetricCmdAppend  = metrics.AddCounter("cmd_append", nil)
	MetricCmdPrepend = metrics.AddCounter("cmd_prepend", nil)
	MetricCmdDelete  = metrics.AddCounter("cmd_delete", nil)
	MetricCmdTouch   = metrics.AddCounter("cmd_touch", nil)
Example #4
0
package binprot

import (
	"encoding/binary"
	"io"
	"sync"

	"github.com/netflix/rend/common"
	"github.com/netflix/rend/metrics"
)

const ReqHeaderLen = 24

var (
	MetricBinaryRequestHeadersParsed    = metrics.AddCounter("binary_request_headers_parsed")
	MetricBinaryRequestHeadersBadMagic  = metrics.AddCounter("binary_request_headers_bad_magic")
	MetricBinaryResponseHeadersParsed   = metrics.AddCounter("binary_response_headers_parsed")
	MetricBinaryResponseHeadersBadMagic = metrics.AddCounter("binary_response_headers_bad_magic")
)

type RequestHeader struct {
	Magic           uint8 // Already known, since we're here
	Opcode          uint8
	KeyLength       uint16
	ExtraLength     uint8
	DataType        uint8  // Always 0
	VBucket         uint16 // Not used
	TotalBodyLength uint32
	OpaqueToken     uint32 // Echoed to the client
	CASToken        uint64 // Unused in current implementation
Example #5
0
const (
	ListenTCP ListenType = iota
	ListenUnix
)

type ListenArgs struct {
	// The type of the connection. "tcp" or "unix" only.
	Type ListenType
	// TCP port to listen on, if applicable
	Port int
	// Unix domain socket path to listen on, if applicable
	Path string
}

var (
	MetricConnectionsEstablishedExt = metrics.AddCounter("conn_established_ext")
	MetricConnectionsEstablishedL1  = metrics.AddCounter("conn_established_l1")
	MetricConnectionsEstablishedL2  = metrics.AddCounter("conn_established_l2")
	MetricCmdTotal                  = metrics.AddCounter("cmd_total")
	MetricErrAppError               = metrics.AddCounter("err_app_err")
	MetricErrUnrecoverable          = metrics.AddCounter("err_unrecoverable")

	HistSet     = metrics.AddHistogram("set", false)
	HistAdd     = metrics.AddHistogram("add", false)
	HistReplace = metrics.AddHistogram("replace", false)
	HistDelete  = metrics.AddHistogram("delete", false)
	HistTouch   = metrics.AddHistogram("touch", false)
	HistGet     = metrics.AddHistogram("get", false)  // not sampled until configurable
	HistGetE    = metrics.AddHistogram("gete", false) // not sampled until configurable
	HistGat     = metrics.AddHistogram("gat", false)  // not sampled until configurable
Example #6
0
package chunked

import (
	"bufio"
	"bytes"
	"io"
	"math"

	"github.com/netflix/rend/binprot"
	"github.com/netflix/rend/common"
	"github.com/netflix/rend/metrics"
)

var (
	MetricCmdSetErrorsOOM   = metrics.AddCounter("cmd_set_errors_oom")
	MetricCmdSetErrorsOOML1 = metrics.AddCounter("cmd_set_errors_oom_l1")
	MetricCmdSetErrorsOOML2 = metrics.AddCounter("cmd_set_errors_oom_l2")

	MetricCmdTouchMissesMeta    = metrics.AddCounter("cmd_touch_misses_meta")
	MetricCmdTouchMissesMetaL1  = metrics.AddCounter("cmd_touch_misses_meta_l1")
	MetricCmdTouchMissesMetaL2  = metrics.AddCounter("cmd_touch_misses_meta_l2")
	MetricCmdTouchMissesChunk   = metrics.AddCounter("cmd_touch_misses_chunk")
	MetricCmdTouchMissesChunkL1 = metrics.AddCounter("cmd_touch_misses_chunk_l1")
	MetricCmdTouchMissesChunkL2 = metrics.AddCounter("cmd_touch_misses_chunk_l2")

	MetricCmdDeleteMissesMeta    = metrics.AddCounter("cmd_delete_misses_meta")
	MetricCmdDeleteMissesMetaL1  = metrics.AddCounter("cmd_delete_misses_meta_l1")
	MetricCmdDeleteMissesMetaL2  = metrics.AddCounter("cmd_delete_misses_meta_l2")
	MetricCmdDeleteMissesChunk   = metrics.AddCounter("cmd_delete_misses_chunk")
	MetricCmdDeleteMissesChunkL1 = metrics.AddCounter("cmd_delete_misses_chunk_l1")
Example #7
0
	Add(req common.SetRequest) error
	Replace(req common.SetRequest) error
	Delete(req common.DeleteRequest) error
	Touch(req common.TouchRequest) error
	Get(req common.GetRequest) error
	GetE(req common.GetRequest) error
	Gat(req common.GATRequest) error
	Noop(req common.NoopRequest) error
	Quit(req common.QuitRequest) error
	Version(req common.VersionRequest) error
	Unknown(req common.Request) error
	Error(req common.Request, reqType common.RequestType, err error)
}

var (
	MetricCmdGet         = metrics.AddCounter("cmd_get")
	MetricCmdGetL1       = metrics.AddCounter("cmd_get_l1")
	MetricCmdGetL2       = metrics.AddCounter("cmd_get_l2")
	MetricCmdGetHits     = metrics.AddCounter("cmd_get_hits")
	MetricCmdGetHitsL1   = metrics.AddCounter("cmd_get_hits_l1")
	MetricCmdGetHitsL2   = metrics.AddCounter("cmd_get_hits_l2")
	MetricCmdGetMisses   = metrics.AddCounter("cmd_get_misses")
	MetricCmdGetMissesL1 = metrics.AddCounter("cmd_get_misses_l1")
	MetricCmdGetMissesL2 = metrics.AddCounter("cmd_get_misses_l2")
	MetricCmdGetErrors   = metrics.AddCounter("cmd_get_errors")
	MetricCmdGetErrorsL1 = metrics.AddCounter("cmd_get_errors_l1")
	MetricCmdGetErrorsL2 = metrics.AddCounter("cmd_get_errors_l2")
	MetricCmdGetKeys     = metrics.AddCounter("cmd_get_keys")
	MetricCmdGetKeysL1   = metrics.AddCounter("cmd_get_keys_l1")
	MetricCmdGetKeysL2   = metrics.AddCounter("cmd_get_keys_l2")