package trace

import "github.com/ipfs/go-datastore/trace"

Package trace wraps a datastore where all datastore interactions are traced with open telemetry.

Index

Types

type Datastore

type Datastore struct {
	// contains filtered or unexported fields
}

Datastore is an adapter that traces inner datastore interactions.

func New

func New(ds ds.Datastore, tracer otel.Tracer) *Datastore

New returns a new traced datastore. All datastore interactions are traced.

func (*Datastore) Batch

func (t *Datastore) Batch(ctx context.Context) (ds.Batch, error)

Batch implements the ds.Batching interface.

func (*Datastore) Check

func (t *Datastore) Check(ctx context.Context) error

Check implements the ds.CheckedDatastore interface.

func (*Datastore) Close

func (t *Datastore) Close() error

Close closes the inner datastore (if it implements the io.Closer interface).

func (*Datastore) CollectGarbage

func (t *Datastore) CollectGarbage(ctx context.Context) error

CollectGarbage implements the ds.GCDatastore interface.

func (*Datastore) Delete

func (t *Datastore) Delete(ctx context.Context, key ds.Key) error

Delete implements the ds.Datastore interface.

func (*Datastore) DiskUsage

func (t *Datastore) DiskUsage(ctx context.Context) (uint64, error)

DiskUsage implements the ds.PersistentDatastore interface.

func (*Datastore) Get

func (t *Datastore) Get(ctx context.Context, key ds.Key) (value []byte, err error)

Get implements the ds.Datastore interface.

func (*Datastore) GetSize

func (t *Datastore) GetSize(ctx context.Context, key ds.Key) (int, error)

GetSize implements the ds.Datastore interface.

func (*Datastore) Has

func (t *Datastore) Has(ctx context.Context, key ds.Key) (bool, error)

Has implements the ds.Datastore interface.

func (*Datastore) NewTransaction

func (t *Datastore) NewTransaction(ctx context.Context, readOnly bool) (ds.Txn, error)

NewTransaction implements the ds.TxnDatastore interface.

func (*Datastore) Put

func (t *Datastore) Put(ctx context.Context, key ds.Key, value []byte) error

Put implements the ds.Datastore interface.

func (*Datastore) Query

func (t *Datastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)

Query implements the ds.Datastore interface.

func (*Datastore) Scrub

func (t *Datastore) Scrub(ctx context.Context) error

Scrub implements the ds.ScrubbedDatastore interface.

func (*Datastore) Sync

func (t *Datastore) Sync(ctx context.Context, key ds.Key) error

Sync implements Datastore.Sync

type Txn

type Txn struct {
	// contains filtered or unexported fields
}

Txn is an adapter that traces datastore transactions

func (*Txn) Commit

func (t *Txn) Commit(ctx context.Context) error

Commit implements the ds.Txn interface.

func (*Txn) Delete

func (t *Txn) Delete(ctx context.Context, key ds.Key) error

Delete implements the ds.Txn interface.

func (*Txn) Discard

func (t *Txn) Discard(ctx context.Context)

Discard implements the ds.Txn interface.

func (*Txn) Get

func (t *Txn) Get(ctx context.Context, key ds.Key) (value []byte, err error)

Get implements the ds.Txn interface.

func (*Txn) GetSize

func (t *Txn) GetSize(ctx context.Context, key ds.Key) (int, error)

GetSize implements the ds.Txn interface.

func (*Txn) Has

func (t *Txn) Has(ctx context.Context, key ds.Key) (bool, error)

Has implements the ds.Txn interface.

func (*Txn) Put

func (t *Txn) Put(ctx context.Context, key ds.Key, value []byte) error

Put implements the ds.Txn interface.

func (*Txn) Query

func (t *Txn) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)

Query implements the ds.Txn interface.

Source Files

trace.go

Version
v0.8.2 (latest)
Published
Mar 4, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
1 month ago

Tools for package owners.