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)
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
A DB wraps a leveldb.DB and traces all queries.
type Option ¶
Option represents an option that can be used customize the db tracing config.
func WithAnalytics ¶ added in v1.11.0
WithAnalytics enables Trace Analytics for all started spans.
func WithAnalyticsRate ¶ added in v1.11.0
WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.
func WithContext ¶
WithContext sets the tracing context for the db.
func WithServiceName ¶
WithServiceName sets the given service name for the db.
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.