dd-trace-go.v1: gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb Index | Examples | Files

package leveldb

import "gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb"

Package leveldb provides functions to trace the syndtr/goleveldb package (https://github.com/syndtr/goleveldb).

Code:

db, _ := leveldbtrace.OpenFile("/tmp/example.leveldb", nil)

// Create a root span, giving name, server and resource.
_, ctx := tracer.StartSpanFromContext(context.Background(), "my-query",
    tracer.ServiceName("my-db"),
    tracer.ResourceName("initial-access"),
)

// use WithContext to associate the span with the parent
db.WithContext(ctx).
    // calls will be traced
    Put([]byte("key"), []byte("value"), nil)

Index

Examples

Package Files

leveldb.go option.go

type DB Uses

type DB struct {
    *leveldb.DB
    // contains filtered or unexported fields
}

A DB wraps a leveldb.DB and traces all queries.

func Open Uses

func Open(stor storage.Storage, o *opt.Options, opts ...Option) (*DB, error)

Open calls leveldb.Open and wraps the resulting DB.

func OpenFile Uses

func OpenFile(path string, o *opt.Options, opts ...Option) (*DB, error)

OpenFile calls leveldb.OpenFile and wraps the resulting DB.

func WrapDB Uses

func WrapDB(db *leveldb.DB, opts ...Option) *DB

WrapDB wraps a leveldb.DB so that queries are traced.

func (*DB) CompactRange Uses

func (db *DB) CompactRange(r util.Range) error

CompactRange calls DB.CompactRange and traces the result.

func (*DB) Delete Uses

func (db *DB) Delete(key []byte, wo *opt.WriteOptions) error

Delete calls DB.Delete and traces the result.

func (*DB) Get Uses

func (db *DB) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error)

Get calls DB.Get and traces the result.

func (*DB) GetSnapshot Uses

func (db *DB) GetSnapshot() (*Snapshot, error)

GetSnapshot calls DB.GetSnapshot and returns a wrapped Snapshot.

func (*DB) Has Uses

func (db *DB) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error)

Has calls DB.Has and traces the result.

func (*DB) NewIterator Uses

func (db *DB) NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator

NewIterator calls DB.NewIterator and returns a wrapped Iterator.

func (*DB) OpenTransaction Uses

func (db *DB) OpenTransaction() (*Transaction, error)

OpenTransaction calls DB.OpenTransaction and returns a wrapped Transaction.

func (*DB) Put Uses

func (db *DB) Put(key, value []byte, wo *opt.WriteOptions) error

Put calls DB.Put and traces the result.

func (*DB) WithContext Uses

func (db *DB) WithContext(ctx context.Context) *DB

WithContext returns a new DB with the context set to ctx.

func (*DB) Write Uses

func (db *DB) Write(batch *leveldb.Batch, wo *opt.WriteOptions) error

Write calls DB.Write and traces the result.

type Iterator Uses

type Iterator struct {
    iterator.Iterator
    // contains filtered or unexported fields
}

An Iterator wraps a leveldb.Iterator and traces until Release is called.

func WrapIterator Uses

func WrapIterator(it iterator.Iterator, opts ...Option) *Iterator

WrapIterator wraps a leveldb.Iterator so that queries are traced.

func (*Iterator) Release Uses

func (it *Iterator) Release()

Release calls Iterator.Release and traces the result.

type Option Uses

type Option func(*config)

Option represents an option that can be used customize the db tracing config.

func WithAnalytics Uses

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate Uses

func WithAnalyticsRate(rate float64) Option

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

func WithContext Uses

func WithContext(ctx context.Context) Option

WithContext sets the tracing context for the db.

func WithServiceName Uses

func WithServiceName(serviceName string) Option

WithServiceName sets the given service name for the db.

type Snapshot Uses

type Snapshot struct {
    *leveldb.Snapshot
    // contains filtered or unexported fields
}

A Snapshot wraps a leveldb.Snapshot and traces all queries.

func WrapSnapshot Uses

func WrapSnapshot(snap *leveldb.Snapshot, opts ...Option) *Snapshot

WrapSnapshot wraps a leveldb.Snapshot so that queries are traced.

func (*Snapshot) Get Uses

func (snap *Snapshot) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error)

Get calls Snapshot.Get and traces the result.

func (*Snapshot) Has Uses

func (snap *Snapshot) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error)

Has calls Snapshot.Has and traces the result.

func (*Snapshot) NewIterator Uses

func (snap *Snapshot) NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator

NewIterator calls Snapshot.NewIterator and returns a wrapped Iterator.

func (*Snapshot) WithContext Uses

func (snap *Snapshot) WithContext(ctx context.Context) *Snapshot

WithContext returns a new Snapshot with the context set to ctx.

type Transaction Uses

type Transaction struct {
    *leveldb.Transaction
    // contains filtered or unexported fields
}

A Transaction wraps a leveldb.Transaction and traces all queries.

func WrapTransaction Uses

func WrapTransaction(tr *leveldb.Transaction, opts ...Option) *Transaction

WrapTransaction wraps a leveldb.Transaction so that queries are traced.

func (*Transaction) Commit Uses

func (tr *Transaction) Commit() error

Commit calls Transaction.Commit and traces the result.

func (*Transaction) Get Uses

func (tr *Transaction) Get(key []byte, ro *opt.ReadOptions) ([]byte, error)

Get calls Transaction.Get and traces the result.

func (*Transaction) Has Uses

func (tr *Transaction) Has(key []byte, ro *opt.ReadOptions) (bool, error)

Has calls Transaction.Has and traces the result.

func (*Transaction) NewIterator Uses

func (tr *Transaction) NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator

NewIterator calls Transaction.NewIterator and returns a wrapped Iterator.

func (*Transaction) WithContext Uses

func (tr *Transaction) WithContext(ctx context.Context) *Transaction

WithContext returns a new Transaction with the context set to ctx.

Package leveldb imports 10 packages (graph). Updated 2020-02-21. Refresh now. Tools for package owners.