Documentation

Overview

    Package redis provides tracing functions for tracing the go-redis/redis package (https://github.com/go-redis/redis). This package supports versions up to go-redis 6.15.

    Example

      To start tracing Redis, simply create a new client using the library and continue using as you normally would.

      Output:
      
      
      Example (Pipeliner)

        You can also trace Redis Pipelines. Simply use as usual and the traces will be automatically picked up by the underlying implementation.

        Output:
        
        

        Index

        Examples

        Constants

        This section is empty.

        Variables

        This section is empty.

        Functions

        This section is empty.

        Types

        type Client

        type Client struct {
        	*redis.Client
        	// contains filtered or unexported fields
        }

          Client is used to trace requests to a redis server.

          func NewClient

          func NewClient(opt *redis.Options, opts ...ClientOption) *Client

            NewClient returns a new Client that is traced with the default tracer under the service name "redis".

            func WrapClient

            func WrapClient(c *redis.Client, opts ...ClientOption) *Client

              WrapClient wraps a given redis.Client with a tracer under the given service name.

              func (*Client) Pipeline

              func (c *Client) Pipeline() redis.Pipeliner

                Pipeline creates a Pipeline from a Client

                func (*Client) Pipelined

                func (c *Client) Pipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)

                  Pipelined executes a function parameter to build a Pipeline and then immediately executes it.

                  func (*Client) TxPipeline

                  func (c *Client) TxPipeline() redis.Pipeliner

                    TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

                    func (*Client) TxPipelined

                    func (c *Client) TxPipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)

                      TxPipelined executes a function parameter to build a Transactional Pipeline and then immediately executes it.

                      func (*Client) WithContext

                      func (c *Client) WithContext(ctx context.Context) *Client

                        WithContext sets a context on a Client. Use it to ensure that emitted spans have the correct parent.

                        type ClientOption

                        type ClientOption func(*clientConfig)

                          ClientOption represents an option that can be used to create or wrap a client.

                          func WithAnalytics

                          func WithAnalytics(on bool) ClientOption

                            WithAnalytics enables Trace Analytics for all started spans.

                            func WithAnalyticsRate

                            func WithAnalyticsRate(rate float64) ClientOption

                              WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

                              func WithServiceName

                              func WithServiceName(name string) ClientOption

                                WithServiceName sets the given service name for the client.

                                type Pipeliner

                                type Pipeliner struct {
                                	redis.Pipeliner
                                	// contains filtered or unexported fields
                                }

                                  Pipeliner is used to trace pipelines executed on a Redis server.

                                  func (*Pipeliner) Exec

                                  func (c *Pipeliner) Exec() ([]redis.Cmder, error)

                                    Exec calls Pipeline.Exec() ensuring that the resulting Redis calls are traced.

                                    func (*Pipeliner) ExecWithContext

                                    func (c *Pipeliner) ExecWithContext(ctx context.Context) ([]redis.Cmder, error)

                                      ExecWithContext calls Pipeline.Exec(). It ensures that the resulting Redis calls are traced, and that emitted spans are children of the given Context.

                                      func (*Pipeliner) Pipelined

                                      func (c *Pipeliner) Pipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)

                                        Pipelined executes a function parameter to build a Pipeline and then immediately executes the built pipeline.

                                        Source Files