package module
v0.43.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 10



Package otelmemcache instruments github.com/bradfitz/gomemcache/memcache.

This instrumentation provided is tracing instrumentation for the memcached client.

The instrumentation works by wrapping the memcached client by calling `NewClientWithTracing` and tracing it's every operation.



This section is empty.


This section is empty.


func SemVersion deprecated added in v0.24.0

func SemVersion() string

SemVersion is the semantic version to be supplied to tracer/meter creation.

Deprecated: Use Version instead.

func Version added in v0.24.0

func Version() string

Version is the current release version of the memcached instrumentation.


type Client

type Client struct {
	// contains filtered or unexported fields

Client is a wrapper around *memcache.Client.

func NewClientWithTracing

func NewClientWithTracing(client *memcache.Client, opts ...Option) *Client

NewClientWithTracing wraps the provided memcache client to allow tracing of all client operations. Accepts options to set trace provider and service name, otherwise uses registered global trace provider and default value for service name.

Every client operation starts a span with appropriate attributes, executes the operation and ends the span (additionally also sets a status error code and message, if an error occurs). Optionally, client context can be set before an operation with the WithContext method.

func (*Client) Add

func (c *Client) Add(item *memcache.Item) error

Add invokes the add operation and traces it.

func (*Client) CompareAndSwap

func (c *Client) CompareAndSwap(item *memcache.Item) error

CompareAndSwap invokes the compare-and-swap operation and traces it.

func (*Client) Decrement

func (c *Client) Decrement(key string, delta uint64) (uint64, error)

Decrement invokes the decrement operation and traces it.

func (*Client) Delete

func (c *Client) Delete(key string) error

Delete invokes the delete operation and traces it.

func (*Client) DeleteAll

func (c *Client) DeleteAll() error

DeleteAll invokes the delete all operation and traces it.

func (*Client) FlushAll

func (c *Client) FlushAll() error

FlushAll invokes the flush all operation and traces it.

func (*Client) Get

func (c *Client) Get(key string) (*memcache.Item, error)

Get invokes the get operation and traces it.

func (*Client) GetMulti

func (c *Client) GetMulti(keys []string) (map[string]*memcache.Item, error)

GetMulti invokes the get operation for multiple keys and traces it.

func (*Client) Increment

func (c *Client) Increment(key string, delta uint64) (uint64, error)

Increment invokes the increment operation and traces it.

func (*Client) Ping

func (c *Client) Ping() error

Ping invokes the ping operation and traces it.

func (*Client) Replace

func (c *Client) Replace(item *memcache.Item) error

Replace invokes the replace operation and traces it.

func (*Client) Set

func (c *Client) Set(item *memcache.Item) error

Set invokes the set operation and traces it.

func (*Client) Touch

func (c *Client) Touch(key string, seconds int32) error

Touch invokes the touch operation and traces it.

func (*Client) WithContext

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

WithContext retruns a copy of the client with provided context.

type Option

type Option interface {
	// contains filtered or unexported methods

Option is used to configure the client.

func WithTracerProvider

func WithTracerProvider(provider oteltrace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.


Path Synopsis
example module
test module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL