package trace - github.com/mediocregopher/radix/v4/trace - godocs.io

import "github.com/mediocregopher/radix/v4/trace"

Package trace contains all the types provided for tracing within the radix package. With tracing a user is able to pull out fine-grained runtime events as they happen, which is useful for gathering metrics, logging, performance analysis, etc...

Events which are eligible for tracing are those which would not be possible to access otherwise.

Types

type ClusterInternalError

type ClusterInternalError struct {
	Err error
}

ClusterInternalError is passed into the ClusterTrace.InternalError callback whenever Cluster encounters an error which is not otherwise communicated to the user.

type ClusterNodeInfo

type ClusterNodeInfo struct {
	Addr      string
	Slots     [][2]uint16
	IsPrimary bool
}

ClusterNodeInfo describes the attributes of a node in a redis cluster's topology.

type ClusterRedirected

type ClusterRedirected struct {
	// Context is the Context passed into the Do call which is performing the
	// Action which received a MOVED/ASK error.
	Context context.Context

	// Addr is the address of the redis instance the Action was performed
	// against.
	Addr string

	// Key is the key that the Action would operate on.
	Key string

	// Moved and Ask denote which kind of error was returned. One will be true.
	Moved, Ask bool

	// RedirectCount denotes how many times the Action has been redirected so
	// far.
	RedirectCount int

	// Final indicates that the MOVED/ASK error which was received will not be
	// honored, and the call to Do will be returning the MOVED/ASK error.
	Final bool
}

ClusterRedirected is passed into the ClusterTrace.Redirected callback whenever redis responds to an Action with a 'MOVED' or 'ASK' error.

type ClusterStateChange

type ClusterStateChange struct {
	IsDown bool
}

ClusterStateChange is passed into the ClusterTrace.StateChange callback whenever the Cluster's state has changed.

type ClusterTopoChanged

type ClusterTopoChanged struct {
	Added   []ClusterNodeInfo
	Removed []ClusterNodeInfo
	Changed []ClusterNodeInfo
}

ClusterTopoChanged is passed into the ClusterTrace.TopoChanged callback whenever the Cluster's topology has changed.

type ClusterTrace

type ClusterTrace struct {
	// StateChange is called when the Cluster becomes down or becomes available
	// again.
	StateChange func(ClusterStateChange)

	// TopoChanged is called when the Cluster's topology changes.
	TopoChanged func(ClusterTopoChanged)

	// Redirected is called when redis responds to an Action with a 'MOVED' or
	// 'ASK' error.
	Redirected func(ClusterRedirected)

	// InternalError is called whenever the Cluster encounters an error which is
	// not otherwise communicated to the user.
	InternalError func(ClusterInternalError)
}

ClusterTrace contains callbacks which can be triggered for specific events during a Cluster's runtime.

All callbacks are called synchronously.

type PersistentPubSubInternalError

type PersistentPubSubInternalError struct {
	Err error
}

PersistentPubSubInternalError is passed into the PersistentPubSubTrace.InternalError callback whenever PersistentPubSub encounters an error which is not otherwise communicated to the user.

type PersistentPubSubTrace

type PersistentPubSubTrace struct {
	// InternalError is called whenever the PersistentPubSub encounters an error
	// which is not otherwise communicated to the user.
	InternalError func(PersistentPubSubInternalError)
}

PersistentPubSubTrace contains callbacks which can be triggered for specific events during a persistent PubSubConn's runtime.

All callbacks are called synchronously.

type PoolCommon

type PoolCommon struct {
	// Network and Addr indicate the network/address the Pool was created with
	// (useful for differentiating different redis instances in a Cluster).
	Network, Addr string

	// PoolSize indicates the PoolSize that the Pool was initialized with.
	PoolSize int
}

PoolCommon contains information which is passed into all Pool-related callbacks.

type PoolConnClosed

type PoolConnClosed struct {
	PoolCommon

	// Reason describes why the Conn was closed.
	Reason PoolConnClosedReason
}

