leveldb

package
v1.999.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

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

Example
package main

import (
	"context"

	leveldbtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb"
	"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)

func main() {
	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)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB = v2.DB

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

func Open

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

Open calls leveldb.Open and wraps the resulting DB.

func OpenFile

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

OpenFile calls leveldb.OpenFile and wraps the resulting DB.

func WrapDB

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

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

type Iterator

type Iterator = v2.Iterator

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

func WrapIterator

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

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

type Option

type Option = v2.Option

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

func WithAnalytics added in v1.11.0

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate added in v1.11.0

func WithAnalyticsRate(rate float64) Option

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

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets the tracing context for the db.

func WithServiceName

func WithServiceName(serviceName string) Option

WithServiceName sets the given service name for the db.

type Snapshot

type Snapshot = v2.Snapshot

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

func WrapSnapshot

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

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

type Transaction

type Transaction = v2.Transaction

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

func WrapTransaction

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

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

Jump to

Keyboard shortcuts

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