RegisterPool is called when a new client is created with its connection pools.
poolName: identifier for the pool (e.g., "main_abc123")
pool: the connection pool RegisterPubSubPool is called when a new client is created with a PubSub pool.
poolName: identifier for the pool (e.g., "main_abc123_pubsub")
pool: the PubSub connection pool UnregisterPool is called when a client is closed to remove its pool from the registry.
pool: the connection pool to unregister UnregisterPubSubPool is called when a PubSub client is closed to remove its pool.
pool: the PubSub connection pool to unregister
Recorder is the interface for recording metrics. RecordConnectionClosed records when a connection is closed
reason: reason for closing (e.g., "idle", "max_lifetime", "error", "pool_closed")
err: the error that caused the close (nil for non-error closures) RecordConnectionCount records a change in connection count (UpDownCounter)
delta: +1 when connection added, -1 when connection removed
state: connection state (e.g., "idle", "used")
isPubSub: true if this is a PubSub connection RecordConnectionCreateTime records the time it took to create a new connection RecordConnectionHandoff records when a connection is handed off to another node
poolName: name of the connection pool (e.g., "main", "pubsub") RecordConnectionRelaxedTimeout records when connection timeout is relaxed/unrelaxed
delta: +1 for relaxed, -1 for unrelaxed
poolName: name of the connection pool (e.g., "main", "pubsub")
notificationType: the notification type that triggered the timeout relaxation (e.g., "MOVING") RecordConnectionWaitTime records the time spent waiting for a connection from the pool RecordError records client errors (ASK, MOVED, handshake failures, etc.)
errorType: type of error (e.g., "ASK", "MOVED", "HANDSHAKE_FAILED")
statusCode: Redis response status code if available (e.g., "MOVED", "ASK")
isInternal: whether this is an internal error
retryAttempts: number of retry attempts made RecordMaintenanceNotification records when a maintenance notification is received
notificationType: the type of notification (e.g., "MOVING", "MIGRATING", etc.) RecordOperationDuration records the total operation duration (including all retries)
dbIndex is the Redis database index (0-15) RecordPendingRequests records a change in pending requests (UpDownCounter)
delta: +1 when request starts waiting, -1 when request stops waiting
poolName is passed explicitly because we may not have a connection yet when request starts RecordPipelineOperationDuration records the total pipeline/transaction duration.
operationName should be "PIPELINE" for regular pipelines or "MULTI" for transactions.
cmdCount is the number of commands in the pipeline.
err is the error from the pipeline execution (can be nil).
dbIndex is the Redis database index (0-15) RecordPubSubMessage records a Pub/Sub message
direction: "sent" or "received"
channel: channel name (may be hidden for cardinality reduction)
sharded: true for sharded pub/sub (SPUBLISH/SSUBSCRIBE) RecordStreamLag records the lag for stream consumer group processing
lag: time difference between message creation and consumption
streamName: name of the stream (may be hidden for cardinality reduction)
consumerGroup: name of the consumer group
consumerName: name of the consumer
func SetGlobalRecorder(r Recorder)
Package-Level Functions (total 11)
Enabled reports whether a real recorder is installed. Callers use it to
skip metric work whose INPUTS are expensive to obtain — e.g. reading a
command's result, which on the async autopipeline face blocks until the
command executes.
GetOperationDurationCallback returns the callback for operation duration.
GetPipelineOperationDurationCallback returns the callback for pipeline operation duration.
RecordConnectionCreateTime records the time it took to create a new connection.
RecordOperationDuration records the total operation duration.
dbIndex is the Redis database index (0-15).
RecordPipelineOperationDuration records the total pipeline/transaction duration.
This is called from redis.go after pipeline/transaction execution completes.
operationName should be "PIPELINE" for regular pipelines or "MULTI" for transactions.
err is the error from the pipeline execution (can be nil).
dbIndex is the Redis database index (0-15).
RecordPubSubMessage records a Pub/Sub message sent or received.
RecordStreamLag records the lag between message creation and consumption in a stream.
RegisterPools registers connection pools with the global recorder. pipelinePool
is the optional dedicated pipeline connection pool (nil when not configured);
it is registered as a regular pool under a "_pipeline" name suffix.
SetGlobalRecorder sets the global recorder (called by Init() in extra/redisotel-native)
UnregisterPools removes connection pools from the global recorder. pipelinePool
is the optional dedicated pipeline connection pool (nil when not configured).
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.