PoolConnClosed is passed into the PoolTrace.ConnClosed callback whenever the Pool closes a Conn.

type PoolConnClosedReason

type PoolConnClosedReason string

PoolConnClosedReason enumerates all the different reasons a Conn might be closed and trigger a ConnClosed trace.

const (
	// PoolConnClosedReasonPoolClosed indicates a Conn was closed because the
	// Close method was called on the Pool.
	PoolConnClosedReasonPoolClosed PoolConnClosedReason = "pool closed"

	// PoolConnClosedReasonError indicates a Conn was closed due to having
	// received some kind of unrecoverable error on it.
	PoolConnClosedReasonError PoolConnClosedReason = "error"
)

All possible values of PoolConnClosedReason.

type PoolConnCreated

type PoolConnCreated struct {
	PoolCommon

	// Context is the Context used when creating the Conn.
	Context context.Context

	// Reason describes why the Conn was created.
	Reason PoolConnCreatedReason

	// ConnectTime is how long it took to create the Conn.
	ConnectTime time.Duration

	// Err will be filled if creating the Conn failed.
	Err error
}

PoolConnCreated is passed into the PoolTrace.ConnCreated callback whenever the Pool creates a new Conn.

type PoolConnCreatedReason

type PoolConnCreatedReason string

PoolConnCreatedReason enumerates all the different reasons a Conn might be created and trigger a ConnCreated trace.

const (
	// PoolConnCreatedReasonInitialization indicates a Conn was created during
	// initialization of the Pool (i.e. within PoolConfig.New).
	PoolConnCreatedReasonInitialization PoolConnCreatedReason = "initialization"

	// PoolConnCreatedReasonReconnect indicates a Conn was created during a
	// reconnect event.
	PoolConnCreatedReasonReconnect PoolConnCreatedReason = "reconnect"
)

All possible values of PoolConnCreatedReason.

type PoolInitCompleted

type PoolInitCompleted struct {
	PoolCommon

	// ElapsedTime is how long it took to finish initialization.
	ElapsedTime time.Duration
}

PoolInitCompleted is passed into the PoolTrace.InitCompleted callback whenever Pool is done initializing.

type PoolTrace

type PoolTrace struct {
	// ConnCreated is called when the Pool creates a new Conn.
	ConnCreated func(PoolConnCreated)

	// ConnClosed is called when the Pool closes a Conn.
	ConnClosed func(PoolConnClosed)

	// InitCompleted is called after the Pool creates all Conns during
	// initialization.
	InitCompleted func(PoolInitCompleted)
}

PoolTrace contains callbacks which can be triggered for specific events during a Pool's runtime.

All callbacks are called synchronously.

type SentinelInternalError

type SentinelInternalError struct {
	Err error
}

SentinelInternalError is passed into the SentinelTrace.InternalError callback whenever Sentinel encounters an error which is not otherwise communicated to the user.

type SentinelNodeInfo

type SentinelNodeInfo struct {
	Addr      string
	IsPrimary bool
}

SentinelNodeInfo describes the attributes of a node in a sentinel replica set's topology.

type SentinelTopoChanged

type SentinelTopoChanged struct {
	Added   []SentinelNodeInfo
	Removed []SentinelNodeInfo
	Changed []SentinelNodeInfo
}

SentinelTopoChanged is passed into the SentinelTrace.TopoChanged callback whenever the Sentinel's replica set's topology has changed.

type SentinelTrace

type SentinelTrace struct {
	// TopoChanged is called when the Sentinel's replica set's topology changes.
	TopoChanged func(SentinelTopoChanged)

	// InternalError is called whenever the Sentinel encounters an error which
	// is not otherwise communicated to the user.
	InternalError func(SentinelInternalError)
}

SentinelTrace contains callbacks which can be triggered for specific events during a Sentinel's runtime.

All callbacks are called synchronously.

Details

Version: v4.1.4 (latest)

Platform: linux/amd64

Imports: 2 packages

Refresh now

Back to home

Search