tracing

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommandHandlerMiddleware

func NewCommandHandlerMiddleware() eh.CommandHandlerMiddleware

NewCommandHandlerMiddleware returns a new command handler middleware that adds tracing spans.

func NewEventHandlerMiddleware

func NewEventHandlerMiddleware() eh.EventHandlerMiddleware

NewEventHandlerMiddleware returns an event handler middleware that adds tracing spans.

func RegisterContext

func RegisterContext()

RegisterContext registers the tracing span to be marshaled/unmarshaled on the context. This enables propagation of the tracing spans for backends that supports it (like Jaeger).

For usage with Elastic APM which doesn't support submitting of child spans for the same parent span multiple times outside of a single transaction don't register the context. This will provide a new context upon handling in the event bus or outbox, which currently is the best Elastic APM can support.

See: https://github.com/elastic/apm/issues/122

Types

type EventBus

type EventBus struct {
	eh.EventBus
	// contains filtered or unexported fields
}

EventBus is an event bus wrapper that adds tracing.

func NewEventBus

func NewEventBus(eventBus eh.EventBus) *EventBus

NewEventBus creates a EventBus.

func (*EventBus) AddHandler

func (b *EventBus) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error

AddHandler implements the AddHandler method of the eventhorizon.EventBus interface.

func (*EventBus) HandleEvent

func (b *EventBus) HandleEvent(ctx context.Context, event eh.Event) error

HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface.

type EventStore

type EventStore struct {
	eh.EventStore
}

EventStore is an eventhorizon.EventStore that adds tracing with Open Tracing.

func NewEventStore

func NewEventStore(eventStore eh.EventStore) *EventStore

NewEventStore creates a new EventStore.

func (*EventStore) Load

func (s *EventStore) Load(ctx context.Context, id uuid.UUID) ([]eh.Event, error)

Load implements the Load method of the eventhorizon.EventStore interface.

func (*EventStore) Save

func (s *EventStore) Save(ctx context.Context, events []eh.Event, originalVersion int) error

Save implements the Save method of the eventhorizon.EventStore interface.

type Outbox

type Outbox struct {
	eh.Outbox
	// contains filtered or unexported fields
}

Outbox is an event bus wrapper that adds tracing.

func NewOutbox

func NewOutbox(outbox eh.Outbox) *Outbox

NewOutbox creates a Outbox.

func (*Outbox) AddHandler

func (b *Outbox) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error

AddHandler implements the AddHandler method of the eventhorizon.Outbox interface.

func (*Outbox) HandleEvent

func (b *Outbox) HandleEvent(ctx context.Context, event eh.Event) error

HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface.

type Repo

type Repo struct {
	eh.ReadWriteRepo
}

Repo is a ReadWriteRepo that adds tracing.

func IntoRepo

func IntoRepo(ctx context.Context, repo eh.ReadRepo) *Repo

IntoRepo tries to convert a eh.ReadRepo into a Repo by recursively looking at inner repos. Returns nil if none was found.

func NewRepo

func NewRepo(repo eh.ReadWriteRepo) *Repo

NewRepo creates a new Repo.

func (*Repo) Find

func (r *Repo) Find(ctx context.Context, id uuid.UUID) (eh.Entity, error)

Find implements the Find method of the eventhorizon.ReadModel interface.

func (*Repo) FindAll

func (r *Repo) FindAll(ctx context.Context) ([]eh.Entity, error)

FindAll implements the FindAll method of the eventhorizon.ReadRepo interface.

func (*Repo) InnerRepo

func (r *Repo) InnerRepo(ctx context.Context) eh.ReadRepo

InnerRepo implements the InnerRepo method of the eventhorizon.ReadRepo interface.

func (*Repo) Remove

func (r *Repo) Remove(ctx context.Context, id uuid.UUID) error

Remove implements the Remove method of the eventhorizon.WriteRepo interface.

func (*Repo) Save

func (r *Repo) Save(ctx context.Context, entity eh.Entity) error

Save implements the Save method of the eventhorizon.WriteRepo interface.

Jump to

Keyboard shortcuts

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